Commit Graph

19 Commits

Author SHA1 Message Date
Durham Goode
39d350996f checkcode: fix remotefilectx and remotefilelog
Summary: Fix failures found by check-code.

Test Plan: Ran the tests

Reviewers: #sourcecontrol, ttung

Reviewed By: ttung

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

Signature: t1:3221371:1461648217:e9702d761ab8fd6f85dee60a4c192cf25e784f11
2016-04-26 13:00:31 -07:00
Durham Goode
f774b1b204 adjustlinknode: remove unnecessary ancestor walk
Summary:
Since we added the C code ancestor walk to this function, this python ancestor
walk is completely unnecessary, and can cause significant slow downs if none of
the ancestors are known linknodes (it walks the entire history).

Test Plan: Ran the tests

Reviewers: #sourcecontrol, ttung

Differential Revision: https://phabricator.fb.com/D3136150
2016-04-04 15:30:47 -07:00
Durham Goode
a7a78cda1e More robust adjustlinknode code for None srcrev's
Summary:
The srcrev passed to adjustlinknode can sometimes be None, which causes an
exception. The code that throws the exception was introduced recently as part of
taking advantage of a C fast path.

The fix is to move the srcrev check to be after the None handling.

Test Plan:
I'm not sure how to repro this naturally actually.  I tried writing
tests that did rebases of renames, but it didn't trigger.  I manually verified
it by using the debugger to insert a None for the srcrev at the beginning of
adjustlinknode

Reviewers: lcharignon, #sourcecontrol, ttung, mitrandir

Reviewed By: mitrandir

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

Tasks: 10066192

Signature: t1:2944899:1455735567:c8eea240885847061239bf3df0ea59dbbd0e4858
2016-02-17 11:01:45 -08:00
Durham Goode
2cce4008b6 adjustlinknode: user C fastpath
Summary:
The adjustlinknode logic was pretty slow, since it did all the ancestry
traversal in python. This patch makes it first use the C fastpath to check if
the provide linknode is correct (which it usually is), before proceeding to the
slow path.

The fastpath can process about 300,000 commits per second, versus the 9,000
commits per second by the slow path.

This cuts 'hg log <file>' down from 5s to 2.5s in situations where the log spans
several hundred thousand commits.

Test Plan:
Ran the tests, and ran hg log <file> on a file with a lot of history
and verified the time gain.

Reviewers: pyd, #sourcecontrol, ttung, quark

Reviewed By: quark

Subscribers: quark

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

Signature: t1:2908532:1454718666:c4e63d73057572f035082943ef2e6fe0a49238c1
2016-02-08 14:40:07 -08:00
Durham Goode
16d12ec27c Remove limit on adjust linknode lookup
Previously we limited the changelog scan for old commits to the most recent
100,000, under the assumption that most changes would be within that time frame.
This turned out to not be a good assumption, so let's remove the limitation.
2016-01-27 15:56:36 -08:00
Durham Goode
13c2a7823f Add alternative linkrev lookup logic
Summary:
The old linkrev lookup logic depended on the repo containing the latest commit
to have contained that particular version of the file. If the latest version had
been stripped however (like what happens in rebase --abort currently), the
linkrev function would attempt to scan history from the current rev,
trying to find the linkrev node.

If the filectx was not provided with a 'current node', the linkrev function
would return None. This caused certain places to break, like the Mercurial
merge conflict resolution logic (which constructs a filectx using only a
fileid, and no changeid, for the merge ancestor).

The fix is to allow scanning all the latest commits in the repo, looking for the
appropriate linkrev. This is pretty slow (1 second for every 14,000 commits
inspected), but is better than just returning None and crashing.

Test Plan:
Manually repro'd the issue by making a commit, amending it, stripping the
amended version and going back to the original, making two sibling commits on
top of the original, then rebasing sibling 1 onto sibling 2 (so that the
original commit that had the bad linknode data was the ancestor during the
merge). Previously this failed, now it passes. I'd write a test, but it's 11pm
and I'm tired and I need this in by early tomorrow morning to make the cut.

Reviewers: #sourcecontrol, ttung, rmcelroy

Reviewed By: rmcelroy

Subscribers: trunkagent, rmcelroy

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

Signature: t1:2826850:1452680293:cb8c1f8c20ce13ad632925137dbdce6e994ab360
2016-01-13 11:25:26 -08:00
Durham Goode
9947ff9cc6 Allow file blobs to have imperfect history
Summary:
Attempting to maintain perfect history in the file blobs has become the most
complex, bug prone, and performance hurting aspect of remotefilelog. Let's just
drop this requirement and rely on upstream Mercurial's ability to fixup linkrevs
in the face of imperfect data.

The real solution for this class of problems is to make it so that the filelog
hashes are unique with respect to the commit that introduces them, but that's a
much harder problem.

Test Plan:
Ran the tests.

Made a commit with 1000 files changes.  hg commit went from 15s to 7.5s.  The difference will be even more dramatic for certain situations that have known to have caused problems in the past.

Reviewers: #sourcecontrol, pyd

Subscribers: rmcelroy, pyd

Differential Revision: https://phabricator.fb.com/D2686318
2015-12-01 23:49:48 -08:00
Aaron Kushner
fe561e382a Don't stack trace when getting children from thg and hg serve
Summary: thg and 'hg serve' stack trace when trying to view a file. The
correct fix is to walk back the changelog and look to see which was the
first one to touch the specific file. In the meantime, this makes the
graphic UIs usable.

Test Plan: ran tests

Reviewers: durham, rmcelroy

Reviewed by: rmcelroy
2015-10-25 14:05:14 +00:00
Aaron Kushner
11c9fd8e04 Remove what looks to be dead code
Summary: changectx set, but doesn't seem to be used.

Test Plan: ran tests

Reviewers: rmcelroy, durham
2015-10-25 15:32:58 +00: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
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
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
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
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
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
bdea38dd56 Move fileservice to be per repo instead of global
Previously the file service client was a global object that all repos could
share. This was a bit hacky and is no longer needed. Now the file service
client exists per repo instance.

This is part of a series of changes to abstract the local caching and remote
file service in such a way that we can plug and play implementations.
2014-02-11 14:41:56 -08:00
Durham Goode
f480c7deef Remove remotefilectx.__str__
Recent changes to Mercurial mean this is implemented by a base class.
2013-09-11 12:29:01 -07:00
Durham Goode
8e037436cb Add gc command for cleaning up the cache 2013-06-28 15:57:15 -07:00
Durham Goode
f16a3a4134 Rename to remotefilelog since shallowrepo is already taken 2013-06-21 10:14:29 -07:00