Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 46764:685383486d0a
pull: allow to specify multiple sources
I end up needing that on a regular basis and it turn out to be very simple to
implement. See documentation and test for details.
Differential Revision: https://phab.mercurial-scm.org/D10159
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 10 Mar 2021 06:03:01 +0100 |
parents | 954bad9c32a0 |
children | 471cd86c8eb4 |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Mar 10 06:03:55 2021 +0100 +++ b/mercurial/commands.py Wed Mar 10 06:03:01 2021 +0100 @@ -5323,11 +5323,11 @@ ), ] + remoteopts, - _(b'[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'), + _(b'[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]...'), helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT, helpbasic=True, ) -def pull(ui, repo, source=b"default", **opts): +def pull(ui, repo, *sources, **opts): """pull changes from the specified source Pull changes from a remote repository to a local one. @@ -5351,6 +5351,10 @@ If SOURCE is omitted, the 'default' path will be used. See :hg:`help urls` for more information. + If multiple sources are specified, they will be pulled sequentially as if + the command was run multiple time. If --update is specify and the command + will stop at the first failed --update. + Specifying bookmark as ``.`` is equivalent to specifying the active bookmark's name. @@ -5365,7 +5369,9 @@ hint = _(b'use hg pull followed by hg update DEST') raise error.InputError(msg, hint=hint) - if True: + if not sources: + sources = [b'default'] + for source in sources: source, branches = hg.parseurl( ui.expandpath(source), opts.get(b'branch') ) @@ -5463,6 +5469,9 @@ finally: other.close() + # skip the remaining pull source if they are some conflict. + if update_conflict: + break if update_conflict: return 1 else: