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

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 20, 2015, 9:20 a.m.
Message ID <139817087c45246470a1.1448011240@dev666.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11542/
State Accepted
Headers show

Comments

Siddharth Agarwal - Nov. 20, 2015, 9:20 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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.

Patch

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()),