comparison mercurial/wireproto.py @ 19176:aae14b3d0a9c

clone: move file stream walk to a separate function Moves the file walk out of the stream method so that extensions can override it. This allows an extension to decide what files should be streamed, and in particular allows a stream without filelogs.
author Durham Goode <durham@fb.com>
date Wed, 01 May 2013 10:38:41 -0700
parents 6b618aa08b6e
children 309c439cdbaa
comparison
equal deleted inserted replaced
19175:63f7bd2e1a46 19176:aae14b3d0a9c
521 return '%s\n' % int(r) 521 return '%s\n' % int(r)
522 522
523 def _allowstream(ui): 523 def _allowstream(ui):
524 return ui.configbool('server', 'uncompressed', True, untrusted=True) 524 return ui.configbool('server', 'uncompressed', True, untrusted=True)
525 525
526 def _walkstreamfiles(repo):
527 # this is it's own function so extensions can override it
528 return repo.store.walk()
529
526 def stream(repo, proto): 530 def stream(repo, proto):
527 '''If the server supports streaming clone, it advertises the "stream" 531 '''If the server supports streaming clone, it advertises the "stream"
528 capability with a value representing the version and flags of the repo 532 capability with a value representing the version and flags of the repo
529 it is serving. Client checks to see if it understands the format. 533 it is serving. Client checks to see if it understands the format.
530 534
542 try: 546 try:
543 # get consistent snapshot of repo, lock during scan 547 # get consistent snapshot of repo, lock during scan
544 lock = repo.lock() 548 lock = repo.lock()
545 try: 549 try:
546 repo.ui.debug('scanning\n') 550 repo.ui.debug('scanning\n')
547 for name, ename, size in repo.store.walk(): 551 for name, ename, size in _walkstreamfiles(repo):
548 if size: 552 if size:
549 entries.append((name, size)) 553 entries.append((name, size))
550 total_bytes += size 554 total_bytes += size
551 finally: 555 finally:
552 lock.release() 556 lock.release()