[PATCH 12 of 15 V4] bookmarks: show more detail about incoming bookmarks
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Tue Oct 15 15:25:34 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 1fc6e7f1e32c5d5a488d3e7dab03513ed00353bc
# Parent 23df7670d1694ef1dd12da89262128e534e96ac0
bookmarks: show more detail about incoming bookmarks
Before this patch, "hg incoming -B" shows only bookmarks added
remotely.
So, users can't know whether "hg pull" implicitly updates bookmarks or
not, before execution of it.
This patch shows more detail about incoming bookmarks for "hg incoming
-B", as follows:
BM1 01234567890a (-) advanced remotely
BM2 1234567890ab (B) advanced locally
BM3 234567890abc (@) diverged
BM4 34567890abcd (?) changed
Each lines consist of four columns: "bookmark name", "remote value",
"action at pulling" and "detail of difference".
"action at pulling" column shows about bookmark updating in the local
repository by marks below:
- "-": updated or added implicitly
- "B": not updated implicitly (use -B to update forcibly)
- "@": same as "B" except for implicit creation of diverged one
- "?": undefined, because remote revision is unknown for local
This patch shows "added remotely" for the bookmark which exists only
in the remote repository, from the point of view of "hg pull"
behavior, even though it is deleted locally in fact.
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -423,11 +423,19 @@
dsthex=hex)
incomings = []
- def add(b, id):
- incomings.append(" %-25s %s\n" %
- (b, ui.debugflag and id or id[:12]))
+ def add(b, id, act, msg):
+ incomings.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, '-', _('added remotely'))
+ for b, scid, dcid in advsrc:
+ add(b, scid, '-', _('advanced remotely'))
+ for b, scid, dcid in advdst:
+ add(b, scid, 'B', _('advanced locally'))
+ for b, scid, dcid in diverge:
+ add(b, scid, '@', _('diverged'))
+ for b, scid, dcid in differ:
+ add(b, scid, '?', _('changed'))
if not incomings:
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
@@ -3844,6 +3844,27 @@
See pull for valid source format details.
+ .. container:: verbose
+
+ With -B/--bookmarks, the result of bookmark comparison between
+ local and remote repositories is displayed as follows::
+
+ BM1 01234567890a (-) advanced remotely
+ BM2 1234567890ab (B) advanced locally
+ BM3 234567890abc (@) diverged
+ BM4 34567890abcd (?) changed
+
+ Each lines consist of four columns: "bookmark name", "remote
+ value", "action at pulling" and "detail of difference".
+
+ "action at pulling" column shows about bookmark updating in the
+ local repository by marks below:
+
+ :``-``: updated or added implicitly
+ :``B``: not updated implicitly (use -B to update forcibly)
+ :``@``: same as ``B`` except for implicit creation of diverged one
+ :``?``: undefined, because remote revision is unknown for local
+
Returns 0 if there are incoming 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
@@ -393,9 +393,11 @@
$ hg in -B http://localhost:$HGPORT/
comparing with http://localhost:$HGPORT/
searching for changed bookmarks
- Z 0d2164f0ce0d
- foo 000000000000
- foobar 9b140be10808
+ @ 9b140be10808 (@) diverged
+ X 9b140be10808 (@) diverged
+ Z 0d2164f0ce0d (-) added remotely
+ foo 000000000000 (-) added remotely
+ foobar 9b140be10808 (-) added remotely
$ hg pull -B Z http://localhost:$HGPORT/
pulling from http://localhost:$HGPORT/
no changes found
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -191,7 +191,7 @@
$ hg in -B
comparing with ssh://user@dummy/remote
searching for changed bookmarks
- foo a28a9d1a809c
+ foo a28a9d1a809c (-) added remotely
$ hg book -f -r 0 foo
$ hg pull -B foo
pulling from ssh://user@dummy/remote
More information about the Mercurial-devel
mailing list