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