Show More
@@ -381,31 +381,30 b' def copystore(ui, srcrepo, destpath):' | |||||
381 | try: |
|
381 | try: | |
382 | hardlink = None |
|
382 | hardlink = None | |
383 | topic = _('linking') if hardlink else _('copying') |
|
383 | topic = _('linking') if hardlink else _('copying') | |
384 |
|
|
384 | with ui.makeprogress(topic) as progress: | |
385 | num = 0 |
|
385 | num = 0 | |
386 | srcpublishing = srcrepo.publishing() |
|
386 | srcpublishing = srcrepo.publishing() | |
387 | srcvfs = vfsmod.vfs(srcrepo.sharedpath) |
|
387 | srcvfs = vfsmod.vfs(srcrepo.sharedpath) | |
388 | dstvfs = vfsmod.vfs(destpath) |
|
388 | dstvfs = vfsmod.vfs(destpath) | |
389 | for f in srcrepo.store.copylist(): |
|
389 | for f in srcrepo.store.copylist(): | |
390 | if srcpublishing and f.endswith('phaseroots'): |
|
390 | if srcpublishing and f.endswith('phaseroots'): | |
391 | continue |
|
391 | continue | |
392 | dstbase = os.path.dirname(f) |
|
392 | dstbase = os.path.dirname(f) | |
393 | if dstbase and not dstvfs.exists(dstbase): |
|
393 | if dstbase and not dstvfs.exists(dstbase): | |
394 | dstvfs.mkdir(dstbase) |
|
394 | dstvfs.mkdir(dstbase) | |
395 | if srcvfs.exists(f): |
|
395 | if srcvfs.exists(f): | |
396 | if f.endswith('data'): |
|
396 | if f.endswith('data'): | |
397 | # 'dstbase' may be empty (e.g. revlog format 0) |
|
397 | # 'dstbase' may be empty (e.g. revlog format 0) | |
398 | lockfile = os.path.join(dstbase, "lock") |
|
398 | lockfile = os.path.join(dstbase, "lock") | |
399 | # lock to avoid premature writing to the target |
|
399 | # lock to avoid premature writing to the target | |
400 | destlock = lock.lock(dstvfs, lockfile) |
|
400 | destlock = lock.lock(dstvfs, lockfile) | |
401 | hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f), |
|
401 | hardlink, n = util.copyfiles(srcvfs.join(f), dstvfs.join(f), | |
402 | hardlink, progress) |
|
402 | hardlink, progress) | |
403 | num += n |
|
403 | num += n | |
404 | if hardlink: |
|
404 | if hardlink: | |
405 | ui.debug("linked %d files\n" % num) |
|
405 | ui.debug("linked %d files\n" % num) | |
406 | else: |
|
406 | else: | |
407 | ui.debug("copied %d files\n" % num) |
|
407 | ui.debug("copied %d files\n" % num) | |
408 | progress.complete() |
|
|||
409 | return destlock |
|
408 | return destlock | |
410 | except: # re-raises |
|
409 | except: # re-raises | |
411 | release(destlock) |
|
410 | release(destlock) |
General Comments 0
You need to be logged in to leave comments.
Login now