Clean up local clone file list
authormpm@selenic.com
Wed, 07 Sep 2005 19:30:23 -0700
changeset 1208 4644df4944ff
parent 1207 a7b8812973d9
child 1209 920682a532df
Clean up local clone file list We now use an explicit list of files to copy during clone so that we don't copy anything we shouldn't.
mercurial/commands.py
--- a/mercurial/commands.py	Wed Sep 07 19:21:38 2005 -0700
+++ b/mercurial/commands.py	Wed Sep 07 19:30:23 2005 -0700
@@ -604,17 +604,17 @@
                     and getattr(os, 'link', None) or shutil.copy2)
         if copyfile is not shutil.copy2:
             ui.note("cloning by hardlink\n")
+
         # we use a lock here because because we're not nicely ordered
         l = lock.lock(os.path.join(source, ".hg", "lock"))
 
-        util.copyfiles(os.path.join(source, ".hg"), os.path.join(dest, ".hg"),
-                      copyfile)
+        os.mkdir(os.path.join(dest, ".hg"))
 
-        for fn in "dirstate", "lock", "hgrc", "localtags":
-            try:
-                os.unlink(os.path.join(dest, ".hg", fn))
-            except OSError:
-                pass
+        files = "data 00manifest.d 00manifest.i 00changelog.d 00changelog.i"
+        for f in files.split():
+            src = os.path.join(source, ".hg", f)
+            dst = os.path.join(dest, ".hg", f)
+            util.copyfiles(src, dst, copyfile)
 
         repo = hg.repository(ui, dest)