[PATCH 13 of 15 V4] bookmarks: show more detail about outgoing bookmarks

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Oct 15 15:25:35 UTC 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1381849966 -32400
#      Wed Oct 16 00:12:46 2013 +0900
# Node ID 744fc8f0181340d9aa96a3d2303282d2810fb8fc
# Parent  1fc6e7f1e32c5d5a488d3e7dab03513ed00353bc
bookmarks: show more detail about outgoing bookmarks

Before this patch, "hg outgoing -B" shows only bookmarks added
locally.

So, users can't know whether "hg push" implicitly updates bookmarks or
not, before execution of it.

This patch shows more detail about outgoing bookmarks for "hg outgoing
-B", as follows:

    BM1                       01234567890a (-) advanced locally
    BM2                       1234567890ab (B) diverged
    BM3                                    (B) deleted locally, perhaps

Each lines consist of four columns: "bookmark name", "local value",
"action at pushing" and "detail of difference".

"action at pushing" column shows about bookmark updating in the remote
repository by marks below:

  - "-": updated implicitly
  - "B": not updated implicitly (use -B to update forcibly)

This patch shows "deleted locally, perhaps" for the bookmark which
exists only in the remote repository, from the point of view of "hg
push" behavior, even though it is added remotely in fact.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -454,11 +454,21 @@
                  srchex=hex)
 
     outgoings = []
-    def add(b, id):
-        outgoings.append("   %-25s %s\n" %
-                         (b, ui.debugflag and id or id[:12]))
+    def add(b, id, act, msg):
+        outgoings.append("   %-25s %s (%s) %s\n" %
+                         (b, ui.debugflag and id or id[:12], act, msg))
     for b, scid, dcid in addsrc:
-        add(b, scid)
+        add(b, scid, 'B', _('added locally'))
+    for b, scid, dcid in adddst:
+        add(b, ' ' * 40, 'B', _('deleted locally, perhaps'))
+    for b, scid, dcid in advsrc:
+        add(b, scid, '-', _('advanced locally'))
+    for b, scid, dcid in advdst:
+        add(b, scid, 'B', _('advanced remotely'))
+    for b, scid, dcid in diverge:
+        add(b, scid, 'B', _('diverged'))
+    for b, scid, dcid in differ:
+        add(b, scid, 'B', _('changed'))
 
     if not outgoings:
         ui.status(_("no changed bookmarks found\n"))
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4336,6 +4336,23 @@
 
     See pull for details of valid destination formats.
 
+    .. container:: verbose
+
+      With -B/--bookmarks, the result of bookmark comparison between
+      local and remote repositories is displayed as follows::
+
+        BM1                       01234567890a (-) advanced locally
+        BM2                       1234567890ab (B) diverged
+
+      Each lines consist of four columns: "bookmark name", "local
+      value", "action at pushing" and "detail of difference".
+
+      "action at pushing" column shows about bookmark updating in the
+      remote repository by marks below:
+
+      :``-``: updated implicitly
+      :``B``: not updated implicitly (use -B to update forcibly)
+
     Returns 0 if there are outgoing changes, 1 otherwise.
     """
     if opts.get('graph'):
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -381,8 +381,11 @@
   $ hg out -B http://localhost:$HGPORT/
   comparing with http://localhost:$HGPORT/
   searching for changed bookmarks
-  no changed bookmarks found
-  [1]
+     @                         0d2164f0ce0d (B) diverged
+     X                         0d2164f0ce0d (B) diverged
+     Z                         0d2164f0ce0d (B) diverged
+     foo                                    (B) deleted locally, perhaps
+     foobar                                 (B) deleted locally, perhaps
   $ hg push -B Z http://localhost:$HGPORT/
   pushing to http://localhost:$HGPORT/
   searching for changes
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -171,7 +171,7 @@
   $ hg out -B
   comparing with ssh://user@dummy/remote
   searching for changed bookmarks
-     foo                       1160648e36ce
+     foo                       1160648e36ce (B) added locally
   $ hg push -B foo
   pushing to ssh://user@dummy/remote
   searching for changes



More information about the Mercurial-devel mailing list