##// END OF EJS Templates
local-clone: extract the closure copying caches...
marmoute -
r32492:963de566 default
parent child Browse files
Show More
@@ -409,6 +409,17 b' def clonewithshare(ui, peeropts, sharepa'
409
409
410 return srcpeer, peer(ui, peeropts, dest)
410 return srcpeer, peer(ui, peeropts, dest)
411
411
412 # Recomputing branch cache might be slow on big repos,
413 # so just copy it
414 def _copycache(srcrepo, dstcachedir, fname):
415 """copy a cache from srcrepo to destcachedir (if it exists)"""
416 srcbranchcache = srcrepo.vfs.join('cache/%s' % fname)
417 dstbranchcache = os.path.join(dstcachedir, fname)
418 if os.path.exists(srcbranchcache):
419 if not os.path.exists(dstcachedir):
420 os.mkdir(dstcachedir)
421 util.copyfile(srcbranchcache, dstbranchcache)
422
412 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
423 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
413 update=True, stream=False, branch=None, shareopts=None):
424 update=True, stream=False, branch=None, shareopts=None):
414 """Make a copy of an existing repository.
425 """Make a copy of an existing repository.
@@ -566,22 +577,12 b' def clone(ui, peeropts, source, dest=Non'
566 if os.path.exists(srcbookmarks):
577 if os.path.exists(srcbookmarks):
567 util.copyfile(srcbookmarks, dstbookmarks)
578 util.copyfile(srcbookmarks, dstbookmarks)
568
579
569 # Recomputing branch cache might be slow on big repos,
570 # so just copy it
571 def copybranchcache(fname):
572 srcbranchcache = srcrepo.vfs.join('cache/%s' % fname)
573 dstbranchcache = os.path.join(dstcachedir, fname)
574 if os.path.exists(srcbranchcache):
575 if not os.path.exists(dstcachedir):
576 os.mkdir(dstcachedir)
577 util.copyfile(srcbranchcache, dstbranchcache)
578
579 dstcachedir = os.path.join(destpath, 'cache')
580 dstcachedir = os.path.join(destpath, 'cache')
580 # In local clones we're copying all nodes, not just served
581 # In local clones we're copying all nodes, not just served
581 # ones. Therefore copy all branch caches over.
582 # ones. Therefore copy all branch caches over.
582 copybranchcache('branch2')
583 _copycache(srcrepo, dstcachedir, 'branch2')
583 for cachename in repoview.filtertable:
584 for cachename in repoview.filtertable:
584 copybranchcache('branch2-%s' % cachename)
585 _copycache(srcrepo, dstcachedir, 'branch2-%s' % cachename)
585
586
586 # we need to re-init the repo after manually copying the data
587 # we need to re-init the repo after manually copying the data
587 # into it
588 # into it
General Comments 0
You need to be logged in to leave comments. Login now