Patchwork [4,of,5,STABLE] merge: add "other" file node in the merge state file

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 26, 2014, 10:58 p.m.
Message ID <2405ad3c020f8c3b5e41.1393455486@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/3777/
State Superseded
Commit 3678707e4017ef3c62cc35ab4a5f166896cd840e
Headers show

Comments

Pierre-Yves David - Feb. 26, 2014, 10:58 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1393383287 28800
#      Tue Feb 25 18:54:47 2014 -0800
# Branch stable
# Node ID 2405ad3c020f8c3b5e415922172096012b53a416
# Parent  343f7acb1a8e68f02f1dc4cf82660e8968565cf1
merge: add "other" file node in the merge state file

This data is mostly redundant with the "other" changeset node (+ other changeset
file path). However, more data never hurt.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -97,12 +97,14 @@  class mergestate(object):
                 f.write(_pack(format, key, len(data), data))
             f.close()
     def add(self, fcl, fco, fca, fd):
         hash = util.sha1(fcl.path()).hexdigest()
         self._repo.opener.write("merge/" + hash, fcl.data())
-        self._state[fd] = ['u', hash, fcl.path(), fca.path(),
-                           hex(fca.filenode()), fco.path(), fcl.flags()]
+        self._state[fd] = ['u', hash, fcl.path(),
+                           fca.path(), hex(fca.filenode()),
+                           fco.path(), hex(fco.filenode()),
+                           fcl.flags()]
         self._dirty = True
     def __contains__(self, dfile):
         return dfile in self._state
     def __getitem__(self, dfile):
         return self._state[dfile][0]
@@ -117,11 +119,12 @@  class mergestate(object):
         self._state[dfile][0] = state
         self._dirty = True
     def resolve(self, dfile, wctx, octx):
         if self[dfile] == 'r':
             return 0
-        state, hash, lfile, afile, anode, ofile, flags = self._state[dfile]
+        stateentry = self._state[dfile]
+        state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
         fcd = wctx[dfile]
         fco = octx[ofile]
         fca = self._repo.filectx(afile, fileid=anode)
         # "premerge" x flags
         flo = fco.flags()