comparison mercurial/utils/urlutil.py @ 49697:1fae401b3b14

path: have `get_push_paths` directly return the push variants So the function directly returns usable paths, that should help the callers!
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 01 Dec 2022 01:33:27 +0100
parents 0acefbbcc82a
children f27fbb908b10
comparison
equal deleted inserted replaced
49696:0acefbbcc82a 49697:1fae401b3b14
478 def get_push_paths(repo, ui, dests): 478 def get_push_paths(repo, ui, dests):
479 """yields all the `path` selected as push destination by `dests`""" 479 """yields all the `path` selected as push destination by `dests`"""
480 if not dests: 480 if not dests:
481 if b'default-push' in ui.paths: 481 if b'default-push' in ui.paths:
482 for p in ui.paths[b'default-push']: 482 for p in ui.paths[b'default-push']:
483 yield p 483 yield p.get_push_variant()
484 elif b'default' in ui.paths: 484 elif b'default' in ui.paths:
485 for p in ui.paths[b'default']: 485 for p in ui.paths[b'default']:
486 yield p 486 yield p.get_push_variant()
487 else: 487 else:
488 raise error.ConfigError( 488 raise error.ConfigError(
489 _(b'default repository not configured!'), 489 _(b'default repository not configured!'),
490 hint=_(b"see 'hg help config.paths'"), 490 hint=_(b"see 'hg help config.paths'"),
491 ) 491 )
492 else: 492 else:
493 for dest in dests: 493 for dest in dests:
494 if dest in ui.paths: 494 if dest in ui.paths:
495 for p in ui.paths[dest]: 495 for p in ui.paths[dest]:
496 yield p 496 yield p.get_push_variant()
497 else: 497 else:
498 path = try_path(ui, dest) 498 path = try_path(ui, dest)
499 if path is None: 499 if path is None:
500 msg = _(b'repository %s does not exist') 500 msg = _(b'repository %s does not exist')
501 msg %= dest 501 msg %= dest
502 raise error.RepoError(msg) 502 raise error.RepoError(msg)
503 yield path 503 yield path.get_push_variant()
504 504
505 505
506 def get_pull_paths(repo, ui, sources): 506 def get_pull_paths(repo, ui, sources):
507 """yields all the `(path, branch)` selected as pull source by `sources`""" 507 """yields all the `(path, branch)` selected as pull source by `sources`"""
508 if not sources: 508 if not sources: