Show More
@@ -542,19 +542,22 b' def get_unique_push_path(action, repo, u' | |||||
542 | return dests[0] |
|
542 | return dests[0] | |
543 |
|
543 | |||
544 |
|
544 | |||
545 |
def get_unique_pull_path(action |
|
545 | def get_unique_pull_path_obj(action, ui, source=None): | |
546 |
"""return a unique `( |
|
546 | """return a unique `(path, branch)` or abort if multiple are found | |
547 |
|
547 | |||
548 | This is useful for command and action that does not support multiple |
|
548 | This is useful for command and action that does not support multiple | |
549 | destination (yet). |
|
549 | destination (yet). | |
550 |
|
550 | |||
551 | The `action` parameter will be used for the error message. |
|
551 | The `action` parameter will be used for the error message. | |
|
552 | ||||
|
553 | note: Ideally, this function would be called `get_unique_pull_path` to | |||
|
554 | mirror the `get_unique_push_path`, but the name was already taken. | |||
552 | """ |
|
555 | """ | |
553 | sources = [] |
|
556 | sources = [] | |
554 | if source is not None: |
|
557 | if source is not None: | |
555 | sources.append(source) |
|
558 | sources.append(source) | |
556 |
|
559 | |||
557 |
pull_paths = list(get_pull_paths( |
|
560 | pull_paths = list(get_pull_paths(None, ui, sources=sources)) | |
558 | path_count = len(pull_paths) |
|
561 | path_count = len(pull_paths) | |
559 | if path_count != 1: |
|
562 | if path_count != 1: | |
560 | if source is None: |
|
563 | if source is None: | |
@@ -566,7 +569,16 b' def get_unique_pull_path(action, repo, u' | |||||
566 | msg = _(b"path points to %d urls while %s only supports one: %s") |
|
569 | msg = _(b"path points to %d urls while %s only supports one: %s") | |
567 | msg %= (path_count, action, source) |
|
570 | msg %= (path_count, action, source) | |
568 | raise error.Abort(msg) |
|
571 | raise error.Abort(msg) | |
569 | return parseurl(pull_paths[0].rawloc, default_branches) |
|
572 | return pull_paths[0] | |
|
573 | ||||
|
574 | ||||
|
575 | def get_unique_pull_path(action, repo, ui, source=None, default_branches=()): | |||
|
576 | """return a unique `(url, branch)` or abort if multiple are found | |||
|
577 | ||||
|
578 | See `get_unique_pull_path_obj` for details. | |||
|
579 | """ | |||
|
580 | path = get_unique_pull_path_obj(action, ui, source=source) | |||
|
581 | return parseurl(path.rawloc, default_branches) | |||
570 |
|
582 | |||
571 |
|
583 | |||
572 | def get_clone_path(ui, source, default_branches=()): |
|
584 | def get_clone_path(ui, source, default_branches=()): |
General Comments 0
You need to be logged in to leave comments.
Login now