diff mercurial/hg.py @ 7935:39566bb99a9c

on clone failure, only remove directories we created If the user created the clone target directory before running the clone command, only cleanup the .hg/ repository when errors occur. Leave the empty target directory in place.
author Steve Borho <steve@borho.org>
date Tue, 31 Mar 2009 21:21:53 -0500
parents a218ba5f60df
children 496ae1ea4698
line wrap: on
line diff
--- a/mercurial/hg.py	Thu Apr 02 18:04:42 2009 +0200
+++ b/mercurial/hg.py	Tue Mar 31 21:21:53 2009 -0500
@@ -168,10 +168,14 @@
                 copy = False
 
         if copy:
+            hgdir = os.path.realpath(os.path.join(dest, ".hg"))
             if not os.path.exists(dest):
                 os.mkdir(dest)
+            else:
+                # only clean up directories we create ourselves
+                dir_cleanup.dir_ = hgdir
             try:
-                dest_path = os.path.realpath(os.path.join(dest, ".hg"))
+                dest_path = hgdir
                 os.mkdir(dest_path)
             except OSError, inst:
                 if inst.errno == errno.EEXIST: