Submitter | Gábor Stefanik |
---|---|
Date | Oct. 4, 2016, 2:06 p.m. |
Message ID | <4a94e40ad88ff1939c3c.1475589966@waste.org> |
Download | mbox | patch |
Permalink | /patch/16847/ |
State | Superseded |
Headers | show |
Comments
Please disregard, incomplete patchset. > -------------------------------------------------------------------------- This message, including its attachments, is confidential. For more information please read NNG's email policy here: http://www.nng.com/emailpolicy/ By responding to this email you accept the email policy. -----Original Message----- > From: Mercurial-devel [mailto:mercurial-devel-bounces@mercurial-scm.org] > On Behalf Of Gábor Stefanik > Sent: Tuesday, October 4, 2016 4:06 PM > To: mercurial-devel@mercurial-scm.org > Subject: [PATCH 8 of 8] copies: make _checkcopies handle divergences in > rotated DAG (issue4028) > > # HG changeset patch > # User Gábor Stefanik <gabor.stefanik@nng.com> # Date 1475588323 -7200 > # Tue Oct 04 15:38:43 2016 +0200 > # Node ID 4a94e40ad88ff1939c3c099903560f4d17251746 > # Parent 54afc2a4b419b0f972e75e53df4336ed2a5b32b6 > copies: make _checkcopies handle divergences in rotated DAG (issue4028) > > 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
Patch
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