# HG changeset patch # User Matt Mackall # Date 2011-02-10 19:46:27 # Node ID 4e1ba6ead69c450c62321367c5d5a92514bd4b6b # Parent 689bf32b3bbd48a22ba161cc6a5c4a95d75f4533 bookmarks: move diff to core diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py --- a/hgext/bookmarks.py +++ b/hgext/bookmarks.py @@ -342,27 +342,12 @@ def push(oldpush, ui, repo, dest=None, * return result -def diffbookmarks(ui, repo, remote): - ui.status(_("searching for changed bookmarks\n")) - - lmarks = repo.listkeys('bookmarks') - rmarks = remote.listkeys('bookmarks') - - diff = sorted(set(rmarks) - set(lmarks)) - for k in diff: - ui.write(" %-25s %s\n" % (k, rmarks[k][:12])) - - if len(diff) <= 0: - ui.status(_("no changed bookmarks found\n")) - return 1 - return 0 - def incoming(oldincoming, ui, repo, source="default", **opts): if opts.get('bookmarks'): source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), source) ui.status(_('comparing with %s\n') % url.hidepassword(source)) - return diffbookmarks(ui, repo, other) + return bookmarks.diff(ui, repo, other) else: return oldincoming(ui, repo, source, **opts) @@ -372,7 +357,7 @@ def outgoing(oldoutgoing, ui, repo, dest dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), dest) ui.status(_('comparing with %s\n') % url.hidepassword(dest)) - return diffbookmarks(ui, other, repo) + return bookmarks.diff(ui, other, repo) else: return oldoutgoing(ui, repo, dest, **opts) diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -149,3 +149,18 @@ def pushbookmark(repo, key, old, new): return True finally: w.release() + +def diff(ui, repo, remote): + ui.status(_("searching for changed bookmarks\n")) + + lmarks = repo.listkeys('bookmarks') + rmarks = remote.listkeys('bookmarks') + + diff = sorted(set(rmarks) - set(lmarks)) + for k in diff: + ui.write(" %-25s %s\n" % (k, rmarks[k][:12])) + + if len(diff) <= 0: + ui.status(_("no changed bookmarks found\n")) + return 1 + return 0