mercurial/copies.py
changeset 30208 87a7c0d403ff
parent 30204 1894c830ee74
child 30229 69ffbbe73dd0
--- a/mercurial/copies.py	Mon Oct 17 16:12:12 2016 -0700
+++ b/mercurial/copies.py	Tue Oct 18 02:09:08 2016 +0200
@@ -447,6 +447,7 @@
                       % "\n   ".join(bothnew))
     bothdiverge = {}
     bothincompletediverge = {}
+    remainder = {}
     both1 = {'copy': {},
              'fullcopy': {},
              'incomplete': {},
@@ -463,13 +464,19 @@
         _checkcopies(c1, f, m1, m2, base, tca, dirtyc1, limit, both1)
         _checkcopies(c2, f, m2, m1, base, tca, dirtyc2, limit, both2)
     if dirtyc1:
-        assert both2['incomplete'] == {}
+        # incomplete copies may only be found on the "dirty" side for bothnew
+        assert not both2['incomplete']
         remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,
                                    bothincompletediverge)
+    elif dirtyc2:
+        assert not both1['incomplete']
+        remainder = _combinecopies({}, both2['incomplete'], copy, bothdiverge,
+                                   bothincompletediverge)
     else:
-        assert both1['incomplete'] == {}
-        remainder = _combinecopies({}, both2['incomplete'], copy, bothdiverge,
-                                   bothincompletediverge)
+        # incomplete copies and divergences can't happen outside grafts
+        assert not both1['incomplete']
+        assert not both2['incomplete']
+        assert not bothincompletediverge
     for f in remainder:
         assert f not in bothdiverge
         ic = remainder[f]