Mercurial > hg
changeset 6901:43a817f3a649
streamclone: fold in localrepo.storefiles
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Wed, 13 Aug 2008 20:18:44 -0500 |
parents | def492d1b592 |
children | 93f761c25dea |
files | mercurial/localrepo.py mercurial/streamclone.py |
diffstat | 2 files changed, 12 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Wed Aug 13 20:18:43 2008 -0500 +++ b/mercurial/localrepo.py Wed Aug 13 20:18:44 2008 -0500 @@ -2054,25 +2054,6 @@ return self.stream_in(remote) return self.pull(remote, heads) - def storefiles(self): - '''get all *.i and *.d files in the store - - Returns (list of (filename, size), total_bytes)''' - - lock = None - try: - self.ui.debug('scanning\n') - entries = [] - total_bytes = 0 - # get consistent snapshot of repo, lock during scan - lock = self.lock() - for name, ename, size in self.store.walk(): - entries.append((name, size)) - total_bytes += size - return entries, total_bytes - finally: - del lock - # used to avoid circular references so destructors work def aftertrans(files): renamefiles = [tuple(t) for t in files]
--- a/mercurial/streamclone.py Wed Aug 13 20:18:43 2008 -0500 +++ b/mercurial/streamclone.py Wed Aug 13 20:18:44 2008 -0500 @@ -31,8 +31,19 @@ fileobj.write('1\n') return + entries = [] + total_bytes = 0 try: - entries, total_bytes = repo.storefiles() + l = None + try: + repo.ui.debug('scanning\n') + # get consistent snapshot of repo, lock during scan + l = repo.lock() + for name, ename, size in repo.store.walk(): + entries.append((name, size)) + total_bytes += size + finally: + del l except (lock.LockHeld, lock.LockUnavailable), inst: repo.ui.warn('locking the repository failed: %s\n' % (inst,)) fileobj.write('2\n')