obsolete: use context manager for transaction in createmarkers()
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 10 Jan 2018 10:30:51 -0800
changeset 35572 8b729856ca03
parent 35571 265cd9e19d26
child 35573 5574629d5d45
obsolete: use context manager for transaction in createmarkers() Differential Revision: https://phab.mercurial-scm.org/D1835
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Fri Jan 05 09:12:08 2018 +0100
+++ b/mercurial/obsolete.py	Wed Jan 10 10:30:51 2018 -0800
@@ -1081,8 +1081,7 @@
     saveeffectflag = repo.ui.configbool('experimental',
                                         'evolution.effect-flags')
 
-    tr = repo.transaction('add-obsolescence-marker')
-    try:
+    with repo.transaction('add-obsolescence-marker') as tr:
         markerargs = []
         for rel in relations:
             prec = rel[0]
@@ -1123,6 +1122,3 @@
                                  date=date, metadata=localmetadata,
                                  ui=repo.ui)
             repo.filteredrevcache.clear()
-        tr.close()
-    finally:
-        tr.release()