[PATCH 12 of 12 V3] bookmarks: show also about changed bookmarks in output of summary command
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Wed Oct 2 09:38:49 CDT 2013
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1380723659 -32400
# Wed Oct 02 23:20:59 2013 +0900
# Node ID 851e922e7c1a764a23d11d62faf7f5c8ed438818
# Parent ae950252b447a6386c33824defb594abccd59cf8
bookmarks: show also about changed bookmarks in output of summary command
Before this patch, "hg summary --remote" shows information only about
bookmarks newly added locally or remotely.
This patch shows also the number of bookmarks changed locally or
remotely, and this may lead users to compare bookmarks between
repositories by "hg incoming -B" and/or "hg outgoing -B".
This patch also changes output format of bookmark information to
prevent "remote:" line from being too long.
old:
remote: ...., N incoming bookmarks, M outgoing bookmarks
new:
remote: ...., bookmarks (N incoming, M outgoing, L changed)
diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -478,7 +478,7 @@
(addsrc, adddst, advsrc, advdst, diverge, differ, invalid
) = compare(repo, other.listkeys('bookmarks'), repo._bookmarks,
dsthex=hex)
- return (len(addsrc), len(adddst))
+ return (len(addsrc), len(adddst), len(advsrc + advdst + diverge + differ))
def validdest(repo, old, new):
"""Is the new bookmark destination a valid update from the old one"""
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5584,10 +5584,15 @@
t.append(_('%d outgoing') % len(o))
if 'bookmarks' in other.listkeys('namespaces'):
counts = bookmarks.summary(repo, other)
+ b = []
if counts[0] > 0:
- t.append(_('%d incoming bookmarks') % counts[0])
+ b.append(_('%d incoming') % counts[0])
if counts[1] > 0:
- t.append(_('%d outgoing bookmarks') % counts[1])
+ b.append(_('%d outgoing') % counts[1])
+ if counts[2] > 0:
+ b.append(_('%d changed') % counts[2])
+ if b:
+ t.append(_('bookmarks (%s)') % (', '.join(b)))
if t:
# i18n: column positioning for "hg summary"
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
@@ -433,7 +433,7 @@
$ hg bookmarks -d X
$ hg bookmarks -d Y
$ hg summary --remote | grep '^remote:'
- remote: *2 incoming bookmarks, 1 outgoing bookmarks (glob)
+ remote: 1 outgoing, bookmarks (2 incoming, 1 outgoing, 1 changed)
$ cd ..
@@ -517,6 +517,9 @@
DIFF_DIVERGED 6100d3090acf (B) changed
DIVERGED 66f7d451a68b (B) diverged
+ $ hg -R repo1 summary --remote --config paths.default=repo2 | grep '^remote:'
+ remote: 1 or more incoming, 1 outgoing, bookmarks (1 incoming, 1 outgoing, 6 changed)
+
$ hg -R repo2 incoming -B repo1
comparing with repo1
searching for changed bookmarks
More information about the Mercurial-devel
mailing list