Commit Graph

462 Commits

Author SHA1 Message Date
Durham Goode
047afeff5f hooks: remove incominghook
Summary:
The incominghook was meant to pregenerate any remotefilelog blobs that were
likely to be needed shortly. Unfortunately it actually just slows down pushes,
since in large repos the hook takes longer than the push does sometimes.

So let's just remove it.

Test Plan: Apparently there were no tests for this :p

Reviewers: sid0, lcharignon, mitrandir, ericsumner, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D2185894

Signature: t1:2185894:1435126819:e1e1125520411356eccff4baee31ab2938ebc0fe
2015-06-23 20:03:57 -07:00
Mateusz Kwapich
7800dae8f4 tests: repair test output due to upstream changes 2015-06-19 16:13:18 -07:00
Siddharth Agarwal
c45c59236b remove prefetch from the short help list
Summary: I really don't think it should be in this list.

Test Plan: `hg`

Reviewers: durham, #sourcecontrol, rmcelroy

Reviewed By: durham, #sourcecontrol, rmcelroy

Subscribers: rmcelroy

Differential Revision: https://phabricator.fb.com/D1997655

Signature: t1:1997655:1429189594:aa8f355a6fc61e300f824be6b2fbd64a42dde2b5
2015-04-16 00:38:43 -07:00
Durham Goode
93e4a455ff clone: fix streaming clones
Upstream refactored the streaming clone api, so we need to adjust accordingly.
2015-05-27 17:29:34 -07:00
Durham Goode
acea316460 Fix blob generation with adjustlinkrevs
Summary:
When adjustlinkrevs got moved to the filectx upstream, we incorrectly
moved it to the remotefilectx inside remotefilelog. We don't actually use
remotefilectx on the server, so wrapping it did nothing.

The fix is to move the wrapping to be in remotefilelogserver.py so it is
executed on the server side.

Test Plan:
Did a checkout with my shallow client pointed at a full repo with no
blob cache. Verified it went quickly (minutes, instead of hours).

Reviewers: pyd

Differential Revision: https://phabricator.fb.com/D2097851
2015-05-22 21:32:12 -07:00
Durham Goode
95e9918016 sparse: remove sparse-filtered results from copy tracing
Summary:
Since we only prefetch things that are in the sparse checkout, copy tracing
(which touches everything in the manifest diff) would do individual file
downloads for every file.  Let's just remove those files from the copy tracing
check entirely since the user probably doesn't care if they're outside the
sparse checkout.

Test Plan: Added a test

Reviewers: sid0, rmcelroy, lcharignon, pyd

Differential Revision: https://phabricator.fb.com/D2083768
2015-05-18 16:08:49 -07:00
Laurent Charignon
5652bd276a Match with with latest version of core to pass the test
Summary:
Match with with latest version of core to pass the test.
There were a couple of changes in core that broke the extension, I matched
those changes to make the test pass.

Test Plan: The tests are all passing

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D2053958
2015-05-07 12:50:51 -07:00
Durham Goode
b29a6b04dd Add match arg to computeforwardmissing wrapper
Upstream now has a matcher on _computeforwardmissing which will allow us to only
prefetch the necessary parts of a sparse checkout.

Since we're now being returned an iterator, we need to convert it to a list
since we iterate over it and return it.
2015-04-22 16:39:16 -07:00
Durham Goode
8bf6e4f004 sparse: make remotefilelog aware of sparse checkouts
Summary:
Previously remotefilelog would prefetch every file in a commit. With the sparse
checkout extension we want to only prefetch things in the sparse checkout.

This commit makes remotefilelog aware of the possible existence of a sparse
matcher.

Test Plan: Added tests

Reviewers: sid0, rmcelroy, pyd, lcharignon

Subscribers: kang

Differential Revision: https://phabricator.fb.com/D1967207
2015-04-02 09:58:46 -07:00
Ryan McElroy
5a769d1fd6 ajustlinknodes: check for node in nodemap
Summary:
Per @pyd's review of D1933267, we need to check for the linknode in cl.nodemap,
not in cl (whose __contains__ method only looks for revs and doesn't even check
for visibility... lolz).

Test Plan: ran tests

Reviewers: durham, sid0, pyd, ericsumner, lcharignon, davidsp, mitrandir

Reviewed By: mitrandir

Subscribers: akushner, daviser, pyd

Differential Revision: https://phabricator.fb.com/D1934941

Tasks: 6573011

Signature: t1:1934941:1427130649:b084635db9bfcd28c4d4a1bcf12a7500c06b323c
2015-03-23 09:55:23 -07:00
Durham Goode
25efa4b886 Fix adjust linknodes for ancestries with old nodes
Summary:
The new version of adjust linknodes wasn't accounting for the fact that some
ancestries contained nodes that no longer exist. Check for that before looking
for common ancestors.

The old version of this code survived by luck. We were catching KeyErrors as one
base case, and it just happens that LookupError from the changelog is also a
KeyError, so it was getting caught and eaten.

Test Plan:
We should probably add a test, but I have to leave shortly and this is pretty
broken, so we'll have to take a rain check.

Reviewers: rmcelroy, pyd, sid0

Differential Revision: https://phabricator.fb.com/D1933267
2015-03-20 18:39:38 -07:00
Ryan McElroy
1184ee707c Fix stack overflow when dealing with long file histories
Summary:
The new fixmappinglinknodes function was using recursion to traverse the file
history, but this would break for files with history that was extremely long
(stack overflow). Switch to using a manual stack approach.

Test Plan: Ran the tests (I'd added a test to cover this logic before).

Reviewers: sid0, davidsp, mitrandir, lcharignon, pyd, rmcelroy

Reviewed By: rmcelroy

Subscribers: michaelbarton

Differential Revision: https://phabricator.fb.com/D1931944

Signature: t1:1931944:1426884986:3a0ef144fb55b8c0533e5c5de90699a1823b891f
2015-03-20 14:04:40 -07:00
Siddharth Agarwal
604cebd541 make patch.trydiff wrapper more generic
Summary: I'm going to add a new parameter upstream. Make this more generic so that we don't have to try and support both the old and the new versions.

Test Plan: Ran tests with both old and new hg.

Reviewers: davidsp, rmcelroy, akushner, pyd, daviser, mitrandir, ericsumner, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1920172

Signature: t1:1920172:1426615175:d90bda3b3cc30f6e5f3149af82ae9e43dee39455
2015-03-17 10:56:59 -07:00
Durham Goode
c599c6ae79 Extra changes related to the previous commit 2015-03-12 15:58:46 -07:00
Durham Goode
1d96446f97 push: fix pushing multiple manifests with the same file node
Summary:
Previously remotefilelog did not produce all the necessary local data blobs
when doing a peer push/pull if the incoming changegroup had two manifests
that referred to the same file revision.  We would only create a file blob
containing the history for the first occurrence, then if the user tried to
access the file history for other occurrences they got an exception.

The fix is to add linkrev fixup logic, similar to the adjustlinkrev() method
from core Mercurial's filectx. Now, if no valid local file blob can be found, we
will compute a valid history by reading the changelog.

We might be able to write this data to disk in the future as well to prevent
having to repeatedly compute this.

Test Plan: Added a test

Reviewers: sid0, rmcelroy, pyd, mitrandir, lcharignon

Differential Revision: https://phabricator.fb.com/D1904453
2015-03-10 20:02:14 -07:00
Durham Goode
8bc01a01bc prefetching: fix computenonoverlap wrapper
The computenonoverlap function has changed upstream. Update ourselves to match
it.
2015-03-10 19:59:43 -07:00
Siddharth Agarwal
43e26aff3b shallowrepo: prefetch files before a commitctx
Summary:
For hg-git conversions we're going to cause commits without actually updating to the base. Currently, this will cause lots of individual fetches.

The test demonstrates the issue -- wihtout this patch it'll fetch the 2 files over 2 fetches, but with it it'll fetch the files over 1 fetch.

Test Plan: Ran the tests.

Reviewers: davidsp, rmcelroy, akushner, pyd, daviser, mitrandir, ericsumner, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1893721

Tasks: 6390769

Signature: t1:1893721:1425624679:5651f71d5023919e9321646275b681b573847c44
2015-03-05 16:06:12 -08:00
Durham Goode
8203e771e3 Fix store/data permissions to have g+w
Previously we only set the umask for shared caches. Let's set it for
.hg/store/data as well so shallow repos can be used for shared repositories.
2015-02-25 17:13:49 -08:00
Durham Goode
74c8469821 Update copy wrapping to use new upstream functions
Upstream has refactored the copy logic to compute the file lists in separate
functions, so we no longer need to compute the file lists ourselves.

Update the README's Mercurial min-version since this change depends on new APIs
inside Mercurial.
2015-01-27 19:20:47 -08:00
Durham Goode
f84dcdee5d Move _adjustlinkrev onto remotefilectx
Summary:
Upstream has moved _adjustlinkrev from being a global function to one
on the filectx. Let's do the same.

Test Plan: Ran the tests

Reviewers: mitrandir

Differential Revision: https://phabricator.fb.com/D1825043
2015-02-03 18:59:00 -08:00
Eric Sumner
0da5725c2a remotefilelog: fix tests
Summary:
Copy updated ##run-tests.py## from hg-crew and fix backup bundle
names in tests

Test Plan: ##run-tests.py##

Reviewers: sid0, daviser, davidsp, mitrandir, akushner, rmcelroy, pyd, mpm, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1813206

Signature: t1:1813206:1422567577:d1a18838a0a735e25e7d89c21af1d1f3303b6ba4
2015-01-29 13:35:35 -08:00
Durham Goode
07359d1038 Change server blob creation to not use adjustlinkrev
Summary:
adjustlinkrev makes ancestor reading orders of magnitude slower,
so we need to avoid using it. Since adjustlinkrev already returns the linkrev in
certain cases, let's just force it to always return that during file blob
creation.

Test Plan:
Generated a few thousand blobs for www and fbcode using the old and new
methods and verified that they were byte-for-byte identical.

Reviewers: sid0, pyd, mpm, rmcelroy

Differential Revision: https://phabricator.fb.com/D1782400
2015-01-14 13:14:35 -08:00
Durham Goode
d56fa342f0 Improve error message when fallback server isn't configured
Summary:
If the remotefilelog server was not specified in the hgrc, or if the project
hgrc wasn't trusted, it would throw an obtuse error about a NoneType string.
This fixes it to give a more informative error explaining the problem.

Test Plan: Added a test

Reviewers: sid0, pyd, mitrandir, ericsumner, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D1774743

Signature: t1:1774743:1420830544:5122a8e11f668ee8c35996e0f4395883a31ce8b0
2015-01-09 09:43:14 -08:00
Durham Goode
4d92ad3ed7 Add optional cache validation
Summary:
There are reports of the local cache becoming invalid when stored on disk. This
adds an option that will do some basic validation and remediation for those
entries, and log some data to disk.

This is optional, since it incurs some performance overhead. We just want to use
it long enough to track down the issue.

Test Plan: Added a test

Reviewers: sid0, pyd, ericsumner, rmcelroy, mitrandir

Reviewed By: mitrandir

Differential Revision: https://phabricator.fb.com/D1774724

Signature: t1:1774724:1420827432:06ace9d1dc078f469e0f61ebd7f604fc3b606f6d
2015-01-08 18:59:04 -08:00
Durham Goode
5f69d8dd0b Improve error message for corrupt cache files
Summary:
We've gotten reports of corrupt cache files, and the error message is pretty
obtuse (ValueError for converting a string to an int). This refactors the size
check into a function and provides a better error message.

Test Plan: Added a test

Reviewers: sid0, pyd, mitrandir, ericsumner, rmcelroy

Reviewed By: rmcelroy

Differential Revision: https://phabricator.fb.com/D1774721

Signature: t1:1774721:1420830671:afd54dde8fdc00e08ed1c6cb73bf9fdc7fac2327
2015-01-09 09:11:06 -08:00
Durham Goode
c2f3ae882b Update blame test to cover more cases
There's a slight different in core Mercurial between a blame where the file was
modified in the current commit, versus a file that was modified in an older
commit. This difference affects remotefilelog (since it uses linkrevs to look
back for the first commit), so fix the test to cover this scenario.
2015-01-09 12:24:21 -08:00
Durham Goode
f0548ee974 Update remotefilectx.filectx to match upstream
Upstream has changed the filectx function slightly, so we need to match it.
2015-01-09 11:56:42 -08:00
Siddharth Agarwal
8b622893dc [shallowbundle] don't drop units and reorder on the floor
Summary: We were forgetting to pass these arguments on to the child function.

Test Plan: Visual inspection.

Reviewers: durham, davidsp, rmcelroy, akushner, pyd, daviser, mitrandir, ericsumner

Reviewed By: ericsumner

Differential Revision: https://phabricator.fb.com/D1773782

Signature: t1:1773782:1420765574:d73be08ab25265e4769d8bf70671f2ea1c13f8dd
2015-01-08 17:02:37 -08:00
Durham Goode
6687d78fc7 Add introrev to remotefilectx
Mercurial upstream does some fancy stuff inside introrev now to provide the
correct introrev. It relies on having the filelog though, so we need to avoid
it. Remotefilelog has perfect history knowledge, so we can just return the
correct linkrev.
2015-01-06 09:28:16 -08:00
Siddharth Agarwal
c81578068e tests: fix for Mercurial 3.3+ 2014-12-29 11:20:43 -08:00
Durham Goode
d985df868c Atomically write local cache files
Summary:
We're seeing some weird cache corruption errors when writing the cache to disk.
My best bet is there's multiple writes colliding and causing bad data, so let's
do atomic renames.

Test Plan: Ran the test suite

Reviewers: sid0, pyd, davidsp, rmcelroy

Reviewed By: rmcelroy

Subscribers: ericsumner, mitrandir

Differential Revision: https://phabricator.fb.com/D1747190

Signature: t1:1747190:1418865586:0a07e5243dfe9c1d5ea24f81874910d1080f24e2
2014-12-17 16:36:40 -08:00
Durham Goode
666cfa56b5 Update run-tests.py 2014-12-17 16:39:39 -08:00
Pierre-Yves David
ee7bdd47d8 remotefilelog: "implement" rawsize too
It is part of the revlog API and some extension like tortoisehg rely on it. The
default implementation is the same as size so we can safely mimic this here.
2014-11-29 05:20:28 -08:00
Durham Goode
97d36d285b Fix rebase with changeset evolution
A recent fix to make ancestor maps work with changeset evolution actually caused
a pretty serious regression. The ancestormap validation code was returning
ancestormaps with hidden ancestors if the first commit in the history was a
hidden node. This resulted in lots of invalid ancestories being returned.

Instead we only want to allow hidden ancestors in the map if the relativeto
commit has been explicitly set to a hidden node.
2014-11-24 22:42:34 -08:00
Durham Goode
6073af5196 Update tests due to upstream changes
a989a083752e in upstream mercurial changed which deltas get chosen for revlogs,
which affects the size of the data being transfered. So we just update the test
accordingly.
2014-11-24 21:34:40 -08:00
Siddharth Agarwal
d731468f70 [bundle2] insert ourselves into the cg1packer class hierarchy and fix up the packermap
Summary: Last bits needed to get remotefilelog over bundle2 working. Includes tests.

Test Plan: Ran tests, including with `--extra-config-opt experimental.bundle2-exp=True`

Reviewers: davidsp, akushner, pyd, rmcelroy, daviser, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1671738

Tasks: 5568731

Signature: t1:1671738:1415676482:b9e7a1f308919526b0c41fee54d89da876518ec7
2014-11-07 18:35:52 -08:00
Siddharth Agarwal
ca3f7a704e [bundle2] rename shallowbundle to shallowcg1packer
Summary: Preparation for bundle2 support

Test Plan: Ran tests

Reviewers: pyd, akushner, davidsp, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1668145

Tasks: 5568731

Signature: t1:1668145:1415643197:05ea239c2eb713f82bed6ad67bcd02fad7073a1f
2014-11-07 15:39:20 -08:00
Siddharth Agarwal
74584bb934 [bundle2] support arbitrary kwargs in getlocalbundle
Summary: bundle2 adds arbitrary kwargs like `listkeys`.

Test Plan: Got further in a remotefilelog pull with bundle2.

Reviewers: pyd, davidsp, akushner, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1668121

Tasks: 5568731

Signature: t1:1668121:1415643137:8f85d1c32ffc00f3c7d8bf3c3179626268814a17
2014-11-07 18:31:48 -08:00
Siddharth Agarwal
dfac9098fe [tests] fix up for Mercurial 3.2
Summary:
- fixes for pulls after uncompressed clones
- add a glob where there should be one

Test Plan: Ran the tests with Mercurial @

Reviewers: davidsp, akushner, rmcelroy, pyd, daviser, durham

Reviewed By: durham

Differential Revision: https://phabricator.fb.com/D1668739

Signature: t1:1668739:1415643384:567a0841ef4367ee2f905f6fe5517d229d5eadcf
2014-11-07 18:17:39 -08:00
Durham Goode
3889ee7b5d Fix relative ancestor traversals for hg blame
Certain filectx constructions used the rev number of the self._changeid.  We
need to convert that to a node before using it. This was breaking blame.  I've
now added a blame test too.
2014-10-23 17:16:07 -07:00
Durham Goode
dc5a3bf415 Allow pulling from shallow bundlerepos
Bundlerepos work by providing a fake revlog layer above an existing revlog.
Since remotefilelog doesn't use revlogs for filelogs, bundlerepo's did not work.
This commit fixes it such that you can now hg pull from a bundle, as long as
that bundle is shallow (i.e. contains no file contents). This will work for the
common use case of trying to recover data from .hg/strip-backups.

For reference, shallow bundles don't contain any file data because we never
delete any file data from .hg/store/data when using remotefilelog.  Even after
the commits have been stripped.
2014-10-23 00:01:21 -07:00
Durham Goode
f9730cd521 Fix dirstate wrapping to match upstream
Upstream Mercurial commit f447144c8ada changed the dirstate.status output. This
updates remotefilelog to match that new output.
2014-10-22 12:36:53 -07:00
Durham Goode
37798a0827 Fix pull wrapping to match upstream
Upstream Mercurial has moved localrepo.pull into exchange.pull. This moves our
wrapping of that command out of shallowrepo and into __init__. Exchange is
becoming an increasingly important class, so we may want to think about moving
all exchange wrapper logic out to a separate module in remotefilelog.
2014-10-14 15:50:04 -07:00
Durham Goode
65503211ed Fix revset indexing bug and update test output
repo.revs() no longer returns an object that can be indexed, so we can't use []
on it anymore. So let's use list() on it first.

The bookmark output from upstream Mercurial has also changed, so we need to
update the tests.
2014-10-14 15:30:38 -07:00
Durham Goode
3ecee80a81 Allow ancestormap to contain hidden commits (sometimes)
Summary:
When doing 'hg unshelve foo.txt' with Changeset Evolution enabled, uncommit will
first prune the commit, then try to read the filelog history to determine if any
renames need to be undone. Since the commit is now pruned, remotefilelog fails
to find any valid histories.

This fixes it two allow hidden histories if the filectx commit is hidden. It
also tweaks remotefilectx to produce commit-relative histories when possible,
which will result in more accurate histories.

Test Plan:
Ran hg uncommit in the evolve repo that had problems before. Verified
it now worked.

Reviewers: pyd, sid0

Differential Revision: https://phabricator.fb.com/D1587306
2014-09-30 14:40:09 -07:00
Durham Goode
8a5a5330c1 Fix pullprefetch for recently landed commits
Summary:
Pull-prefetch would not download file versions from the server if the file
version already existed in the local cache or the local store data.
Unfortunately, if someone landed their commit, then later stripped their local
version, the local store data file version might become invalid and no local
cache version would exist. Meaning things like 'commit' might fail when offline.

This changes prefetch to always fetch from the server when dealing with files it
knows are from revs on the server.

Test Plan:
Added a test that makes local commits that already exist on the
server, and verifies that a pull-prefetch fetches the server file version,
despite that same version existing locally.

Reviewers: sid0, pyd, davidsp

Subscribers: orip

Differential Revision: https://phabricator.fb.com/D1607260
2014-10-09 15:20:54 -07:00
Pierre-Yves David
548b8af8b5 client: add a second argument to ResponseError
Summary:
The ResponseError exception expect a second argument. Otherwise the code
handling it crashes.

Test Plan: The handling of the response error stop crashing.

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D1581574
2014-09-11 20:30:16 +02:00
Pierre-Yves David
c72eed0894 clone: have a more robust finally clause
Summary:
If the orig function crash before the fileservice is installed, the finally
clause explode, shadowing the original error. We fixes thats.

Test Plan:
  crash stopped being shadowed but crash in the finally clause.

Reviewers: durham

Differential Revision: https://phabricator.fb.com/D1581562
2014-09-11 20:08:42 +02:00
Siddharth Agarwal
5faaeedd84 [remotefilelog] fix packmeta call
Summary: API change

Test Plan: @durham ran an amend.

Reviewers: durham

Reviewed By: durham

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D1569510
2014-09-22 11:38:04 -07:00
Durham Goode
c7f1c0b383 Fix committing merges
Summary:
Upstream Mercurial changed the way merging works and added
revlog.commonancestorsheads. This changes remotefilelog to implement the same
API.

Previously we were able to use ancestors.genericancestors to do the graph
traversal. Upstream Mercurial has deleted that function though (since it is now
unused), so remotefilelog must now build a temporary rev graph in order to use
the ancestors.* apis.

Test Plan: Added a test. It failed without the fix, it passes with the fix.

Reviewers: sid0, davidsp, pyd

Differential Revision: https://phabricator.fb.com/D1566787
2014-09-19 12:21:30 -07:00