[PATCH 2 of 2] clone: save hardlink state of util.copyfiles()
Adrian Buehlmann
adrian at cadifra.com
Fri May 28 11:15:10 CDT 2010
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1275060514 -7200
# Node ID 5d6be3ebcd61da43093ad53ab91d5aa3422d9858
# Parent 28b2dffa519466fc93bcd6fd5746ebdce5bec21a
clone: save hardlink state of util.copyfiles()
When trying to do hardlink-cloning, the os_link() call of the
first file tried already fails on Windows, if the source is on a
UNC path.
This change avoids calling os_link() for the rest of files, leaving
us with a *single* failed os_link() call per clone operation, if the
source can't do hardlinks.
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -277,6 +277,7 @@ def clone(ui, source, dest=None, pull=Fa
% dest)
raise
+ hardlink = None
for f in src_repo.store.copylist():
src = os.path.join(src_repo.sharedpath, f)
dst = os.path.join(dest_path, f)
@@ -287,7 +288,7 @@ def clone(ui, source, dest=None, pull=Fa
if dst.endswith('data'):
# lock to avoid premature writing to the target
dest_lock = lock.lock(os.path.join(dstbase, "lock"))
- util.copyfiles(src, dst)
+ hardlink = util.copyfiles(src, dst, hardlink)
# we need to re-init the repo after manually copying the data
# into it
More information about the Mercurial-devel
mailing list