changeset 27864:4b8e3ffee94f

with: use context manager for transaction in qfinish
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents ed59ae8b025e
children f6979b8f33c1
files hgext/mq.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/mq.py	Fri Jan 15 13:14:47 2016 -0800
@@ -1041,12 +1041,8 @@
             oldqbase = repo[qfinished[0]]
             tphase = repo.ui.config('phases', 'new-commit', phases.draft)
             if oldqbase.phase() > tphase and oldqbase.p1().phase() <= tphase:
-                tr = repo.transaction('qfinish')
-                try:
+                with repo.transaction('qfinish') as tr:
                     phases.advanceboundary(repo, tr, tphase, qfinished)
-                    tr.close()
-                finally:
-                    tr.release()
 
     def delete(self, repo, patches, opts):
         if not patches and not opts.get('rev'):