# HG changeset patch # User FUJIWARA Katsunori # Date 2015-04-07 17:56:19 # Node ID bf13b44bbb0a671b96c4318bf7f4183f55440558 # Parent 4ee00d6b0e29a21f1dd50862951f59ba907abe45 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, diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -456,16 +456,20 @@ def incoming(ui, repo, other): 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")) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4300,6 +4300,29 @@ def incoming(ui, repo, source="default", .. 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. 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 @@ -526,11 +526,11 @@ be excahnged) $ 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 @@ be excahnged) $ 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