D623: copytrace: move fast heuristic copytracing algorithm to core
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Wed Sep 13 09:55:00 EDT 2017
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.
I don't think we can just swap c1 and c2 because what we're calculating
is the copy from c1 to c2, which is directed. Instead, maybe we can simply
fall back to the "full" algorithm if base isn't in the c2 branch.
while ctx.rev() > base.rev():
...
if ctx != base:
switch to full copytracing
INLINE COMMENTS
> copies.py:634
> + changedfiles = set()
> + mdst = c1.manifest()
> + # Tell whether the base is ancestor of c2 or not
Nit: s/mdst/m1/
> copies.py:639
> + baserev = base.rev()
> + if c2rev < baserev and len(repo.revs('%s::%s' % (c2rev, baserev))) == 0:
> + baseancestor = False
- `len(smartset)` might be expensive, just evaluate it as boolean
- `repo.revs('%d::%d', c2rev, baserev)` should be safer
> copies.py:646
> + if not baseancestor:
> + c1, c2 = c2, c1
> +
I don't think we can do that, but if we could, we should swap
m1 and m2, too.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D623
To: pulkit, #hg-reviewers, yuja
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list