Patchwork D10418: init: use `get_clone_path` when suitable

login
register
mail settings
Submitter phabricator
Date April 14, 2021, 11:40 p.m.
Message ID <differential-rev-PHID-DREV-nzyznezcxswqkcuol54a-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48736/
State Superseded
Headers show

Comments

phabricator - April 14, 2021, 11:40 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `hg init` has this weird feature were you can refer to `[paths]` entry select the path to initialize. We move that code to the new APIs.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10418

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4375,7 +4375,8 @@ 
     Returns 0 on success.
     """
     opts = pycompat.byteskwargs(opts)
-    peer = hg.peer(ui, opts, ui.expandpath(dest), create=True)
+    path = urlutil.get_clone_path(ui, dest)[1]
+    peer = hg.peer(ui, opts, path, create=True)
     peer.close()