mercurial/streamclone.py
changeset 40339 f0e8f27768eb
parent 40338 af62936c2508
child 40398 0ac794e0e285
equal deleted inserted replaced
40338:af62936c2508 40339:f0e8f27768eb
    14 from .i18n import _
    14 from .i18n import _
    15 from . import (
    15 from . import (
    16     branchmap,
    16     branchmap,
    17     cacheutil,
    17     cacheutil,
    18     error,
    18     error,
       
    19     narrowspec,
    19     phases,
    20     phases,
    20     pycompat,
    21     pycompat,
    21     repository,
    22     repository,
    22     store,
    23     store,
    23     util,
    24     util,
   192         return repo.ui.configbool('server', 'uncompressedallowsecret')
   193         return repo.ui.configbool('server', 'uncompressedallowsecret')
   193 
   194 
   194     return True
   195     return True
   195 
   196 
   196 # This is it's own function so extensions can override it.
   197 # This is it's own function so extensions can override it.
   197 def _walkstreamfiles(repo):
   198 def _walkstreamfiles(repo, matcher=None):
   198     return repo.store.walk()
   199     return repo.store.walk(matcher)
   199 
   200 
   200 def generatev1(repo):
   201 def generatev1(repo):
   201     """Emit content for version 1 of a streaming clone.
   202     """Emit content for version 1 of a streaming clone.
   202 
   203 
   203     This returns a 3-tuple of (file count, byte size, data iterator).
   204     This returns a 3-tuple of (file count, byte size, data iterator).
   551     with repo.lock():
   552     with repo.lock():
   552 
   553 
   553         entries = []
   554         entries = []
   554         totalfilesize = 0
   555         totalfilesize = 0
   555 
   556 
       
   557         matcher = None
       
   558         if includes or excludes:
       
   559             matcher = narrowspec.match(repo.root, includes, excludes)
       
   560 
   556         repo.ui.debug('scanning\n')
   561         repo.ui.debug('scanning\n')
   557         for name, ename, size in _walkstreamfiles(repo):
   562         for name, ename, size in _walkstreamfiles(repo, matcher):
   558             if size:
   563             if size:
   559                 entries.append((_srcstore, name, _fileappend, size))
   564                 entries.append((_srcstore, name, _fileappend, size))
   560                 totalfilesize += size
   565                 totalfilesize += size
   561         for name in _walkstreamfullstorefiles(repo):
   566         for name in _walkstreamfullstorefiles(repo):
   562             if repo.svfs.exists(name):
   567             if repo.svfs.exists(name):