# HG changeset patch # User Gábor Stefanik <gabor.stefa...@nng.com> # Date 1475588323 -7200 # Tue Oct 04 15:38:43 2016 +0200 # Node ID 76b744060475aa20751310e9e2eab76ab78b9cc6 # Parent 887cbdaad15d5cc1b86c7dc419a83640d467ec5a copies: make _checkcopies handle divergences in rotated DAG
diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -347,11 +347,11 @@ for f in u1u: _checkcopies(c1, f, m1, m2, ca, ca, False, limit, diverge, copy1, - fullcopy1) + fullcopy1, incomplete1, incompletediverge) for f in u2u: _checkcopies(c2, f, m2, m1, ca, ca, False, limit, diverge, copy2, - fullcopy2) + fullcopy2, incomplete2, incompletediverge) copy = dict(copy1.items() + copy2.items()) movewithdir = dict(movewithdir1.items() + movewithdir2.items()) @@ -380,9 +380,9 @@ incomplete1, incomplete2, incompletediverge = {}, {}, {} for f in bothnew: _checkcopies(c1, f, m1, m2, ca, ca, False, limit, bothdiverge, _copy, - _fullcopy) + _fullcopy, incomplete1, incompletediverge) _checkcopies(c2, f, m2, m1, ca, ca, False, limit, bothdiverge, _copy, - _fullcopy) + _fullcopy, incomplete2, incompletediverge) for of, fl in bothdiverge.items(): if len(fl) == 2 and fl[0] == fl[1]: copy[fl[0]] = of # not actually divergent, just matching renames @@ -463,7 +463,7 @@ return copy, movewithdir, diverge, renamedelete def _checkcopies(ctx, f, m1, m2, ca, tca, remoteca, limit, diverge, copy, - fullcopy): + fullcopy, incomplete, incompletediverge): """ check possible copies of f from m1 to m2 @@ -478,6 +478,8 @@ diverge = record all diverges in this dict copy = record all non-divergent copies in this dict fullcopy = record all copies in this dict + incomplete = record non-divergent partial copies here + incompletediverge = record divergent partial copies here note: limit is only an optimization, and there is no guarantee that irrelevant revisions will not be limited @@ -553,10 +555,25 @@ copy[of] = f del fullcopy[f] fullcopy[of] = f + else: # divergence w.r.t. graft CA on one side of topological CA + for sf in seen: + if sf in ma: + assert sf not in diverge + diverge[sf] = [f, of] + break return - if of in ma: - diverge.setdefault(of, []).append(f) + if of in mta: + if backwards or remoteca: + incomplete[of] = f + else: + for sf in seen: + if sf in ma: + if tca == ca: + diverge.setdefault(sf, []).append(f) + else: + incompletediverge[sf] = [of, f] + return def duplicatecopies(repo, rev, fromrev, skiprev=None): '''reproduce copies from fromrev to rev in the dirstate _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel