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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jan 10 19:22:52 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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
Cc: mercurial-devel


More information about the Mercurial-devel mailing list