Patchwork D10714: transaction: trivial refactoring

login
register
mail settings
Submitter phabricator
Date May 16, 2021, 7:31 p.m.
Message ID <differential-rev-PHID-DREV-hooqyjguoe5mpcazg7ex-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49033/
State Superseded
Headers show

Comments

phabricator - May 16, 2021, 7:31 p.m.
valentin.gatienbaron created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/transaction.py

CHANGE DETAILS




To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -720,9 +720,8 @@ 
     entries = []
     backupentries = []
 
-    fp = opener.open(file)
-    lines = fp.readlines()
-    fp.close()
+    with opener.open(file) as fp:
+        lines = fp.readlines()
     for l in lines:
         try:
             f, o = l.split(b'\0')