[PATCH 5 of 7 V2 stable] merge: infer the "other" changeset when falling back to v1 format

pierre-yves.david at ens-lyon.org pierre-yves.david at ens-lyon.org
Thu Feb 27 17:25:21 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1393539297 28800
#      Thu Feb 27 14:14:57 2014 -0800
# Branch stable
# Node ID 45a3436571efbbf33d4d5ed0c4a31af8950ece4c
# Parent  d755e15d6e239d4273714d9194482719946732fa
merge: infer the "other" changeset when falling back to v1 format

When we have to fallback to the old version of the file, we infer the
"other" from current working directory parent. The same way it is currently done
in the resolve command. This is know to have shortcoming… but we cannot do
better from the data contained in the old file format. This is actually the
motivation to add this new file format.

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -72,10 +72,14 @@ class mergestate(object):
         v2records = self._readrecordsv2()
         allv2 = set(v2records)
         for rev in v1records:
             if rev not in allv2:
                 # v1 file is newer than v2 file, use it
+                # we have to infer the "other" changeset of the merge
+                # we cannot do better than that with v1 of the format
+                mctx = self._repo[None].parents()[-1]
+                v1records.append(('O', mctx.hex()))
                 return v1records
         else:
             return v2records
     def _readrecordsv1(self):
         records = []


More information about the Mercurial-devel mailing list