[PATCH 2 of 3] summary: add other/local markers for merges [RFC]

timeless timeless at mozdev.org
Mon Apr 4 05:13:38 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1459760948 0
#      Mon Apr 04 09:09:08 2016 +0000
# Node ID 8b2619f31878755dbe66e15788df455625c16aa0
# Parent  351a972e12d3fae7e291bb8ce61b2a2e9f0225d6
summary: add other/local markers for merges [RFC]

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6598,6 +6598,13 @@
     conflicts = ms is not None and ms.active()
     localctx = otherctx = repo[nullrev]
     def shownode(label, p):
+        def mergelabel(key, v):
+            try:
+                label = ms._labels[v]
+                return '%s (%s)' % (key, label)
+            except TypeError:
+                return key
+
         # label with log.changeset (instead of log.parent) since this
         # shows a working directory parent *changeset*:
         ui.write(label % (p.rev(), str(p)),
@@ -6613,6 +6620,14 @@
             else:
                 ui.write(_(' (no revision checked out)'))
         ui.write('\n')
+        if conflicts:
+            merging = ''
+            # these are not for translation
+            if p == localctx:
+                merging = mergelabel('local', 0)
+            elif p == otherctx:
+                merging = mergelabel('other', 1)
+            ui.write(_('merging: %s\n') % merging)
         if p.description():
             ui.status(' ' + p.description().splitlines()[0].strip() + '\n',
                       label='log.summary')
diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -81,8 +81,10 @@
   [1]
   $ hg summary
   parent: 4:ed99997b793d tip
+  merging: local
    ypples
   source: 1:22cb4f70d813 
+  merging: other
    chair
   branch: default
   commit: 1 unresolved (clean)
@@ -706,8 +708,10 @@
   U foo
   $ hg summary
   parent: 2:b71750c4b0fd tip
+  merging: local
    capital ten
   source: 0:a30dd8addae3 
+  merging: other
    initial
   branch: default
   commit: 1 unresolved (clean)
@@ -727,8 +731,10 @@
   R foo
   $ hg summary
   parent: 2:b71750c4b0fd tip
+  merging: local
    capital ten
   source: 0:a30dd8addae3 
+  merging: other
    initial
   branch: default
   commit: 1 modified, 1 unknown
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -214,7 +214,7 @@
 
 Summary should mention graft:
 
-  $ hg summary |grep graft
+  $ hg summary |grep 'graft in'
   commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
 
 Commit while interrupted should fail:
diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
--- a/tests/test-rebase-parameters.t
+++ b/tests/test-rebase-parameters.t
@@ -471,8 +471,10 @@
 
   $ hg summary
   parent: 1:56daeba07f4b 
+  merging: local (dest)
    c2
   parent: 2:e4e3f3546619 tip
+  merging: other (source)
    c2b
   branch: default
   commit: 1 modified, 1 unresolved (merge)
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -866,8 +866,10 @@
   ? foo/foo
   $ hg summary
   parent: 4:33f7f61e6c5e tip
+  merging: local (dest)
    create conflict
   source: -1:000000000000  (no associated revision)
+  merging: other (source)
   branch: default
   bookmarks: *test
   commit: 2 unknown (clean)
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -490,8 +490,10 @@
   [1]
   $ hg sum
   parent: 1:76dcf9fab855 tip
+  merging: other (destination)
    b
   source: 0:9ab35a2d17cb 
+  merging: local (working copy)
    a
   branch: default
   commit: 1 modified, 1 unknown, 1 unresolved


More information about the Mercurial-devel mailing list