D1835: obsolete: use context manager for transaction in createmarkers()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jan 10 18:02:30 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8b729856ca03: obsolete: use context manager for transaction in createmarkers() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1835?vs=4755&id=4765

REVISION DETAIL
  https://phab.mercurial-scm.org/D1835

AFFECTED FILES
  mercurial/obsolete.py

CHANGE DETAILS

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -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()



To: martinvonz, #hg-reviewers, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list