[PATCH 1 of 2] simplemerge: includes revision into merge marker of simplemerge

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Thu Sep 27 05:06:21 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1348738364 -7200
# Node ID ac1131f2927400cb0e031d6929cfa3ce07cf1a27
# Parent  d34ba4991188fdfa4f8322b9a32c4c08aaf6ff27
simplemerge: includes revision into merge marker of simplemerge

Before this changes internal:merge conflict look like::

  <<<<<<< local
  something else
  =======
  something
  >>>>>>> other

With this changes they look like::

  <<<<<<< local: 32e80765d7fe+
  something else
  =======
  something
  >>>>>>> other: 75234512624c

The extra nodeid added refer to the last revision that touched the files in this
"branch" of the merge. Such information should help to remove ambiguous about
each side of the merge. For example in rebase: `local` is destination and
`other` is rebased changesets. The only information added is the nodeid. This is
a simple a short information that allows to retrieves all the other (revid,
description, date, authors, etc).

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -207,12 +207,13 @@ def _imerge(repo, mynode, orig, fcd, fco
     r = _premerge(repo, toolconf, files)
     if r:
         a, b, c, back = files
 
         ui = repo.ui
-
-        r = simplemerge.simplemerge(ui, a, b, c, label=['local', 'other'])
+        label = ['local: %s' % fcd.changectx(),
+                 'other: %s' % fco.changectx()]
+        r = simplemerge.simplemerge(ui, a, b, c, label=label)
         return True, r
     return False, 0
 
 @internaltool('dump', True)
 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files):
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -20,14 +20,14 @@
 
   $ hg id
   32e80765d7fe+75234512624c+ tip
 
   $ cat a
-  <<<<<<< local
+  <<<<<<< local: 32e80765d7fe+
   something else
   =======
   something
-  >>>>>>> other
+  >>>>>>> other: 75234512624c
 
   $ hg status
   M a
   ? a.orig
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -1031,15 +1031,15 @@ conflict: keyword should stay outside co
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
   $ cat m
   $Id$
-  <<<<<<< local
+  <<<<<<< local: 88a80c8d172e+
   bar
   =======
   foo
-  >>>>>>> other
+  >>>>>>> other: 85d2d2d732a5
 
 resolve to local
 
   $ HGMERGE=internal:local hg resolve -a
   $ hg commit -m localresolve
diff --git a/tests/test-merge-revert2.t b/tests/test-merge-revert2.t
--- a/tests/test-merge-revert2.t
+++ b/tests/test-merge-revert2.t
@@ -55,15 +55,15 @@
   --- a/file1
   +++ b/file1
   @@ -1,3 +1,7 @@
    added file1
    another line of text
-  +<<<<<<< local
+  +<<<<<<< local: c3fa057dd86f+
   +changed file1 different
   +=======
    changed file1
-  +>>>>>>> other
+  +>>>>>>> other: dfab7f3c2efb
 
   $ hg status
   M file1
   ? file1.orig
   $ hg id
diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t
--- a/tests/test-merge-tools.t
+++ b/tests/test-merge-tools.t
@@ -64,15 +64,15 @@ running from a devel copy, not a temp in
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
   $ aftermerge
   # cat f
-  <<<<<<< local
+  <<<<<<< local: ef83787e2614+
   revision 1
   =======
   revision 2
-  >>>>>>> other
+  >>>>>>> other: 0185f4e0cf02
   space
   # hg stat
   M f
   ? f.orig
 
diff --git a/tests/test-merge7.t b/tests/test-merge7.t
--- a/tests/test-merge7.t
+++ b/tests/test-merge7.t
@@ -95,15 +95,15 @@ pull and merge from test-a again
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
 
   $ cat test.txt
   one
-  <<<<<<< local
+  <<<<<<< local: 50c3a7e29886+
   two-point-five
   =======
   two-point-one
-  >>>>>>> other
+  >>>>>>> other: 40d11a4173a8
   three
 
   $ hg debugindex test.txt
      rev    offset  length  ..... linkrev nodeid       p1           p2 (re)
        0         0       7  .....       0 01365c4cca56 000000000000 000000000000 (re)
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -256,15 +256,15 @@ merge tests
   (branch merge, don't forget to commit)
 
 should conflict
 
   $ cat t/t
-  <<<<<<< local
+  <<<<<<< local: 20a0db6fbf6c+
   conflict
   =======
   t3
-  >>>>>>> other
+  >>>>>>> other: 7af322bc1198
 
 clone
 
   $ cd ..
   $ hg clone t tc


More information about the Mercurial-devel mailing list