changeset 27865:f6979b8f33c1

with: use context manager for transaction in qimport
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:47 -0800
parents 4b8e3ffee94f
children f54bf1f41566
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
@@ -2079,8 +2079,7 @@
                 lastparent = None
 
             diffopts = self.diffopts({'git': git})
-            tr = repo.transaction('qimport')
-            try:
+            with repo.transaction('qimport') as tr:
                 for r in rev:
                     if not repo[r].mutable():
                         raise error.Abort(_('revision %d is not mutable') % r,
@@ -2121,9 +2120,6 @@
                     self.parseseries()
                     self.applieddirty = True
                     self.seriesdirty = True
-                tr.close()
-            finally:
-                tr.release()
 
         for i, filename in enumerate(files):
             if existing: