# HG changeset patch # User Pierre-Yves David # Date 2022-12-02 16:01:54 # 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 --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -702,10 +702,18 @@ def clone( """ 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 @@ def clone( 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)