mergestate.add: store absentfilectxes as nullhex
authorSiddharth Agarwal <sid0@fb.com>
Sat, 14 Nov 2015 00:07:11 -0800
changeset 27049 0d61f7ec7f76
parent 27048 86290f6f6599
child 27050 df9b73d2d444
mergestate.add: store absentfilectxes as nullhex This is the most natural way to represent these files. We also need to make sure we don't try to store these files in the merge store.
mercurial/merge.py
--- a/mercurial/merge.py	Fri Nov 20 01:14:15 2015 -0800
+++ b/mercurial/merge.py	Sat Nov 14 00:07:11 2015 -0800
@@ -366,8 +366,11 @@
 
         note: also write the local version to the `.hg/merge` directory.
         """
-        hash = util.sha1(fcl.path()).hexdigest()
-        self._repo.vfs.write('merge/' + hash, fcl.data())
+        if fcl.isabsent():
+            hash = nullhex
+        else:
+            hash = util.sha1(fcl.path()).hexdigest()
+            self._repo.vfs.write('merge/' + hash, fcl.data())
         self._state[fd] = ['u', hash, fcl.path(),
                            fca.path(), hex(fca.filenode()),
                            fco.path(), hex(fco.filenode()),