##// END OF EJS Templates
urlutil: add a `get_pull_paths` to perform the pull destination logic...
marmoute -
r47672:df7439cc default
parent child Browse files
Show More
@@ -5387,12 +5387,8 b' def pull(ui, repo, *sources, **opts):'
5387 hint = _(b'use hg pull followed by hg update DEST')
5387 hint = _(b'use hg pull followed by hg update DEST')
5388 raise error.InputError(msg, hint=hint)
5388 raise error.InputError(msg, hint=hint)
5389
5389
5390 if not sources:
5390 sources = urlutil.get_pull_paths(repo, ui, sources, opts.get(b'branch'))
5391 sources = [b'default']
5391 for source, branches in sources:
5392 for source in sources:
5393 source, branches = urlutil.parseurl(
5394 ui.expandpath(source), opts.get(b'branch')
5395 )
5396 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(source))
5392 ui.status(_(b'pulling from %s\n') % urlutil.hidepassword(source))
5397 ui.flush()
5393 ui.flush()
5398 other = hg.peer(repo, opts, source)
5394 other = hg.peer(repo, opts, source)
@@ -453,6 +453,15 b' def get_push_paths(repo, ui, dests):'
453 yield ui.getpath(dest, default=(b'default-push', b'default'))
453 yield ui.getpath(dest, default=(b'default-push', b'default'))
454
454
455
455
456 def get_pull_paths(repo, ui, sources, default_branches=()):
457 """yields all the `(path, branch)` selected as pull source by `sources`"""
458 if not sources:
459 sources = [b'default']
460 for source in sources:
461 url = ui.expandpath(source)
462 yield parseurl(url, default_branches)
463
464
456 def parseurl(path, branches=None):
465 def parseurl(path, branches=None):
457 '''parse url#branch, returning (url, (branch, branches))'''
466 '''parse url#branch, returning (url, (branch, branches))'''
458 u = url(path)
467 u = url(path)
General Comments 0
You need to be logged in to leave comments. Login now