mercurial/hg.py
changeset 7935 39566bb99a9c
parent 7927 a218ba5f60df
child 8109 496ae1ea4698
--- 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: