Patchwork [1,of,5,V2] merge: add conflict marker formatter

login
register
mail settings
Submitter Durham Goode
Date May 10, 2014, 2:48 a.m.
Message ID <b2bd6cb822bae0e27593.1399690088@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/4699/
State Accepted
Headers show

Comments

Durham Goode - May 10, 2014, 2:48 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1399593022 25200
#      Thu May 08 16:50:22 2014 -0700
# Node ID b2bd6cb822bae0e27593103aa63cc2bb46b48532
# Parent  bcddddcf0b540b1d98f0dc1f1a1bef9337e2e567
merge: add conflict marker formatter

Adds a conflict marker formatter that can produce custom conflict marker
descriptions. It can be set via merge.conflictmarkertemplate.

The default format is similar to:

  {shortest(node)} {tag} {branch} {bookmarks} {author} - "{desc|firstline}"

And renders as:

  contextblahblah
  <<<<<<< local: 50c3  durham - "Merge 1"
  line from my changes
  =======
  line from the other changes
  >>>>>>> other: 40d1  durham - "two -> two-point-one"
  morecontextblahblah
Matt Mackall - May 12, 2014, 2:28 p.m.
On Fri, 2014-05-09 at 19:48 -0700, Durham Goode wrote:
> diff --git a/mercurial/templates/raw/conflictmarker.tmpl b/mercurial/templates/raw/conflictmarker.tmpl
> new file mode 100644
> --- /dev/null
> +++ b/mercurial/templates/raw/conflictmarker.tmpl
> @@ -0,0 +1,1 @@
> +{shortest(node)}{ifeq(tags, "tip", " ", " {tags}")}{if(bookmarks, " {bookmarks}")}{ifeq(branch, "default", "", " {branch}")} {author|user} - "{desc|firstline}"
> \ No newline at end of file

Sticking this in the web templates is a bit unfortunate. I'd frankly
prefer to have this live only in the code until we figure out a way to
expose it more generically.

I'm also a little concerned about using all the bells and whistles by
default. No one outside of Facebook has seen shortest(node) come out of
any Mercurial command yet, for instance, and people just getting started
are liable to be confused by the tiny hex string that results. I think
something that shows commit/branch?/bookmark?/author is sufficient.

Lastly, there's no apparent way to switch back to completely stock
behavior because empty strings everywhere will still give "<<<<<< local:
". Hopefully no one has tools that are picky about these markers.

> diff --git a/mercurial/templates/raw/map b/mercurial/templates/raw/map
> --- a/mercurial/templates/raw/map
> +++ b/mercurial/templates/raw/map
> @@ -8,6 +8,7 @@
>  header = ''
>  footer = ''
>  changeset = changeset.tmpl
> +conflictmarker = conflictmarker.tmpl
>  difflineplus = '{line}'
>  difflineminus = '{line}'
>  difflineat = '{line}'
> diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
> --- a/tests/test-commit-amend.t
> +++ b/tests/test-commit-amend.t
> @@ -589,7 +589,7 @@
>    no more unresolved files
>    $ hg ci -m 'merge bar'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   23:d51446492733
> +  changeset:   23:a0697e6a1df3
>    tag:         tip
>    parent:      22:30d96aeaf27b
>    parent:      21:1aa437659d19
> @@ -604,11 +604,11 @@
>    --- a/cc
>    +++ b/cc
>    @@ -1,1 +1,5 @@
> -  +<<<<<<< local
> +  +<<<<<<< local: 30d9  test - "aa"
>     dd
>    +=======
>    +cc
> -  +>>>>>>> other
> +  +>>>>>>> other: 1aa4  bar test - "aazzcc"
>    diff --git a/z b/zz
>    rename from z
>    rename to zz
> @@ -621,7 +621,7 @@
>    cc not renamed
>    $ hg ci --amend -m 'merge bar (amend message)'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   24:59de3dce7a79
> +  changeset:   24:77e48bc7cd1a
>    tag:         tip
>    parent:      22:30d96aeaf27b
>    parent:      21:1aa437659d19
> @@ -636,11 +636,11 @@
>    --- a/cc
>    +++ b/cc
>    @@ -1,1 +1,5 @@
> -  +<<<<<<< local
> +  +<<<<<<< local: 30d9  test - "aa"
>     dd
>    +=======
>    +cc
> -  +>>>>>>> other
> +  +>>>>>>> other: 1aa4  bar test - "aazzcc"
>    diff --git a/z b/zz
>    rename from z
>    rename to zz
> @@ -654,7 +654,7 @@
>    $ hg mv zz z
>    $ hg ci --amend -m 'merge bar (undo rename)'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   26:7fb89c461f81
> +  changeset:   26:7716e5d17e50
>    tag:         tip
>    parent:      22:30d96aeaf27b
>    parent:      21:1aa437659d19
> @@ -669,11 +669,11 @@
>    --- a/cc
>    +++ b/cc
>    @@ -1,1 +1,5 @@
> -  +<<<<<<< local
> +  +<<<<<<< local: 30d9  test - "aa"
>     dd
>    +=======
>    +cc
> -  +>>>>>>> other
> +  +>>>>>>> other: 1aa4  bar test - "aazzcc"
>    
>    $ hg debugrename z
>    z not renamed
> @@ -690,9 +690,9 @@
>    $ echo aa >> aaa
>    $ hg ci -m 'merge bar again'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   28:982d7a34ffee
> +  changeset:   28:cc6af7f06777
>    tag:         tip
> -  parent:      26:7fb89c461f81
> +  parent:      26:7716e5d17e50
>    parent:      27:4c94d5bc65f5
>    user:        test
>    date:        Thu Jan 01 00:00:00 1970 +0000
> @@ -725,9 +725,9 @@
>    $ hg mv aaa aa
>    $ hg ci --amend -m 'merge bar again (undo rename)'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   30:522688c0e71b
> +  changeset:   30:e161acc118ba
>    tag:         tip
> -  parent:      26:7fb89c461f81
> +  parent:      26:7716e5d17e50
>    parent:      27:4c94d5bc65f5
>    user:        test
>    date:        Thu Jan 01 00:00:00 1970 +0000
> @@ -765,9 +765,9 @@
>    use (c)hanged version or (d)elete? c
>    $ hg ci -m 'merge bar (with conflicts)'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   33:5f9904c491b8
> +  changeset:   33:6e6ca29334c1
>    tag:         tip
> -  parent:      32:01780b896f58
> +  parent:      32:774d2712d079
>    parent:      31:67db8847a540
>    user:        test
>    date:        Thu Jan 01 00:00:00 1970 +0000
> @@ -777,9 +777,9 @@
>    $ hg rm aa
>    $ hg ci --amend -m 'merge bar (with conflicts, amended)'
>    $ hg log --config diff.git=1 -pr .
> -  changeset:   35:6ce0c89781a3
> +  changeset:   35:d05a594c39d2
>    tag:         tip
> -  parent:      32:01780b896f58
> +  parent:      32:774d2712d079
>    parent:      31:67db8847a540
>    user:        test
>    date:        Thu Jan 01 00:00:00 1970 +0000
> diff --git a/tests/test-conflict.t b/tests/test-conflict.t
> --- a/tests/test-conflict.t
> +++ b/tests/test-conflict.t
> @@ -10,7 +10,7 @@
>    $ hg commit -m branch2
>    created new head
>  
> -  $ hg merge 1
> +  $ hg merge 1 --traceback
>    merging a
>    warning: conflicts during merge.
>    merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
> @@ -22,11 +22,11 @@
>    32e80765d7fe+75234512624c+ tip
>  
>    $ cat a
> -  <<<<<<< local
> +  <<<<<<< local: 32e8  test - "branch2"
>    something else
>    =======
>    something
> -  >>>>>>> other
> +  >>>>>>> other: 7523  test - "branch1"
>  
>    $ hg status
>    M a
> diff --git a/tests/test-keyword.t b/tests/test-keyword.t
> --- a/tests/test-keyword.t
> +++ b/tests/test-keyword.t
> @@ -1049,11 +1049,11 @@
>    [1]
>    $ cat m
>    $Id$
> -  <<<<<<< local
> +  <<<<<<< local: 88a8  test - "8bar"
>    bar
>    =======
>    foo
> -  >>>>>>> other
> +  >>>>>>> other: 85d2  test - "simplemerge"
>  
>  resolve to local
>  
> 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
> @@ -57,11 +57,11 @@
>    @@ -1,3 +1,7 @@
>     added file1
>     another line of text
> -  +<<<<<<< local
> +  +<<<<<<< local: c3fa  test - "added file1 and file2"
>    +changed file1 different
>    +=======
>     changed file1
> -  +>>>>>>> other
> +  +>>>>>>> other: dfab  test - "changed file1"
>  
>    $ hg status
>    M file1
> 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
> @@ -66,11 +66,11 @@
>    [1]
>    $ aftermerge
>    # cat f
> -  <<<<<<< local
> +  <<<<<<< local: ef83  test - "revision 1"
>    revision 1
>    =======
>    revision 2
> -  >>>>>>> other
> +  >>>>>>> other: 0185  test - "revision 2"
>    space
>    # hg stat
>    M f
> diff --git a/tests/test-merge-types.t b/tests/test-merge-types.t
> --- a/tests/test-merge-types.t
> +++ b/tests/test-merge-types.t
> @@ -290,18 +290,18 @@
>    U h
>    $ tellmeabout a
>    a is a plain file with content:
> -  <<<<<<< local
> +  <<<<<<< local: 0139  test - "2"
>    2
>    =======
>    1
> -  >>>>>>> other
> +  >>>>>>> other: 97e2  test - "1"
>    $ tellmeabout b
>    b is a plain file with content:
> -  <<<<<<< local
> +  <<<<<<< local: 0139  test - "2"
>    2
>    =======
>    1
> -  >>>>>>> other
> +  >>>>>>> other: 97e2  test - "1"
>    $ tellmeabout c
>    c is a plain file with content:
>    x
> @@ -345,18 +345,18 @@
>    [1]
>    $ tellmeabout a
>    a is a plain file with content:
> -  <<<<<<< local
> +  <<<<<<< local: 97e2  test - "1"
>    1
>    =======
>    2
> -  >>>>>>> other
> +  >>>>>>> other: 0139  test - "2"
>    $ tellmeabout b
>    b is an executable file with content:
> -  <<<<<<< local
> +  <<<<<<< local: 97e2  test - "1"
>    1
>    =======
>    2
> -  >>>>>>> other
> +  >>>>>>> other: 0139  test - "2"
>    $ tellmeabout c
>    c is an executable file with content:
>    x
> diff --git a/tests/test-merge7.t b/tests/test-merge7.t
> --- a/tests/test-merge7.t
> +++ b/tests/test-merge7.t
> @@ -98,11 +98,11 @@
>  
>    $ cat test.txt
>    one
> -  <<<<<<< local
> +  <<<<<<< local: 50c3  test - "Merge 1"
>    two-point-five
>    =======
>    two-point-one
> -  >>>>>>> other
> +  >>>>>>> other: 40d1  test - "two -> two-point-one"
>    three
>  
>    $ hg debugindex test.txt
> diff --git a/tests/test-shelve.t b/tests/test-shelve.t
> --- a/tests/test-shelve.t
> +++ b/tests/test-shelve.t
> @@ -210,11 +210,11 @@
>    +++ b/a/a
>    @@ -1,2 +1,6 @@
>     a
> -  +<<<<<<< local
> +  +<<<<<<< local: *  shelve - "pending changes temporary commit" (glob)
>     c
>    +=======
>    +a
> -  +>>>>>>> other
> +  +>>>>>>> other: *  shelve - "changes to '[mq]: second.patch'" (glob)
>    diff --git a/b.rename/b b/b.rename/b
>    new file mode 100644
>    --- /dev/null
> @@ -604,11 +604,11 @@
>    M f
>    ? f.orig
>    $ cat f
> -  <<<<<<< local
> +  <<<<<<< local: 5f6b  shelve - "pending changes temporary commit"
>    g
>    =======
>    f
> -  >>>>>>> other
> +  >>>>>>> other: 23b2  shelve - "changes to 'commit stuff'"
>    $ cat f.orig
>    g
>    $ hg unshelve --abort
> @@ -647,11 +647,11 @@
>    M f
>    ? f.orig
>    $ cat f
> -  <<<<<<< local
> +  <<<<<<< local: 6b56  test - "intermediate other change"
>    g
>    =======
>    f
> -  >>>>>>> other
> +  >>>>>>> other: 23b2  shelve - "changes to 'commit stuff'"
>    $ cat f.orig
>    g
>    $ hg unshelve --abort
> diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
> --- a/tests/test-subrepo.t
> +++ b/tests/test-subrepo.t
> @@ -298,11 +298,11 @@
>  should conflict
>  
>    $ cat t/t
> -  <<<<<<< local
> +  <<<<<<< local: 20a0  test - "10"
>    conflict
>    =======
>    t3
> -  >>>>>>> other
> +  >>>>>>> other: 7af3  test - "7"
>  
>  clone
>  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Durham Goode - May 13, 2014, 1:30 a.m.
On 5/12/14, 7:28 AM, "Matt Mackall" <mpm@selenic.com> wrote:

>On Fri, 2014-05-09 at 19:48 -0700, Durham Goode wrote:
>> diff --git a/mercurial/templates/raw/conflictmarker.tmpl
>>b/mercurial/templates/raw/conflictmarker.tmpl
>> new file mode 100644
>> --- /dev/null
>> +++ b/mercurial/templates/raw/conflictmarker.tmpl
>> @@ -0,0 +1,1 @@
>> +{shortest(node)}{ifeq(tags, "tip", " ", " {tags}")}{if(bookmarks, "
>>{bookmarks}")}{ifeq(branch, "default", "", " {branch}")} {author|user} -
>>"{desc|firstline}"
>> \ No newline at end of file
>
>Sticking this in the web templates is a bit unfortunate. I'd frankly
>prefer to have this live only in the code until we figure out a way to
>expose it more generically.

V3 moves this in to code.

>
>I'm also a little concerned about using all the bells and whistles by
>default. No one outside of Facebook has seen shortest(node) come out of
>any Mercurial command yet, for instance, and people just getting started
>are liable to be confused by the tiny hex string that results. I think
>something that shows commit/branch?/bookmark?/author is sufficient.

V3 gets rid of shortest and redoes the template a little.  I still have
the truncated first line of the commit message in there, since I think
it¹s important.

>
>Lastly, there's no apparent way to switch back to completely stock
>behavior because empty strings everywhere will still give "<<<<<< local:
>". Hopefully no one has tools that are picky about these markers.

V3 adds a merge.oldconflictmarkers=True option for doing this.

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -7,7 +7,7 @@ 
 
 from node import short
 from i18n import _
-import util, simplemerge, match, error
+import util, simplemerge, match, error, templater, templatekw
 import os, tempfile, re, filecmp
 
 def _toolstr(ui, tool, part, default=""):
@@ -269,6 +269,49 @@ 
         return True, r
     return False, 0
 
+def _formatlabels(repo, fcd, fco, labels):
+    """Formats the given labels using the conflict marker template.
+
+    Returns a list of formatted labels.
+    """
+    cd = fcd.changectx()
+    co = fco.changectx()
+
+    ui = repo.ui
+    tmpl = ui.config('merge', 'conflictmarkertemplate', None)
+    if tmpl:
+        tmpl = templater.parsestring(tmpl, quoted=False)
+        t = templater.templater(None, cache={ 'conflictmarker' : tmpl })
+    else:
+        tmplpath = templater.templatepath('raw/map')
+        t = templater.templater(tmplpath)
+
+    pad = max(len(labels[0]), len(labels[1]))
+    def getmarker(label, ctx):
+        if ctx.node() is None:
+            ctx = ctx.p1()
+
+        props = templatekw.keywords.copy()
+        props['templ'] = t
+        props['ctx'] = ctx
+        props['repo'] = repo
+        templateresult = t('conflictmarker', **props)
+
+        label = ('%s:' % label).ljust(pad + 1)
+        mark = '%s %s' % (label, templater.stringify(templateresult))
+
+        # The <<< marks add 8 to the length, and '...' adds three, so max
+        # length of the actual marker is 69.
+        maxlength = 80 - 8 - 3
+        if len(mark) > maxlength:
+            mark = mark[:maxlength] + '...'
+        return mark
+
+    return [
+        getmarker(labels[0], cd),
+        getmarker(labels[1], co),
+    ]
+
 def filemerge(repo, mynode, orig, fcd, fco, fca):
     """perform a 3-way merge in the working directory
 
@@ -327,8 +370,9 @@ 
     ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
 
     labels = ['local', 'other']
+    formattedlabels = _formatlabels(repo, fcd, fco, labels)
     needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
-                        (a, b, c, back), labels=labels)
+                        (a, b, c, back), labels=formattedlabels)
     if not needcheck:
         if r:
             if onfailure:
diff --git a/mercurial/templates/raw/conflictmarker.tmpl b/mercurial/templates/raw/conflictmarker.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/raw/conflictmarker.tmpl
@@ -0,0 +1,1 @@ 
+{shortest(node)}{ifeq(tags, "tip", " ", " {tags}")}{if(bookmarks, " {bookmarks}")}{ifeq(branch, "default", "", " {branch}")} {author|user} - "{desc|firstline}"
\ No newline at end of file
diff --git a/mercurial/templates/raw/map b/mercurial/templates/raw/map
--- a/mercurial/templates/raw/map
+++ b/mercurial/templates/raw/map
@@ -8,6 +8,7 @@ 
 header = ''
 footer = ''
 changeset = changeset.tmpl
+conflictmarker = conflictmarker.tmpl
 difflineplus = '{line}'
 difflineminus = '{line}'
 difflineat = '{line}'
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -589,7 +589,7 @@ 
   no more unresolved files
   $ hg ci -m 'merge bar'
   $ hg log --config diff.git=1 -pr .
-  changeset:   23:d51446492733
+  changeset:   23:a0697e6a1df3
   tag:         tip
   parent:      22:30d96aeaf27b
   parent:      21:1aa437659d19
@@ -604,11 +604,11 @@ 
   --- a/cc
   +++ b/cc
   @@ -1,1 +1,5 @@
-  +<<<<<<< local
+  +<<<<<<< local: 30d9  test - "aa"
    dd
   +=======
   +cc
-  +>>>>>>> other
+  +>>>>>>> other: 1aa4  bar test - "aazzcc"
   diff --git a/z b/zz
   rename from z
   rename to zz
@@ -621,7 +621,7 @@ 
   cc not renamed
   $ hg ci --amend -m 'merge bar (amend message)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   24:59de3dce7a79
+  changeset:   24:77e48bc7cd1a
   tag:         tip
   parent:      22:30d96aeaf27b
   parent:      21:1aa437659d19
@@ -636,11 +636,11 @@ 
   --- a/cc
   +++ b/cc
   @@ -1,1 +1,5 @@
-  +<<<<<<< local
+  +<<<<<<< local: 30d9  test - "aa"
    dd
   +=======
   +cc
-  +>>>>>>> other
+  +>>>>>>> other: 1aa4  bar test - "aazzcc"
   diff --git a/z b/zz
   rename from z
   rename to zz
@@ -654,7 +654,7 @@ 
   $ hg mv zz z
   $ hg ci --amend -m 'merge bar (undo rename)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   26:7fb89c461f81
+  changeset:   26:7716e5d17e50
   tag:         tip
   parent:      22:30d96aeaf27b
   parent:      21:1aa437659d19
@@ -669,11 +669,11 @@ 
   --- a/cc
   +++ b/cc
   @@ -1,1 +1,5 @@
-  +<<<<<<< local
+  +<<<<<<< local: 30d9  test - "aa"
    dd
   +=======
   +cc
-  +>>>>>>> other
+  +>>>>>>> other: 1aa4  bar test - "aazzcc"
   
   $ hg debugrename z
   z not renamed
@@ -690,9 +690,9 @@ 
   $ echo aa >> aaa
   $ hg ci -m 'merge bar again'
   $ hg log --config diff.git=1 -pr .
-  changeset:   28:982d7a34ffee
+  changeset:   28:cc6af7f06777
   tag:         tip
-  parent:      26:7fb89c461f81
+  parent:      26:7716e5d17e50
   parent:      27:4c94d5bc65f5
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -725,9 +725,9 @@ 
   $ hg mv aaa aa
   $ hg ci --amend -m 'merge bar again (undo rename)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   30:522688c0e71b
+  changeset:   30:e161acc118ba
   tag:         tip
-  parent:      26:7fb89c461f81
+  parent:      26:7716e5d17e50
   parent:      27:4c94d5bc65f5
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -765,9 +765,9 @@ 
   use (c)hanged version or (d)elete? c
   $ hg ci -m 'merge bar (with conflicts)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   33:5f9904c491b8
+  changeset:   33:6e6ca29334c1
   tag:         tip
-  parent:      32:01780b896f58
+  parent:      32:774d2712d079
   parent:      31:67db8847a540
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
@@ -777,9 +777,9 @@ 
   $ hg rm aa
   $ hg ci --amend -m 'merge bar (with conflicts, amended)'
   $ hg log --config diff.git=1 -pr .
-  changeset:   35:6ce0c89781a3
+  changeset:   35:d05a594c39d2
   tag:         tip
-  parent:      32:01780b896f58
+  parent:      32:774d2712d079
   parent:      31:67db8847a540
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -10,7 +10,7 @@ 
   $ hg commit -m branch2
   created new head
 
-  $ hg merge 1
+  $ hg merge 1 --traceback
   merging a
   warning: conflicts during merge.
   merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
@@ -22,11 +22,11 @@ 
   32e80765d7fe+75234512624c+ tip
 
   $ cat a
-  <<<<<<< local
+  <<<<<<< local: 32e8  test - "branch2"
   something else
   =======
   something
-  >>>>>>> other
+  >>>>>>> other: 7523  test - "branch1"
 
   $ hg status
   M a
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -1049,11 +1049,11 @@ 
   [1]
   $ cat m
   $Id$
-  <<<<<<< local
+  <<<<<<< local: 88a8  test - "8bar"
   bar
   =======
   foo
-  >>>>>>> other
+  >>>>>>> other: 85d2  test - "simplemerge"
 
 resolve to local
 
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
@@ -57,11 +57,11 @@ 
   @@ -1,3 +1,7 @@
    added file1
    another line of text
-  +<<<<<<< local
+  +<<<<<<< local: c3fa  test - "added file1 and file2"
   +changed file1 different
   +=======
    changed file1
-  +>>>>>>> other
+  +>>>>>>> other: dfab  test - "changed file1"
 
   $ hg status
   M file1
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
@@ -66,11 +66,11 @@ 
   [1]
   $ aftermerge
   # cat f
-  <<<<<<< local
+  <<<<<<< local: ef83  test - "revision 1"
   revision 1
   =======
   revision 2
-  >>>>>>> other
+  >>>>>>> other: 0185  test - "revision 2"
   space
   # hg stat
   M f
diff --git a/tests/test-merge-types.t b/tests/test-merge-types.t
--- a/tests/test-merge-types.t
+++ b/tests/test-merge-types.t
@@ -290,18 +290,18 @@ 
   U h
   $ tellmeabout a
   a is a plain file with content:
-  <<<<<<< local
+  <<<<<<< local: 0139  test - "2"
   2
   =======
   1
-  >>>>>>> other
+  >>>>>>> other: 97e2  test - "1"
   $ tellmeabout b
   b is a plain file with content:
-  <<<<<<< local
+  <<<<<<< local: 0139  test - "2"
   2
   =======
   1
-  >>>>>>> other
+  >>>>>>> other: 97e2  test - "1"
   $ tellmeabout c
   c is a plain file with content:
   x
@@ -345,18 +345,18 @@ 
   [1]
   $ tellmeabout a
   a is a plain file with content:
-  <<<<<<< local
+  <<<<<<< local: 97e2  test - "1"
   1
   =======
   2
-  >>>>>>> other
+  >>>>>>> other: 0139  test - "2"
   $ tellmeabout b
   b is an executable file with content:
-  <<<<<<< local
+  <<<<<<< local: 97e2  test - "1"
   1
   =======
   2
-  >>>>>>> other
+  >>>>>>> other: 0139  test - "2"
   $ tellmeabout c
   c is an executable file with content:
   x
diff --git a/tests/test-merge7.t b/tests/test-merge7.t
--- a/tests/test-merge7.t
+++ b/tests/test-merge7.t
@@ -98,11 +98,11 @@ 
 
   $ cat test.txt
   one
-  <<<<<<< local
+  <<<<<<< local: 50c3  test - "Merge 1"
   two-point-five
   =======
   two-point-one
-  >>>>>>> other
+  >>>>>>> other: 40d1  test - "two -> two-point-one"
   three
 
   $ hg debugindex test.txt
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -210,11 +210,11 @@ 
   +++ b/a/a
   @@ -1,2 +1,6 @@
    a
-  +<<<<<<< local
+  +<<<<<<< local: *  shelve - "pending changes temporary commit" (glob)
    c
   +=======
   +a
-  +>>>>>>> other
+  +>>>>>>> other: *  shelve - "changes to '[mq]: second.patch'" (glob)
   diff --git a/b.rename/b b/b.rename/b
   new file mode 100644
   --- /dev/null
@@ -604,11 +604,11 @@ 
   M f
   ? f.orig
   $ cat f
-  <<<<<<< local
+  <<<<<<< local: 5f6b  shelve - "pending changes temporary commit"
   g
   =======
   f
-  >>>>>>> other
+  >>>>>>> other: 23b2  shelve - "changes to 'commit stuff'"
   $ cat f.orig
   g
   $ hg unshelve --abort
@@ -647,11 +647,11 @@ 
   M f
   ? f.orig
   $ cat f
-  <<<<<<< local
+  <<<<<<< local: 6b56  test - "intermediate other change"
   g
   =======
   f
-  >>>>>>> other
+  >>>>>>> other: 23b2  shelve - "changes to 'commit stuff'"
   $ cat f.orig
   g
   $ hg unshelve --abort
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -298,11 +298,11 @@ 
 should conflict
 
   $ cat t/t
-  <<<<<<< local
+  <<<<<<< local: 20a0  test - "10"
   conflict
   =======
   t3
-  >>>>>>> other
+  >>>>>>> other: 7af3  test - "7"
 
 clone