Mercurial > hg
changeset 27875:add2ba16430e
with: use context manager for transaction in strip
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:49 -0800 |
parents | 4ff0e2347ae6 |
children | 602add6ad9e5 |
files | mercurial/repair.py |
diffstat | 1 files changed, 3 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/repair.py Fri Jan 15 13:14:49 2016 -0800 +++ b/mercurial/repair.py Fri Jan 15 13:14:49 2016 -0800 @@ -185,15 +185,11 @@ # silence internal shuffling chatter repo.ui.pushbuffer() if isinstance(gen, bundle2.unbundle20): - tr = repo.transaction('strip') - tr.hookargs = {'source': 'strip', - 'url': 'bundle:' + vfs.join(chgrpfile)} - try: + with repo.transaction('strip') as tr: + tr.hookargs = {'source': 'strip', + 'url': 'bundle:' + vfs.join(chgrpfile)} bundle2.applybundle(repo, gen, tr, source='strip', url='bundle:' + vfs.join(chgrpfile)) - tr.close() - finally: - tr.release() else: gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True) if not repo.ui.verbose: