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

login
register
mail settings
Submitter phabricator
Date Jan. 10, 2018, 11:02 p.m.
Message ID <451a09bcf7a3b69810ac7d8761914969@localhost.localdomain>
Download mbox | patch
Permalink /patch/26648/
State Not Applicable
Headers show

Comments

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




To: martinvonz, #hg-reviewers, durin42
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()