[Commented On] D10850: clone: use "official" API to create local clone destination

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Tue Jun 15 14:25:35 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 28572.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10850?vs=28527&id=28572

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10850/new/

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

AFFECTED FILES
  mercurial/hg.py
  tests/test-empty.t
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -111,6 +111,7 @@
   reposetup called for a
   ui == repo.ui
   uipopulate called (1 times)
+  uipopulate called (1 times)
   reposetup called for b
   ui == repo.ui
   updating to branch default
diff --git a/tests/test-empty.t b/tests/test-empty.t
--- a/tests/test-empty.t
+++ b/tests/test-empty.t
@@ -48,6 +48,7 @@
   hgrc
   requires
   store
+  wcache
 
 Should be empty:
 
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -857,20 +857,17 @@
 
         if copy:
             srcrepo.hook(b'preoutgoing', throw=True, source=b'clone')
-            hgdir = os.path.realpath(os.path.join(dest, b".hg"))
-            if not os.path.exists(dest):
-                util.makedirs(dest)
-            try:
-                destpath = hgdir
-                util.makedir(destpath, notindexed=True)
-            except OSError as inst:
-                if inst.errno == errno.EEXIST:
-                    cleandir = None
-                    raise error.Abort(
-                        _(b"destination '%s' already exists") % dest
-                    )
-                raise
 
+            destrootpath = urlutil.urllocalpath(dest)
+            dest_reqs = localrepo.clone_requirements(ui, createopts, srcrepo)
+            localrepo.createrepository(
+                ui,
+                destrootpath,
+                requirements=dest_reqs,
+            )
+            destrepo = localrepo.makelocalrepository(ui, destrootpath)
+
+            destpath = destrepo.vfs.base
             destlock = copystore(ui, srcrepo, destpath)
             # copy bookmarks over
             srcbookmarks = srcrepo.vfs.join(b'bookmarks')



To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210615/0da25661/attachment-0002.html>


More information about the Mercurial-patches mailing list