comparison mercurial/streamclone.py @ 27845:7417e1c10253

with: use context manager in streamclone generatev1
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:50 -0800
parents 9a1f3f9bac5d
children 49cfddbf54ba
comparison
equal deleted inserted replaced
27844:469b86c49503 27845:7417e1c10253
184 the store is captured. It therefore may raise LockError. 184 the store is captured. It therefore may raise LockError.
185 """ 185 """
186 entries = [] 186 entries = []
187 total_bytes = 0 187 total_bytes = 0
188 # Get consistent snapshot of repo, lock during scan. 188 # Get consistent snapshot of repo, lock during scan.
189 lock = repo.lock() 189 with repo.lock():
190 try:
191 repo.ui.debug('scanning\n') 190 repo.ui.debug('scanning\n')
192 for name, ename, size in _walkstreamfiles(repo): 191 for name, ename, size in _walkstreamfiles(repo):
193 if size: 192 if size:
194 entries.append((name, size)) 193 entries.append((name, size))
195 total_bytes += size 194 total_bytes += size
196 finally:
197 lock.release()
198 195
199 repo.ui.debug('%d files, %d bytes to transfer\n' % 196 repo.ui.debug('%d files, %d bytes to transfer\n' %
200 (len(entries), total_bytes)) 197 (len(entries), total_bytes))
201 198
202 svfs = repo.svfs 199 svfs = repo.svfs