comparison mercurial/commands.py @ 38203:dfb888aae17a

outgoing: pay attention to `default:pushurl` for bookmarks and subrepos The problem here was that `default:pushurl` and `default` get translated to a single entry in `ui.paths` named 'default', with an attribute for 'pushloc', 'loc', and 'rawloc'. ui.expandpath() then always takes the `rawloc` attribute. Maybe the ui.expandpath() API is busted and should be removed? Or maybe getpath() should return a copy that adds an attribute reflecting the URL of the path chosen? I thought that I could remove the code in hg._outgoing() and pass the location resolved in commands.py as `dest`, but unfortunately that code is needed there to resolve #branch type URLs. Maybe that should be pulled up to commands.py, because I can't see any reasonable behavior for a subrepo path that's constructed out of that type of URL. The push command already resolves this early, so that works properly. But it looks like bundle, histedit, largefiles, patchbomb, and summary use a similar pattern, so they are likely similarly affected.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 28 May 2018 01:36:34 -0400
parents 5736570718fe
children aea29e81753a
comparison
equal deleted inserted replaced
38202:fc72beec2a1a 38203:dfb888aae17a
3709 existing only in the remote repository are treated as 3709 existing only in the remote repository are treated as
3710 ``deleted``, even if it is in fact added remotely. 3710 ``deleted``, even if it is in fact added remotely.
3711 3711
3712 Returns 0 if there are outgoing changes, 1 otherwise. 3712 Returns 0 if there are outgoing changes, 1 otherwise.
3713 """ 3713 """
3714 # hg._outgoing() needs to re-resolve the path in order to handle #branch
3715 # style URLs, so don't overwrite dest.
3716 path = ui.paths.getpath(dest, default=('default-push', 'default'))
3717 if not path:
3718 raise error.Abort(_('default repository not configured!'),
3719 hint=_("see 'hg help config.paths'"))
3720
3714 opts = pycompat.byteskwargs(opts) 3721 opts = pycompat.byteskwargs(opts)
3715 if opts.get('graph'): 3722 if opts.get('graph'):
3716 logcmdutil.checkunsupportedgraphflags([], opts) 3723 logcmdutil.checkunsupportedgraphflags([], opts)
3717 o, other = hg._outgoing(ui, repo, dest, opts) 3724 o, other = hg._outgoing(ui, repo, dest, opts)
3718 if not o: 3725 if not o:
3726 graphmod.asciiedges) 3733 graphmod.asciiedges)
3727 cmdutil.outgoinghooks(ui, repo, other, opts, o) 3734 cmdutil.outgoinghooks(ui, repo, other, opts, o)
3728 return 0 3735 return 0
3729 3736
3730 if opts.get('bookmarks'): 3737 if opts.get('bookmarks'):
3731 dest = ui.expandpath(dest or 'default-push', dest or 'default') 3738 dest = path.pushloc or path.loc
3732 dest, branches = hg.parseurl(dest, opts.get('branch')) 3739 dest, branches = hg.parseurl(dest, opts.get('branch'))
3733 other = hg.peer(repo, opts, dest) 3740 other = hg.peer(repo, opts, dest)
3734 if 'bookmarks' not in other.listkeys('namespaces'): 3741 if 'bookmarks' not in other.listkeys('namespaces'):
3735 ui.warn(_("remote doesn't support bookmarks\n")) 3742 ui.warn(_("remote doesn't support bookmarks\n"))
3736 return 0 3743 return 0
3737 ui.status(_('comparing with %s\n') % util.hidepassword(dest)) 3744 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
3738 ui.pager('outgoing') 3745 ui.pager('outgoing')
3739 return bookmarks.outgoing(ui, repo, other) 3746 return bookmarks.outgoing(ui, repo, other)
3740 3747
3741 repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') 3748 repo._subtoppath = path.pushloc or path.loc
3742 try: 3749 try:
3743 return hg.outgoing(ui, repo, dest, opts) 3750 return hg.outgoing(ui, repo, dest, opts)
3744 finally: 3751 finally:
3745 del repo._subtoppath 3752 del repo._subtoppath
3746 3753