Show More
@@ -278,6 +278,7 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
278 | 278 | raise |
|
279 | 279 | |
|
280 | 280 | hardlink = None |
|
281 | num = 0 | |
|
281 | 282 | for f in src_repo.store.copylist(): |
|
282 | 283 | src = os.path.join(src_repo.sharedpath, f) |
|
283 | 284 | dst = os.path.join(dest_path, f) |
@@ -288,7 +289,12 b' def clone(ui, source, dest=None, pull=Fa' | |||
|
288 | 289 | if dst.endswith('data'): |
|
289 | 290 | # lock to avoid premature writing to the target |
|
290 | 291 | dest_lock = lock.lock(os.path.join(dstbase, "lock")) |
|
291 | hardlink = util.copyfiles(src, dst, hardlink) | |
|
292 | hardlink, n = util.copyfiles(src, dst, hardlink) | |
|
293 | num += n | |
|
294 | if hardlink: | |
|
295 | ui.debug("linked %d files\n" % num) | |
|
296 | else: | |
|
297 | ui.debug("copied %d files\n" % num) | |
|
292 | 298 | |
|
293 | 299 | # we need to re-init the repo after manually copying the data |
|
294 | 300 | # into it |
@@ -453,12 +453,14 b' def copyfiles(src, dst, hardlink=None):' | |||
|
453 | 453 | hardlink = (os.stat(src).st_dev == |
|
454 | 454 | os.stat(os.path.dirname(dst)).st_dev) |
|
455 | 455 | |
|
456 | num = 0 | |
|
456 | 457 | if os.path.isdir(src): |
|
457 | 458 | os.mkdir(dst) |
|
458 | 459 | for name, kind in osutil.listdir(src): |
|
459 | 460 | srcname = os.path.join(src, name) |
|
460 | 461 | dstname = os.path.join(dst, name) |
|
461 | hardlink = copyfiles(srcname, dstname, hardlink) | |
|
462 | hardlink, n = copyfiles(srcname, dstname, hardlink) | |
|
463 | num += n | |
|
462 | 464 | else: |
|
463 | 465 | if hardlink: |
|
464 | 466 | try: |
@@ -468,8 +470,9 b' def copyfiles(src, dst, hardlink=None):' | |||
|
468 | 470 | shutil.copy(src, dst) |
|
469 | 471 | else: |
|
470 | 472 | shutil.copy(src, dst) |
|
473 | num += 1 | |
|
471 | 474 | |
|
472 | return hardlink | |
|
475 | return hardlink, num | |
|
473 | 476 | |
|
474 | 477 | class path_auditor(object): |
|
475 | 478 | '''ensure that a filesystem path contains no banned components. |
General Comments 0
You need to be logged in to leave comments.
Login now