diff mercurial/dirstate.py @ 22896:7e9cbb9c6053

dirstate: use 'm' state in otherparent to reduce ambiguity In rebase-like operations where we abandon the second parent, we can correctly fix up the state in setparents.
author Matt Mackall <mpm@selenic.com>
date Fri, 10 Oct 2014 13:31:06 -0500
parents dfa44e25bb53
children 8fe74328f700
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Oct 10 13:05:50 2014 -0500
+++ b/mercurial/dirstate.py	Fri Oct 10 13:31:06 2014 -0500
@@ -415,7 +415,13 @@
         if self._pl[1] == nullid:
             raise util.Abort(_("setting %r to other parent "
                                "only allowed in merges") % f)
-        self._addpath(f, 'n', 0, -2, -1)
+        if f in self and self[f] == 'n':
+            # merge-like
+            self._addpath(f, 'm', 0, -2, -1)
+        else:
+            # add-like
+            self._addpath(f, 'n', 0, -2, -1)
+
         if f in self._copymap:
             del self._copymap[f]