mercurial/commands.py
changeset 46764 685383486d0a
parent 46763 954bad9c32a0
child 46776 471cd86c8eb4
equal deleted inserted replaced
46763:954bad9c32a0 46764:685383486d0a
  5321             _(b'a specific branch you would like to pull'),
  5321             _(b'a specific branch you would like to pull'),
  5322             _(b'BRANCH'),
  5322             _(b'BRANCH'),
  5323         ),
  5323         ),
  5324     ]
  5324     ]
  5325     + remoteopts,
  5325     + remoteopts,
  5326     _(b'[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'),
  5326     _(b'[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]...'),
  5327     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
  5327     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
  5328     helpbasic=True,
  5328     helpbasic=True,
  5329 )
  5329 )
  5330 def pull(ui, repo, source=b"default", **opts):
  5330 def pull(ui, repo, *sources, **opts):
  5331     """pull changes from the specified source
  5331     """pull changes from the specified source
  5332 
  5332 
  5333     Pull changes from a remote repository to a local one.
  5333     Pull changes from a remote repository to a local one.
  5334 
  5334 
  5335     This finds all changes from the repository at the specified path
  5335     This finds all changes from the repository at the specified path
  5348     to add those changes to the repository, you should use :hg:`pull
  5348     to add those changes to the repository, you should use :hg:`pull
  5349     -r X` where ``X`` is the last changeset listed by :hg:`incoming`.
  5349     -r X` where ``X`` is the last changeset listed by :hg:`incoming`.
  5350 
  5350 
  5351     If SOURCE is omitted, the 'default' path will be used.
  5351     If SOURCE is omitted, the 'default' path will be used.
  5352     See :hg:`help urls` for more information.
  5352     See :hg:`help urls` for more information.
       
  5353 
       
  5354     If multiple sources are specified, they will be pulled sequentially as if
       
  5355     the command was run multiple time. If --update is specify and the command
       
  5356     will stop at the first failed --update.
  5353 
  5357 
  5354     Specifying bookmark as ``.`` is equivalent to specifying the active
  5358     Specifying bookmark as ``.`` is equivalent to specifying the active
  5355     bookmark's name.
  5359     bookmark's name.
  5356 
  5360 
  5357     Returns 0 on success, 1 if an update had unresolved files.
  5361     Returns 0 on success, 1 if an update had unresolved files.
  5363     ):
  5367     ):
  5364         msg = _(b'update destination required by configuration')
  5368         msg = _(b'update destination required by configuration')
  5365         hint = _(b'use hg pull followed by hg update DEST')
  5369         hint = _(b'use hg pull followed by hg update DEST')
  5366         raise error.InputError(msg, hint=hint)
  5370         raise error.InputError(msg, hint=hint)
  5367 
  5371 
  5368     if True:
  5372     if not sources:
       
  5373         sources = [b'default']
       
  5374     for source in sources:
  5369         source, branches = hg.parseurl(
  5375         source, branches = hg.parseurl(
  5370             ui.expandpath(source), opts.get(b'branch')
  5376             ui.expandpath(source), opts.get(b'branch')
  5371         )
  5377         )
  5372         ui.status(_(b'pulling from %s\n') % util.hidepassword(source))
  5378         ui.status(_(b'pulling from %s\n') % util.hidepassword(source))
  5373         ui.flush()
  5379         ui.flush()
  5461                 finally:
  5467                 finally:
  5462                     del repo._subtoppath
  5468                     del repo._subtoppath
  5463 
  5469 
  5464         finally:
  5470         finally:
  5465             other.close()
  5471             other.close()
       
  5472         # skip the remaining pull source if they are some conflict.
       
  5473         if update_conflict:
       
  5474             break
  5466     if update_conflict:
  5475     if update_conflict:
  5467         return 1
  5476         return 1
  5468     else:
  5477     else:
  5469         return 0
  5478         return 0
  5470 
  5479