changeset 24660:bf13b44bbb0a

bookmarks: show detailed status about incoming bookmarks Before this patch, "hg incoming -B" shows only difference of bookmarks between two repositories, and it isn't user friendly. This patch shows detailed status about incoming bookmarks at "hg incoming -B". To avoid breaking backward compatibility with other tool chains, this patch shows status, only if --verbose is specified,
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 08 Apr 2015 02:56:19 +0900
parents 4ee00d6b0e29
children 8cf70c97a6e1
files mercurial/bookmarks.py mercurial/commands.py tests/test-bookmarks-pushpull.t
diffstat 3 files changed, 43 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed Apr 08 02:56:19 2015 +0900
+++ b/mercurial/bookmarks.py	Wed Apr 08 02:56:19 2015 +0900
@@ -456,16 +456,20 @@
         getid = lambda id: id
     else:
         getid = lambda id: id[:12]
-    def add(b, id):
-        incomings.append("   %-25s %s\n" % (b, getid(id)))
+    if ui.verbose:
+        def add(b, id, st):
+            incomings.append("   %-25s %s %s\n" % (b, getid(id), st))
+    else:
+        def add(b, id, st):
+            incomings.append("   %-25s %s\n" % (b, getid(id)))
     for b, scid, dcid in addsrc:
-        add(b, scid)
+        add(b, scid, _('added'))
     for b, scid, dcid in advsrc:
-        add(b, scid)
+        add(b, scid, _('advanced'))
     for b, scid, dcid in diverge:
-        add(b, scid)
+        add(b, scid, _('diverged'))
     for b, scid, dcid in differ:
-        add(b, scid)
+        add(b, scid, _('changed'))
 
     if not incomings:
         ui.status(_("no changed bookmarks found\n"))
--- a/mercurial/commands.py	Wed Apr 08 02:56:19 2015 +0900
+++ b/mercurial/commands.py	Wed Apr 08 02:56:19 2015 +0900
@@ -4300,6 +4300,29 @@
 
     .. container:: verbose
 
+      With -B/--bookmarks, the result of bookmark comparison between
+      local and remote repositories is displayed. With -v/--verbose,
+      status is also displayed for each bookmark like below::
+
+        BM1               01234567890a added
+        BM2               1234567890ab advanced
+        BM3               234567890abc diverged
+        BM4               34567890abcd changed
+
+      The action taken locally when pulling depends on the
+      status of each bookmark:
+
+      :``added``: pull will create it
+      :``advanced``: pull will update it
+      :``diverged``: pull will create a divergent bookmark
+      :``changed``: result depends on remote changesets
+
+      From the point of view of pulling behavior, bookmark
+      existing only in the remote repository are treated as ``added``,
+      even if it is in fact locally deleted.
+
+    .. container:: verbose
+
       For remote repository, using --bundle avoids downloading the
       changesets twice if the incoming is followed by a pull.
 
--- a/tests/test-bookmarks-pushpull.t	Wed Apr 08 02:56:19 2015 +0900
+++ b/tests/test-bookmarks-pushpull.t	Wed Apr 08 02:56:19 2015 +0900
@@ -526,11 +526,11 @@
   $ hg -R repo1 incoming -B repo2 -v
   comparing with repo2
   searching for changed bookmarks
-     ADD_ON_REPO2              66f7d451a68b
-     ADV_ON_REPO2              66f7d451a68b
-     DIFF_ADV_ON_REPO2         e7bd5218ca15
-     DIFF_DIVERGED             e7bd5218ca15
-     DIVERGED                  fa942426a6fd
+     ADD_ON_REPO2              66f7d451a68b added
+     ADV_ON_REPO2              66f7d451a68b advanced
+     DIFF_ADV_ON_REPO2         e7bd5218ca15 changed
+     DIFF_DIVERGED             e7bd5218ca15 changed
+     DIVERGED                  fa942426a6fd diverged
   $ hg -R repo1 outgoing -B repo2 -v
   comparing with repo2
   searching for changed bookmarks
@@ -545,11 +545,11 @@
   $ hg -R repo2 incoming -B repo1 -v
   comparing with repo1
   searching for changed bookmarks
-     ADD_ON_REPO1              66f7d451a68b
-     ADV_ON_REPO1              fa942426a6fd
-     DIFF_ADV_ON_REPO1         6100d3090acf
-     DIFF_DIVERGED             6100d3090acf
-     DIVERGED                  66f7d451a68b
+     ADD_ON_REPO1              66f7d451a68b added
+     ADV_ON_REPO1              fa942426a6fd advanced
+     DIFF_ADV_ON_REPO1         6100d3090acf changed
+     DIFF_DIVERGED             6100d3090acf changed
+     DIVERGED                  66f7d451a68b diverged
   $ hg -R repo2 outgoing -B repo1 -v
   comparing with repo1
   searching for changed bookmarks