bookmarks: issue a warning if remote doesn't support comparing bookmarks stable
authorDavid Soria Parra <dsp@php.net>
Mon, 21 Feb 2011 22:22:12 +0100
branchstable
changeset 13453 c1b808020819
parent 13452 3d3661df05e5
child 13454 afc84a879ac8
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.
mercurial/commands.py
--- a/mercurial/commands.py	Mon Feb 21 11:24:23 2011 -0600
+++ b/mercurial/commands.py	Mon Feb 21 22:22:12 2011 +0100
@@ -2502,6 +2502,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)
 
@@ -2786,6 +2789,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)