# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:49 # Node ID add2ba16430ea5d31ee26e84e1b4c66dc3a6ee15 # Parent 4ff0e2347ae628990fca868a81a81af22e310219 with: use context manager for transaction in strip diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -185,15 +185,11 @@ def strip(ui, repo, nodelist, backup=Tru # 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: