[PATCH 08 of 11] copies: make _checkcopies handle divergences in rotated DAG (issue4028)
Gábor Stefanik
gabor.stefanik at nng.com
Wed Oct 5 12:01:40 UTC 2016
# HG changeset patch
# User Gábor Stefanik <gabor.stefanik at nng.com>
# Date 1475588323 -7200
# Tue Oct 04 15:38:43 2016 +0200
# Node ID 297284e495a7681f977fa486776b85beaa17d978
# Parent 189775497cc98cf105632c8f666114cdc6f1141f
copies: make _checkcopies handle divergences in rotated DAG (issue4028)
diff -r 189775497cc9 -r 297284e495a7 mercurial/copies.py
--- a/mercurial/copies.py Mon Oct 03 13:38:56 2016 +0200
+++ b/mercurial/copies.py Tue Oct 04 15:38:43 2016 +0200
@@ -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
More information about the Mercurial-devel
mailing list