changeset 35572:8b729856ca03

obsolete: use context manager for transaction in createmarkers() Differential Revision: https://phab.mercurial-scm.org/D1835
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 10 Jan 2018 10:30:51 -0800
parents 265cd9e19d26
children 5574629d5d45
files mercurial/obsolete.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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()