Mercurial > hg
changeset 49745:0d7ecac8b6f7
path: pass `path` to `peer` in `hg clone`
We directly use the `path` object to build the `peer` object.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 02 Dec 2022 17:01:54 +0100 |
parents | 5f36784c300f |
children | 2a5feacc4085 |
files | mercurial/hg.py |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hg.py Fri Dec 02 16:49:54 2022 +0100 +++ b/mercurial/hg.py Fri Dec 02 17:01:54 2022 +0100 @@ -702,10 +702,18 @@ """ if isinstance(source, bytes): - src = urlutil.get_clone_path(ui, source, branch) - origsource, source, branches = src - srcpeer = peer(ui, peeropts, source) + src_path = urlutil.get_clone_path_obj(ui, source) + if src_path is None: + srcpeer = peer(ui, peeropts, b'') + origsource = source = b'' + branches = (None, branch or []) + else: + srcpeer = peer(ui, peeropts, src_path) + origsource = src_path.rawloc + branches = (src_path.branch, branch or []) + source = src_path.loc else: + # XXX path: simply use the peer `path` object when this become available srcpeer = source.peer() # in case we were called with a localrepo branches = (None, branch or []) origsource = source = srcpeer.url() @@ -719,7 +727,11 @@ if dest: ui.status(_(b"destination directory: %s\n") % dest) else: - dest = urlutil.get_clone_path(ui, dest)[0] + dest_path = urlutil.get_clone_path_obj(ui, dest) + if dest_path is not None: + dest = dest_path.rawloc + else: + dest = b'' dest = urlutil.urllocalpath(dest) source = urlutil.urllocalpath(source)