[PATCH 07 of 12 V2] bookmarks: add "outgoing()" to replace "diff()" for outgoing bookmarks

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Sun Sep 22 09:05:33 CDT 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1379858556 -32400
#      Sun Sep 22 23:02:36 2013 +0900
# Node ID 6c368f4e6e03673e9ee8a482c8a809b3fe8c1c5b
# Parent  e08135a62638c6c1ba7420103c00505791a90aa6
bookmarks: add "outgoing()" to replace "diff()" for outgoing bookmarks

This patch adds "outgoing()", which uses "compare()" to compare
bookmarks between the local and the remote repositories, to replace
"diff()" for outgoing bookmarks newly from the local repository.

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -438,6 +438,27 @@
         return 1
     return 0
 
+def outgoing(ui, repo, other):
+    ui.status(_("searching for changed bookmarks\n"))
+
+    def write(b, id):
+        ui.write("   %-25s %s\n" %
+                 (b, ui.debugflag and id or id[:12]))
+        return True
+    def addsrc(b, scid, dcid):
+        return write(b, scid)
+
+    if not _execactions(compare(repo,
+                                repo._bookmarks, other.listkeys('bookmarks'),
+                                srchex=hex),
+                        {'addsrc': addsrc,
+                         },
+                        ignore=set(['adddst', 'advsrc', 'advdst',
+                                    'diverge', 'differ'])):
+        ui.status(_("no changed bookmarks found\n"))
+        return 1
+    return 0
+
 def diff(ui, dst, src):
     ui.status(_("searching for changed bookmarks\n"))
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4337,7 +4337,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:


More information about the Mercurial-devel mailing list