Commit Graph

3382 Commits

Author SHA1 Message Date
Durham Goode
286d6bbe18 infinitepush: send treepack parts with the client push
This makes the client side pushes also include tree packs in the push.

Also adds a test to see that the tree parts round trip between two tree-only
clients.

Differential Revision: https://phab.mercurial-scm.org/D721
2017-09-22 08:55:56 -07:00
Durham Goode
d0ee81e289 infinitepush: serve trees from stored bundle when rebundling
When serving data from a stored bundle, if we need to rebundle the data first,
we need to make sure that the tree data stored within the bundle gets packaged
up as well.

If we're not rebundling, then things work fine as is since it just forwards the
parts along.

Differential Revision: https://phab.mercurial-scm.org/D720
2017-09-22 08:55:56 -07:00
Durham Goode
e9f972b87d infinitepush: support serving extra parts stored in the bundle
Previously, when serving the contents of a stored bundle, we would explicitly
pick out the changegroup and serve only that. Let's also send along all other
parts that are stored in the bundle.

At the moment the only other parts that are stored in the bundle are the ones in
the partforwardingwhitelist in processparts, which is only treemanifest packs
right now. Later we'll serve bookmarks using this same pattern.

Differential Revision: https://phab.mercurial-scm.org/D719
2017-09-22 08:55:56 -07:00
Durham Goode
295d56dc8d infinitepush: store received treepack parts
Makes the infinitepush server store the received treepack parts in the bundle.
Future patches will enable serving the trees from the bundle, and sending the
trees from the client.

Differential Revision: https://phab.mercurial-scm.org/D718
2017-09-22 08:55:56 -07:00
Durham Goode
70c2f9fa71 infinitepush: override processparts
Upstream Mercurial now has a function that handles the iteration over bundle
parts. As part of making infinitepush handle more part types, let's override
processparts and completely take over part processing.

Initially the part processing will just mimic the existing handlers, but there's
a config flag that causes it to simply redirect the received parts into the new
bundle. This will be useful later for storing all bundle parts (like tree packs
and obsmarkers).

Differential Revision: https://phab.mercurial-scm.org/D717
2017-09-22 08:55:56 -07:00
Durham Goode
434ef91f99 infinitepush: move bundle storing logic to its own function
Previously the logic that created a bundle from a changegroup part and put it in
the store was all in the same function. Let's split it up.

This will be useful in a later part where we stop using the default bundle2 part
handling logic and instead handle each part manually (allowing us to store other
parts in the bundle).

Differential Revision: https://phab.mercurial-scm.org/D716
2017-09-22 08:55:56 -07:00
Ryan McElroy
41d13b6d81 scm-prompt: standardize testing style and formatting
Test Plan: `rt`

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash

Differential Revision: https://phab.mercurial-scm.org/D796
2017-09-22 08:31:06 -07:00
Ryan McElroy
fb2b108d94 scm-prompt: split into hg and git specific sub-functions
Test Plan: `rt`

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D795
2017-09-22 08:31:06 -07:00
Ryan McElroy
54b4eb4a85 scm-prompt: show elipsis only if there are additional remote bookmarks
Test Plan: `rt`

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash

Differential Revision: https://phab.mercurial-scm.org/D794
2017-09-22 08:31:06 -07:00
Ryan McElroy
d2c869c6a5 scm-prompt: include .git in $git variable
Summary: Just as with the previous patch, this will reduce errors and cognitive overhead.

Test Plan: `rt`

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D793
2017-09-22 08:31:06 -07:00
Ryan McElroy
007c2161e8 scm-prompt: include .hg in $hg variable
Summary:
This has been a big source of confusion and errors when sporadically hacking on
this script that usually doubles the time it takes to add a new feature. This
is the more sane way to do it anyway.

Test Plan: `rt`

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Differential Revision: https://phab.mercurial-scm.org/D792
2017-09-22 08:31:06 -07:00
Ryan McElroy
0d434d8cbc scm-prompt: style cleanups
Test Plan: `rt`

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash

Differential Revision: https://phab.mercurial-scm.org/D791
2017-09-22 08:31:06 -07:00
Ryan McElroy
68ea4e433c scm-prompt: add locked state
Summary:
If you're working n multiple terminals on the same repository, it is
often useful to know if a command you're about to run might block due to an
already-held lock on the repository. This upgrade to scm-prompt gives the
user this information.

Test Plan: updated the test

Reviewers: #fbhgext, stash

Reviewed By: #fbhgext, stash

Subscribers: stash

Differential Revision: https://phab.mercurial-scm.org/D790
2017-09-22 08:31:06 -07:00
Durham Goode
8b7529b24d tests: update tests after blackbox fix 2017-09-21 23:32:55 -07:00
Durham Goode
0db0ff98fc lint: fix lint issue 2017-09-21 23:21:18 -07:00
Durham Goode
999e3b7af5 remotefilelog: add seen set to annotate algorithm
The remotefilelog annotate logic was not keeping track of which commits it had
seen when doing the bfs ancestor walk. For very mergy histories this resulted in
a ton of duplicate work.

Differential Revision: https://phab.mercurial-scm.org/D771
2017-09-21 21:31:52 -07:00
Durham Goode
0e25d26f20 treemanifest: don't error out if a local commit doesn't have a tree
In hybrid tree/flat mode, if a local commit accidentally got marked as public,
then we would attempt to access the server, which of course didn't have the
commit and failed. This caused an error on the client, when in reality we
should've just fallen back to the flat manifest. Let's eat the error and the
message in this case.

Differential Revision: https://phab.mercurial-scm.org/D772
2017-09-21 21:23:40 -07:00
Durham Goode
0ce07c511d treemanifest: store p1,p2 in the temporary memtrees
Previously, if during the middle a transaction something needed to access a tree
for a commit that was created during the transaction, the manifestlog could find
that tree in a side store it kept for current transaction trees. Unfortunatley
we were only storing the data, and not the parents, so if logic needed the
parents it failed with a key error. The fix is to just store the parents as
well.

This was caught by the sparse extension, which looks at the current tree during
a commit when a sparse profile changes.
2017-09-21 21:23:40 -07:00
Jun Wu
99a01a0dbd dirsync: respect rule order
With rules of nested paths, the order of rules matters.

Note: this does not make dirsync handle recursive changes. i.e. a mirror
from path1 to path2 won't trigger a rule matching path2.

Differential Revision: https://phab.mercurial-scm.org/D770
2017-09-21 15:57:11 -07:00
Jun Wu
415f5074b3 undo: do not run undolog for every command
Previously, undolog runs for every command, which sometimes adds unwanted
noticeable overhead like `hg status` with a large obsstore. This patch makes
undo smarter to only log commands that actually write things.

This is done by making undolog only run for transactions, updates (legacy
code that does not require a transaction). Tests are changed to reflect
`hg status` does not trigger undolog, and the new code seems to work better
with chg.

Differential Revision: https://phab.mercurial-scm.org/D739
2017-09-21 14:38:43 -07:00
Martijn Pieters
7225395555 Linting fixes, remove usused import and safehasattr
Differential Revision: https://phab.mercurial-scm.org/D765
2017-09-21 08:07:09 -07:00
Stanislau Hlebik
7e37af474c fbconduit: add timeout
Summary:
Just as in phabricator/conduit.py. It is necessary for D620

BTW, not sure why do we have very similar code in two places.

Test Plan: Will be tested in D620

Reviewers: #fbhgext, shivramk, mitrandir

Reviewed By: #fbhgext, mitrandir

Differential Revision: https://phab.mercurial-scm.org/D742
2017-09-21 07:01:27 -07:00
Mark Thomas
c68f10b4e6 infinitepush: improve notbackedup performance
The notbackedup revset predicate still has performance problems when the set of
not-backed-up changesets includes some that are completely disjoint from the
set of backed-up changesets.

Rather than trying to express it as a combination of other expressions,
implement the revset calculation directly.  This allows us to also stop as soon
as a public commit is encountered, which should be faster in all cases.

Test Plan:
Expand tests to cover more complex scenarios.  Test perf on a larger and older
checkout of a big repo.

Differential Revision: https://phab.mercurial-scm.org/D764
2017-09-21 06:06:20 -07:00
Mateusz Kwapich
abb9347d10 metaedit: make it compatible with histedit
Summary:
auto-rebasing stuff during metaedit doesn't really work well for histedit.
Let's specialcase it

Test Plan: see test

Reviewers: #fbhgext, ryanmce

Reviewed By: #fbhgext, ryanmce

Subscribers: ryanmce

Differential Revision: https://phab.mercurial-scm.org/D747
2017-09-21 05:33:54 -07:00
David Soria Parra
d6a9a2bcaa lfs: implement remotefilelog prefetch
When calling prefetch in remotefilelog, also prefetch lfs
files.

We are using the same hook mechanism that remotefilelog is already using
for LFS by having remotefilelog call into LFS.

Test Plan:
run tests on test-lfs-remotefilelog-prefetch.t

Differential Revision: https://phab.mercurial-scm.org/D732
2017-09-20 14:02:58 -07:00
David Soria Parra
0fc706a75f remotefilelog: remove unecessary return
Remove an unecessary return as the function has no return value
anyway and this is the last statement in the function.

Test Plan:
None

Differential Revision: https://phab.mercurial-scm.org/D729
2017-09-20 14:02:58 -07:00
Mateusz Kwapich
5c80b1b5fe [prune] advertise "hg hide"
Summary: "hg hide" is the user friendly command for hiding commits

Test Plan: ran tests

Reviewers: #fbhgext, quark

Reviewed By: #fbhgext, quark

Differential Revision: https://phab.mercurial-scm.org/D725
2017-09-20 07:55:56 -07:00
Stanislau Hlebik
8bc5444998 infinitepush: run at most one backup per hg command
Summary:
Previously we ran auto backups in txnclose hook. But commands like histedit and
rebase create many transactions, and that means that lots of backup processes
are started at the same time. That means that sometimes backup processes use
too much memory.

Instead let's start it once per command if any transaction was opened
during the command.

Test Plan:
Run unit-test.
Run histedit with autobackup enabled, and make sure just one backup process
was started.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D678
2017-09-20 07:25:52 -07:00
Durham Goode
8bb86ab225 shallowbundle: handle changegroup3
Upstream has changed local bundles to use the highest available changegroup
version, which means we're using changegroup3 for strips now. So we need to
handle that in shallowbundle.
2017-09-19 16:48:19 -07:00
Aaron Shotkin
0d2cd6bff2 p4fastimport: used retry decorator
Summary: added in references to replace the broken references to retries

Test Plan: run https://phabricator.intern.facebook.com/P58253036

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5866393

Tasks: T21960796

Tags: bootcamp

Signature: 5866393:1505861463:ec22714d52586d5c42df80fd291712d2d9dc2895
2017-09-19 15:57:33 -07:00
Aaron Shotkin
3c316aa224 p4fastimport: added retry decorator
Summary: added a new decorator that will replace the broken retries function

Test Plan: run https://phabricator.intern.facebook.com/P58253036

Reviewers: davidsp

Reviewed By: davidsp

Subscribers: medson, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D5866346

Tasks: T21960796

Tags: bootcamp

Signature: 5866346:1505861561:c633d79b6485333b4b8a6ae9201ff3b59a3a6d05
2017-09-19 15:57:33 -07:00
Durham Goode
c075197c2b shallowbundle: update addgroup usage
Upstream has changed it's api again, so we need to accomodate.
2017-09-18 19:24:49 -07:00
Durham Goode
9140192e73 tests: update with upstream orig changes 2017-09-18 19:24:49 -07:00
Durham Goode
9573391792 changegroup: update generatemanifest api
Upstream added the source keyword to the generatemanifest api. We need to add it
as well.

Differential Revision: https://phab.mercurial-scm.org/D711
2017-09-18 09:21:44 -07:00
Durham Goode
f59fb364bc changegroup: update addgroup to match upstream
Upstream has refactored the changegroup application APIs so we need to update
our usages.

Differential Revision: https://phab.mercurial-scm.org/D710
2017-09-18 09:21:44 -07:00
Mihails Smolins
cb788cc931 remotefilelog: create delay for background prefetches
Summary:
This functionality allows to add delays between background prefetches after
operations that change the working copy parent. By default background
prefetches will be run no often than every 2 minutes, but this is configurable.
This allows to reduce the load on CPU(because prefetch is followed by repack).

Test Plan:
Tested manually on fbsource repo by running hg co bookmark several
times and ensuring that only 1 background prefetch is running if 2 minute
timeout has not expired.

Reviewers: durham, simonfar, ryanmce, #fbhgext

Reviewed By: simonfar, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D712
2017-09-15 07:28:07 -07:00
Saurabh Singh
c2bf4500f9 gitlookup: reorganising the imports
Summary:
Reorganising the imports in the file gitlookup.py to comply with the
recommended way.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D702
2017-09-13 17:17:55 -07:00
Saurabh Singh
bf363c4fd9 gitlookup: using util.urlreq instead of importing urllib
Summary:
I was reorganising the imports of gitlookup.py. After reorganising, the test
test-check-code-hg.t was probably able to recognise the imports and suggested
that we should using util.urlreq instead of urllib. Therefore, I am making the
suggested change in this commit and removing the urllib dependency.

I will be reorganising the imports in a later commit.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D701
2017-09-13 17:17:55 -07:00
Saurabh Singh
5106edcb35 gitgetmeta: enable serving only missing hg-git map data
Summary:
The gitlookup extension allows for only requesting the complete file
from the server. This leads to download of large files (hg-git map file
specifically in this case) when only the missing chucks of the file would have
sufficed.

This commit makes changes to allow for downloading only the missing parts of
the map file. A config option 'onlymapdelta' has also been added to allow for
switching between the two different modes of operation: serving complete file
and serving only the missing chunks. The tests were subsequently updated to
cater to the new scenario and also, checking for interoperability of the two
modes.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Subscribers: durham

Differential Revision: https://phab.mercurial-scm.org/D695
2017-09-13 17:17:55 -07:00
Saurabh Singh
6da8dca955 gitlookup: creating description for the extension
Summary:
There is no description of the 'gitlookup' extension when 'hg help
gitlookup' in invoked. I just changed the existing code comments to form a
description.

Test Plan: Checked output of 'hg help gitlookup'

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D693
2017-09-13 17:17:55 -07:00
Saurabh Singh
3c0deb116c gitgetmeta: refactor code in gitlookup.py
Summary:
This commit just refactors some code to setup nicely for handling a
new type of bundle part. The refactoring essentially moves out the parts that
can be reused later.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D692
2017-09-13 17:17:55 -07:00
Saurabh Singh
285ded5861 gitmeta: refactor and add more test cases to test-git-getmeta.t
Summary:
test-git-getmeta.t has some basic tests to check that the git metadata
syncing  works as expected. I have added some tests for more complicated
scenarios for robust testing. Also, I did some refactoring of the test for
readability.

Test Plan: Ran all the tests.

Reviewers: #fbhgext, durham

Reviewed By: #fbhgext, durham

Differential Revision: https://phab.mercurial-scm.org/D685
2017-09-13 17:17:55 -07:00
Phil Cohen
c259f16e35 copytrace: update _filemerge signature, add wctx
I changed this in D449 to add wctx to _filemerge.

Differential Revision: https://phab.mercurial-scm.org/D700
2017-09-13 14:24:49 -07:00
Kostia Balytskyi
62e1ad3898 remotefilelog: make style-checker happy
Summary: `test-check-code-hg.t` complains about long lines here.

Test Plan: - rt, make sure it does not complain anymore

Reviewers: durham, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D697
2017-09-13 08:42:08 -07:00
Durham Goode
d476572384 remotefilelog: make backwards compatible with older changegroup api
Upstream has changed the changegroup API, and we updated to use it. Let's also
support the old API though.
2017-09-12 12:30:24 -07:00
Durham Goode
26e92d8ffe tests: update tests for upstream changes
5d45a997d11 in upstream changed rebase to use unfiltered repositories, which
changes the definition of tip in these two tests. Let's update the test output.
2017-09-12 10:10:06 -07:00
Durham Goode
b5deda8de4 changegroup: update to match upstream makechangegroup change
Upstream has refactored the changegroup creation APIs so we need to update our
usages.
2017-09-12 10:10:06 -07:00
Ryan McElroy
ca9289cb2a fbconduit: properly pass through params on local hit
Summary:
Previously, we didn't pass through additional parameters, which resulted in
errors complaining about insufficient arguments.

Test Plan: Added a new test that previously crashed

Reviewers: #fbhgext, simonfar

Reviewed By: #fbhgext, simonfar

Differential Revision: https://phab.mercurial-scm.org/D689
2017-09-12 08:04:17 -07:00
Mihails Smolins
eeb8047815 cstore: py-datapackstore build bug fix
Summary: Build failed because there were no brackets in switch statement

Test Plan: * Rebuild and ensure unit tests pass

Reviewers: simonfar, #fbhgext

Reviewed By: simonfar, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D681
2017-09-11 11:24:38 -07:00
Mihails Smolins
bbbb8e96dd cstore: uniondatapackstore support for python stores
Summary:
Now uniondatapackstore can also hold python data stores. PythonDataStore
wrapper simply passes function calls to underlying python objects and marshals
the output.

Test Plan:
* Added test case
* Tested on fbsource with treemanifest.usecunionstore=True

Reviewers: durham, simonfar, ryanmce, #fbhgext

Reviewed By: durham, simonfar, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D631
2017-09-11 09:23:10 -07:00