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

login
register
mail settings
Submitter phabricator
Date Jan. 10, 2018, 7:22 p.m.
Message ID <differential-rev-PHID-DREV-uof4teiwlwwbewul5ytm-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/26640/
State Superseded
Headers show

Comments

phabricator - Jan. 10, 2018, 7:22 p.m.
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




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

Patch

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()