[Updated] D10840: clone: cleanup the "cleanup dir" logic used during local clone

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Jun 17 13:30:41 UTC 2021


Closed by commit rHG1c7f3d911d0f: clone: cleanup the "cleanup dir" logic used during local clone (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10840?vs=28517&id=28588

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

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

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -825,7 +825,12 @@
             abspath = os.path.abspath(urlutil.urllocalpath(origsource))
 
         if islocal(dest):
-            cleandir = dest
+            if os.path.exists(dest):
+                # only clean up directories we create ourselves
+                hgdir = os.path.realpath(os.path.join(dest, b".hg"))
+                cleandir = hgdir
+            else:
+                cleandir = dest
 
         copy = False
         if (
@@ -855,9 +860,6 @@
             hgdir = os.path.realpath(os.path.join(dest, b".hg"))
             if not os.path.exists(dest):
                 util.makedirs(dest)
-            else:
-                # only clean up directories we create ourselves
-                cleandir = hgdir
             try:
                 destpath = hgdir
                 util.makedir(destpath, notindexed=True)



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/20210617/ad2b32f8/attachment-0002.html>


More information about the Mercurial-patches mailing list