# HG changeset patch # User Pierre-Yves David # Date 1669996914 -3600 # Node ID 0d7ecac8b6f76d02efd4cabc483e25837cc0781a # Parent 5f36784c300f95c55dbccbdaf1b255a3230cd94f path: pass `path` to `peer` in `hg clone` We directly use the `path` object to build the `peer` object. diff -r 5f36784c300f -r 0d7ecac8b6f7 mercurial/hg.py --- 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)