changeset 47307:13dd5bb5492a

transaction: trivial refactoring Differential Revision: https://phab.mercurial-scm.org/D10714
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
date Sun, 16 May 2021 10:57:14 -0400
parents aa07bcc4f505
children bb4606f35d37
files mercurial/transaction.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/transaction.py	Tue May 18 23:36:21 2021 -0400
+++ b/mercurial/transaction.py	Sun May 16 10:57:14 2021 -0400
@@ -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')