[PATCH 3 of 4 mergedriver] mergestate.add: store absentfilectxes as nullhex

Siddharth Agarwal sid0 at fb.com
Fri Nov 20 03:20:40 CST 2015


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1447488431 28800
#      Sat Nov 14 00:07:11 2015 -0800
# Node ID 139817087c45246470a1bea1604a10ab89f60ee9
# Parent  44f4bfc9357c6773a53ebf7aad05a21504ab12f6
# Available At http://42.netv6.net/sid0-wip/hg/
#              hg pull http://42.netv6.net/sid0-wip/hg/ -r 139817087c45
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.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -366,8 +366,11 @@ class mergestate(object):
 
         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()),


More information about the Mercurial-devel mailing list