comparison mercurial/commands.py @ 46931:d4e4ccb75f99

outgoing: accept multiple destinations This align the behavior of `hg outgoing` with the one of `hg incoming`. In addition this prepare the introduction of having simple `path` resolve to multiple destination in practice (eg: `default`) Differential Revision: https://phab.mercurial-scm.org/D10391
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 14 Apr 2021 01:26:44 +0200
parents 0afe96e374a7
children dec31caf5fd6
comparison
equal deleted inserted replaced
46930:0afe96e374a7 46931:d4e4ccb75f99
4921 ), 4921 ),
4922 ] 4922 ]
4923 + logopts 4923 + logopts
4924 + remoteopts 4924 + remoteopts
4925 + subrepoopts, 4925 + subrepoopts,
4926 _(b'[-M] [-p] [-n] [-f] [-r REV]... [DEST]'), 4926 _(b'[-M] [-p] [-n] [-f] [-r REV]... [DEST]...'),
4927 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT, 4927 helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
4928 ) 4928 )
4929 def outgoing(ui, repo, dest=None, **opts): 4929 def outgoing(ui, repo, *dests, **opts):
4930 """show changesets not found in the destination 4930 """show changesets not found in the destination
4931 4931
4932 Show changesets not found in the specified destination repository 4932 Show changesets not found in the specified destination repository
4933 or the default push location. These are the changesets that would 4933 or the default push location. These are the changesets that would
4934 be pushed if a push was requested. 4934 be pushed if a push was requested.
4960 existing only in the remote repository are treated as 4960 existing only in the remote repository are treated as
4961 ``deleted``, even if it is in fact added remotely. 4961 ``deleted``, even if it is in fact added remotely.
4962 4962
4963 Returns 0 if there are outgoing changes, 1 otherwise. 4963 Returns 0 if there are outgoing changes, 1 otherwise.
4964 """ 4964 """
4965 # hg._outgoing() needs to re-resolve the path in order to handle #branch
4966 # style URLs, so don't overwrite dest.
4967 path = ui.getpath(dest, default=(b'default-push', b'default'))
4968 if not path:
4969 raise error.ConfigError(
4970 _(b'default repository not configured!'),
4971 hint=_(b"see 'hg help config.paths'"),
4972 )
4973
4974 opts = pycompat.byteskwargs(opts) 4965 opts = pycompat.byteskwargs(opts)
4975 if opts.get(b'bookmarks'): 4966 if opts.get(b'bookmarks'):
4976 dest = path.pushloc or path.loc 4967 for path in urlutil.get_push_paths(repo, ui, dests):
4977 other = hg.peer(repo, opts, dest) 4968 dest = path.pushloc or path.loc
4978 try: 4969 other = hg.peer(repo, opts, dest)
4979 if b'bookmarks' not in other.listkeys(b'namespaces'): 4970 try:
4980 ui.warn(_(b"remote doesn't support bookmarks\n")) 4971 if b'bookmarks' not in other.listkeys(b'namespaces'):
4981 return 0 4972 ui.warn(_(b"remote doesn't support bookmarks\n"))
4982 ui.status(_(b'comparing with %s\n') % urlutil.hidepassword(dest)) 4973 return 0
4983 ui.pager(b'outgoing') 4974 ui.status(
4984 return bookmarks.outgoing(ui, repo, other) 4975 _(b'comparing with %s\n') % urlutil.hidepassword(dest)
4985 finally: 4976 )
4986 other.close() 4977 ui.pager(b'outgoing')
4987 4978 return bookmarks.outgoing(ui, repo, other)
4988 return hg.outgoing(ui, repo, dest, opts) 4979 finally:
4980 other.close()
4981
4982 return hg.outgoing(ui, repo, dests, opts)
4989 4983
4990 4984
4991 @command( 4985 @command(
4992 b'parents', 4986 b'parents',
4993 [ 4987 [