Mercurial > hg
changeset 24398:c0096a2bd3ff
bookmarks: add outgoing() to replace diff() for outgoing bookmarks
This replacement makes enhancement of "show outgoing bookmarks" easy,
because "compare()" can detect more detailed difference of bookmarks
between two repositories.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 19 Mar 2015 23:36:05 +0900 |
parents | d0ea2028e8e6 |
children | 3993eb47ea49 |
files | mercurial/bookmarks.py mercurial/commands.py |
diffstat | 2 files changed, 29 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Thu Mar 19 23:36:05 2015 +0900 +++ b/mercurial/bookmarks.py Thu Mar 19 23:36:05 2015 +0900 @@ -470,6 +470,34 @@ return 0 +def outgoing(ui, repo, other): + '''Show bookmarks outgoing from repo to other + ''' + ui.status(_("searching for changed bookmarks\n")) + + r = compare(repo, repo._bookmarks, other.listkeys('bookmarks'), + srchex=hex) + addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r + + outgoings = [] + if ui.debugflag: + getid = lambda id: id + else: + getid = lambda id: id[:12] + def add(b, id): + outgoings.append(" %-25s %s\n" % (b, getid(id))) + for b, scid, dcid in addsrc: + add(b, scid) + + if not outgoings: + ui.status(_("no changed bookmarks found\n")) + return 1 + + for s in sorted(outgoings): + ui.write(s) + + return 0 + def diff(ui, dst, src): ui.status(_("searching for changed bookmarks\n"))
--- a/mercurial/commands.py Thu Mar 19 23:36:05 2015 +0900 +++ b/mercurial/commands.py Thu Mar 19 23:36:05 2015 +0900 @@ -4757,7 +4757,7 @@ ui.warn(_("remote doesn't support bookmarks\n")) return 0 ui.status(_('comparing with %s\n') % util.hidepassword(dest)) - return bookmarks.diff(ui, other, repo) + return bookmarks.outgoing(ui, repo, other) repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') try: