comparison mercurial/commands.py @ 13453:c1b808020819 stable

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.
author David Soria Parra <dsp@php.net>
date Mon, 21 Feb 2011 22:22:12 +0100
parents 97b69883e929
children afc84a879ac8
comparison
equal deleted inserted replaced
13452:3d3661df05e5 13453:c1b808020819
2500 2500
2501 if opts.get('bookmarks'): 2501 if opts.get('bookmarks'):
2502 source, branches = hg.parseurl(ui.expandpath(source), 2502 source, branches = hg.parseurl(ui.expandpath(source),
2503 opts.get('branch')) 2503 opts.get('branch'))
2504 other = hg.repository(hg.remoteui(repo, opts), source) 2504 other = hg.repository(hg.remoteui(repo, opts), source)
2505 if 'bookmarks' not in other.listkeys('namespaces'):
2506 ui.warn(_("remote doesn't support bookmarks\n"))
2507 return 0
2505 ui.status(_('comparing with %s\n') % url.hidepassword(source)) 2508 ui.status(_('comparing with %s\n') % url.hidepassword(source))
2506 return bookmarks.diff(ui, repo, other) 2509 return bookmarks.diff(ui, repo, other)
2507 2510
2508 ret = hg.incoming(ui, repo, source, opts) 2511 ret = hg.incoming(ui, repo, source, opts)
2509 return ret 2512 return ret
2784 2787
2785 if opts.get('bookmarks'): 2788 if opts.get('bookmarks'):
2786 dest = ui.expandpath(dest or 'default-push', dest or 'default') 2789 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2787 dest, branches = hg.parseurl(dest, opts.get('branch')) 2790 dest, branches = hg.parseurl(dest, opts.get('branch'))
2788 other = hg.repository(hg.remoteui(repo, opts), dest) 2791 other = hg.repository(hg.remoteui(repo, opts), dest)
2792 if 'bookmarks' not in other.listkeys('namespaces'):
2793 ui.warn(_("remote doesn't support bookmarks\n"))
2794 return 0
2789 ui.status(_('comparing with %s\n') % url.hidepassword(dest)) 2795 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
2790 return bookmarks.diff(ui, other, repo) 2796 return bookmarks.diff(ui, other, repo)
2791 2797
2792 ret = hg.outgoing(ui, repo, dest, opts) 2798 ret = hg.outgoing(ui, repo, dest, opts)
2793 return ret 2799 return ret