mercurial/hg.py
changeset 32493 3c8a71a8df11
parent 32492 963de566de2f
child 32494 53a67ba9fb44
equal deleted inserted replaced
32492:963de566de2f 32493:3c8a71a8df11
   418     if os.path.exists(srcbranchcache):
   418     if os.path.exists(srcbranchcache):
   419         if not os.path.exists(dstcachedir):
   419         if not os.path.exists(dstcachedir):
   420             os.mkdir(dstcachedir)
   420             os.mkdir(dstcachedir)
   421         util.copyfile(srcbranchcache, dstbranchcache)
   421         util.copyfile(srcbranchcache, dstbranchcache)
   422 
   422 
       
   423 def _cachetocopy(srcrepo):
       
   424     """return the list of cache file valuable to copy during a clone"""
       
   425     # In local clones we're copying all nodes, not just served
       
   426     # ones. Therefore copy all branch caches over.
       
   427     cachefiles = ['branch2']
       
   428     cachefiles.extend('branch2-%s' % f for f in repoview.filtertable)
       
   429     return cachefiles
       
   430 
   423 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
   431 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
   424           update=True, stream=False, branch=None, shareopts=None):
   432           update=True, stream=False, branch=None, shareopts=None):
   425     """Make a copy of an existing repository.
   433     """Make a copy of an existing repository.
   426 
   434 
   427     Create a copy of an existing repository in a new directory.  The
   435     Create a copy of an existing repository in a new directory.  The
   576             dstbookmarks = os.path.join(destpath, 'bookmarks')
   584             dstbookmarks = os.path.join(destpath, 'bookmarks')
   577             if os.path.exists(srcbookmarks):
   585             if os.path.exists(srcbookmarks):
   578                 util.copyfile(srcbookmarks, dstbookmarks)
   586                 util.copyfile(srcbookmarks, dstbookmarks)
   579 
   587 
   580             dstcachedir = os.path.join(destpath, 'cache')
   588             dstcachedir = os.path.join(destpath, 'cache')
   581             # In local clones we're copying all nodes, not just served
   589             for cache in _cachetocopy(srcrepo):
   582             # ones. Therefore copy all branch caches over.
   590                 _copycache(srcrepo, dstcachedir, cache)
   583             _copycache(srcrepo, dstcachedir, 'branch2')
       
   584             for cachename in repoview.filtertable:
       
   585                 _copycache(srcrepo, dstcachedir, 'branch2-%s' % cachename)
       
   586 
   591 
   587             # we need to re-init the repo after manually copying the data
   592             # we need to re-init the repo after manually copying the data
   588             # into it
   593             # into it
   589             destpeer = peer(srcrepo, peeropts, dest)
   594             destpeer = peer(srcrepo, peeropts, dest)
   590             srcrepo.hook('outgoing', source='clone',
   595             srcrepo.hook('outgoing', source='clone',