##// END OF EJS Templates
caches: make 'cachetocopy' available in scmutil...
Boris Feld -
r35784:72fdd99e default
parent child Browse files
Show More
@@ -0,0 +1,21 b''
1 # scmutil.py - Mercurial core utility functions
2 #
3 # Copyright Matt Mackall <mpm@selenic.com> and other
4 #
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
7 from __future__ import absolute_import
8
9 from . import repoview
10
11 def cachetocopy(srcrepo):
12 """return the list of cache file valuable to copy during a clone"""
13 # In local clones we're copying all nodes, not just served
14 # ones. Therefore copy all branch caches over.
15 cachefiles = ['branch2']
16 cachefiles += ['branch2-%s' % f for f in repoview.filtertable]
17 cachefiles += ['rbc-names-v1', 'rbc-revs-v1']
18 cachefiles += ['tags2']
19 cachefiles += ['tags2-%s' % f for f in repoview.filtertable]
20 cachefiles += ['hgtagsfnodes1']
21 return cachefiles
@@ -21,6 +21,7 b' from .node import ('
21 21 from . import (
22 22 bookmarks,
23 23 bundlerepo,
24 cacheutil,
24 25 cmdutil,
25 26 destutil,
26 27 discovery,
@@ -34,7 +35,6 b' from . import ('
34 35 merge as mergemod,
35 36 node,
36 37 phases,
37 repoview,
38 38 scmutil,
39 39 sshpeer,
40 40 statichttprepo,
@@ -459,18 +459,6 b' def _copycache(srcrepo, dstcachedir, fna'
459 459 os.mkdir(dstcachedir)
460 460 util.copyfile(srcbranchcache, dstbranchcache)
461 461
462 def _cachetocopy(srcrepo):
463 """return the list of cache file valuable to copy during a clone"""
464 # In local clones we're copying all nodes, not just served
465 # ones. Therefore copy all branch caches over.
466 cachefiles = ['branch2']
467 cachefiles += ['branch2-%s' % f for f in repoview.filtertable]
468 cachefiles += ['rbc-names-v1', 'rbc-revs-v1']
469 cachefiles += ['tags2']
470 cachefiles += ['tags2-%s' % f for f in repoview.filtertable]
471 cachefiles += ['hgtagsfnodes1']
472 return cachefiles
473
474 462 def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
475 463 update=True, stream=False, branch=None, shareopts=None):
476 464 """Make a copy of an existing repository.
@@ -629,7 +617,7 b' def clone(ui, peeropts, source, dest=Non'
629 617 util.copyfile(srcbookmarks, dstbookmarks)
630 618
631 619 dstcachedir = os.path.join(destpath, 'cache')
632 for cache in _cachetocopy(srcrepo):
620 for cache in cacheutil.cachetocopy(srcrepo):
633 621 _copycache(srcrepo, dstcachedir, cache)
634 622
635 623 # we need to re-init the repo after manually copying the data
General Comments 0
You need to be logged in to leave comments. Login now