changeset 3849:972d14a5a227

don't use localrepo.__init__ to create the dest repo with clone+hardlinks
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 10 Dec 2006 00:06:43 +0100
parents 2aef481ac73c
children a4457828ca1a
files mercurial/hg.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Tue Dec 05 23:25:28 2006 +0100
+++ b/mercurial/hg.py	Sun Dec 10 00:06:43 2006 +0100
@@ -127,15 +127,13 @@
             if self.dir_:
                 self.rmtree(self.dir_, True)
 
-    dest_repo = repository(ui, dest, create=True)
-
     dir_cleanup = None
-    if dest_repo.local():
-        dir_cleanup = DirCleanup(os.path.realpath(dest_repo.root))
+    if islocal(dest):
+        dir_cleanup = DirCleanup(dest)
 
     abspath = source
     copy = False
-    if src_repo.local() and dest_repo.local():
+    if src_repo.local() and islocal(dest):
         abspath = os.path.abspath(source)
         copy = not pull and not rev
 
@@ -153,7 +151,11 @@
     if copy:
         # we lock here to avoid premature writing to the target
         src_store = os.path.realpath(src_repo.spath)
-        dest_store = os.path.realpath(dest_repo.spath)
+        dest_path = os.path.realpath(os.path.join(dest, ".hg"))
+        dest_store = dest_path
+        if not os.path.exists(dest):
+            os.mkdir(dest)
+        os.mkdir(dest_path)
         dest_lock = lock.lock(os.path.join(dest_store, "lock"))
 
         files = ("data",
@@ -173,6 +175,8 @@
         dest_repo = repository(ui, dest)
 
     else:
+        dest_repo = repository(ui, dest, create=True)
+
         revs = None
         if rev:
             if 'lookup' not in src_repo.capabilities: