mercurial/commands.py
changeset 27771 338c9d227a9e
parent 27763 0ac5b7ee5dc2
child 27804 aa41199a74e2
--- a/mercurial/commands.py	Tue Jan 12 14:28:16 2016 -0800
+++ b/mercurial/commands.py	Tue Jan 12 14:28:43 2016 -0800
@@ -2311,8 +2311,7 @@
     serverlogs = opts.get('serverlog')
     if serverlogs:
         for filename in serverlogs:
-            logfile = open(filename, 'r')
-            try:
+            with open(filename, 'r') as logfile:
                 line = logfile.readline()
                 while line:
                     parts = line.strip().split(';')
@@ -2324,9 +2323,6 @@
                     elif op == 'unb':
                         doit(parts[3].split(' '), parts[2].split(' '))
                     line = logfile.readline()
-            finally:
-                logfile.close()
-
     else:
         remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches,
                                                  opts.get('remote_head'))