[PATCH] bookmarks: issue a warning if remote doesn't support comparing bookmarks

David Soria Parra dsp at php.net
Mon Feb 21 15:22:18 CST 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1298323332 -3600
# Node ID 4cb0226e4fff48105b91d4c69d4a5d226b7c3b40
# Parent  b2e4e394d742ca3a948848dc2aa9d288c0eaa861
bookmarks: issue a warning if remote doesn't support comparing bookmarks

We want to issue a warning and abort comparing bookmarks if remote doesn't
support it. Otherwise hg out -B will list you outgoing bookmarks that cannot
be pushed to the remote repository using hg push -B.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2501,6 +2501,9 @@
         source, branches = hg.parseurl(ui.expandpath(source),
                                        opts.get('branch'))
         other = hg.repository(hg.remoteui(repo, opts), source)
+        if 'bookmarks' not in other.listkeys('namespaces'):
+            ui.warn(_("remote doesn't support bookmarks\n"))
+            return 0
         ui.status(_('comparing with %s\n') % url.hidepassword(source))
         return bookmarks.diff(ui, repo, other)
 
@@ -2785,6 +2788,9 @@
         dest = ui.expandpath(dest or 'default-push', dest or 'default')
         dest, branches = hg.parseurl(dest, opts.get('branch'))
         other = hg.repository(hg.remoteui(repo, opts), dest)
+        if 'bookmarks' not in other.listkeys('namespaces'):
+            ui.warn(_("remote doesn't support bookmarks\n"))
+            return 0
         ui.status(_('comparing with %s\n') % url.hidepassword(dest))
         return bookmarks.diff(ui, other, repo)
 


More information about the Mercurial-devel mailing list