diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -278,6 +278,7 @@ def clone(ui, source, dest=None, pull=Fa raise hardlink = None + num = 0 for f in src_repo.store.copylist(): src = os.path.join(src_repo.sharedpath, f) dst = os.path.join(dest_path, f) @@ -288,7 +289,12 @@ 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")) - hardlink = util.copyfiles(src, dst, hardlink) + hardlink, n = util.copyfiles(src, dst, hardlink) + num += n + if hardlink: + ui.debug("linked %d files\n" % num) + else: + ui.debug("copied %d files\n" % num) # we need to re-init the repo after manually copying the data # into it diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -453,12 +453,14 @@ def copyfiles(src, dst, hardlink=None): hardlink = (os.stat(src).st_dev == os.stat(os.path.dirname(dst)).st_dev) + num = 0 if os.path.isdir(src): os.mkdir(dst) for name, kind in osutil.listdir(src): srcname = os.path.join(src, name) dstname = os.path.join(dst, name) - hardlink = copyfiles(srcname, dstname, hardlink) + hardlink, n = copyfiles(srcname, dstname, hardlink) + num += n else: if hardlink: try: @@ -468,8 +470,9 @@ def copyfiles(src, dst, hardlink=None): shutil.copy(src, dst) else: shutil.copy(src, dst) + num += 1 - return hardlink + return hardlink, num class path_auditor(object): '''ensure that a filesystem path contains no banned components.