changeset 23593:b1179dabc6de stable

context: stop setting None for modified or added nodes Instead use a magic value, so that we can identify modified or added nodes correctly when using manifest.diff(). Thanks to Martin von Zweigbergk for catching that we have to update _buildstatus as well. That part eluded my debugging for some time.
author Augie Fackler <augie@google.com>
date Fri, 12 Dec 2014 15:29:54 -0500
parents 96d335e4eacb
children 6f53629ad273
files mercurial/context.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sat Dec 13 13:33:48 2014 -0500
+++ b/mercurial/context.py	Fri Dec 12 15:29:54 2014 -0500
@@ -17,6 +17,11 @@
 
 propertycache = util.propertycache
 
+# Phony node value to stand-in for new files in some uses of
+# manifests. Manifests support 21-byte hashes for nodes which are
+# dirty in the working copy.
+_newnode = '!' * 21
+
 class basectx(object):
     """A basectx object represents the common logic for its children:
     changectx: read-only context that is already present in the repo,
@@ -128,7 +133,7 @@
                 if (fn not in deletedset and
                     ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
                      (mf1[fn] != mf2node and
-                      (mf2node or self[fn].cmp(other[fn]))))):
+                      (mf2node != _newnode or self[fn].cmp(other[fn]))))):
                     modified.append(fn)
                 elif listclean:
                     clean.append(fn)
@@ -1408,7 +1413,7 @@
         mf = self._repo['.']._manifestmatches(match, s)
         modified, added, removed = s[0:3]
         for f in modified + added:
-            mf[f] = None
+            mf[f] = _newnode
             mf.setflag(f, self.flags(f))
         for f in removed:
             if f in mf: