Mercurial > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/streamclone.py Fri Jan 15 13:14:50 2016 -0800 +++ b/mercurial/streamclone.py Fri Jan 15 13:14:50 2016 -0800 @@ -186,15 +186,12 @@ entries = [] total_bytes = 0 # Get consistent snapshot of repo, lock during scan. - lock = repo.lock() - try: + with repo.lock(): repo.ui.debug('scanning\n') for name, ename, size in _walkstreamfiles(repo): if size: entries.append((name, size)) total_bytes += size - finally: - lock.release() repo.ui.debug('%d files, %d bytes to transfer\n' % (len(entries), total_bytes))