# HG changeset patch # User Matt Mackall # Date 2008-08-14 01:18:44 # Node ID 43a817f3a64905d447885342f39418268ba4e57d # Parent def492d1b59202b8dea5089b0c24cfeca4d3ac96 streamclone: fold in localrepo.storefiles diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2054,25 +2054,6 @@ class localrepository(repo.repository): 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] diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -31,8 +31,19 @@ def stream_out(repo, fileobj, untrusted= 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')