@@ -503,6 +503,20 @@
* foobar 1:9b140be10808
$ cp .hg/bookmarks .hg/bookmarks.bak
$ hg book -d X
+ $ hg incoming --bookmark -v ../a
+ comparing with ../a
+ searching for changed bookmarks
+ @ 0d2164f0ce0d diverged
+ X 0d2164f0ce0d added
+ $ hg incoming --bookmark -v ../a --config 'paths.*:bookmarks.mode=mirror'
+ comparing with ../a
+ searching for changed bookmarks
+ @ 0d2164f0ce0d changed
+ @foo 000000000000 removed
+ X 0d2164f0ce0d added
+ X@foo 000000000000 removed
+ foo 000000000000 removed
+ foobar 000000000000 removed
$ hg pull ../a --config 'paths.*:bookmarks.mode=mirror'
pulling from ../a
searching for changes
@@ -4360,7 +4360,9 @@
ui.status(
_(b'comparing with %s\n') % urlutil.hidepassword(source)
)
- return bookmarks.incoming(ui, repo, other)
+ return bookmarks.incoming(
+ ui, repo, other, mode=path.bookmarks_mode
+ )
finally:
other.close()
@@ -791,7 +791,7 @@
repo._bookmarks.applychanges(repo, tr, changes)
-def incoming(ui, repo, peer):
+def incoming(ui, repo, peer, mode=None):
"""Show bookmarks incoming from other to repo"""
ui.status(_(b"searching for changed bookmarks\n"))
@@ -805,9 +805,6 @@
).result()
)
- r = comparebookmarks(repo, remotemarks, repo._bookmarks)
- addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
-
incomings = []
if ui.debugflag:
getid = lambda id: id
@@ -816,25 +813,47 @@
if ui.verbose:
def add(b, id, st):
- incomings.append(b" %-25s %s %s\n" % (b, getid(id), st))
+ pattern = b" %-25s %s %s\n"
+ data = (b, getid(id), st)
+ incomings.append(pattern % data)
else:
def add(b, id, st):
- incomings.append(b" %-25s %s\n" % (b, getid(id)))
+ pattern = b" %-25s %s\n"
+ data = (b, getid(id))
+ incomings.append(pattern % data)
- for b, scid, dcid in addsrc:
- # i18n: "added" refers to a bookmark
- add(b, hex(scid), _(b'added'))
- for b, scid, dcid in advsrc:
- # i18n: "advanced" refers to a bookmark
- add(b, hex(scid), _(b'advanced'))
- for b, scid, dcid in diverge:
- # i18n: "diverged" refers to a bookmark
- add(b, hex(scid), _(b'diverged'))
- for b, scid, dcid in differ:
- # i18n: "changed" refers to a bookmark
- add(b, hex(scid), _(b'changed'))
+ if mode == b'mirror':
+ localmarks = repo._bookmarks
+ allmarks = set(remotemarks) | set(repo._bookmarks)
+ for b in sorted(allmarks):
+ loc = localmarks.get(b)
+ rem = remotemarks.get(b)
+ if loc == rem:
+ continue
+ elif loc is None:
+ add(b, hex(rem), _(b'added'))
+ elif rem is None:
+ add(b, hex(repo.nullid), _(b'removed'))
+ else:
+ add(b, hex(rem), _(b'changed'))
+ else:
+ r = comparebookmarks(repo, remotemarks, repo._bookmarks)
+ addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
+
+ for b, scid, dcid in addsrc:
+ # i18n: "added" refers to a bookmark
+ add(b, hex(scid), _(b'added'))
+ for b, scid, dcid in advsrc:
+ # i18n: "advanced" refers to a bookmark
+ add(b, hex(scid), _(b'advanced'))
+ for b, scid, dcid in diverge:
+ # i18n: "diverged" refers to a bookmark
+ add(b, hex(scid), _(b'diverged'))
+ for b, scid, dcid in differ:
+ # i18n: "changed" refers to a bookmark
+ add(b, hex(scid), _(b'changed'))
if not incomings:
ui.status(_(b"no changed bookmarks found\n"))