hgext/shelve.py
changeset 27775 3ea35a0769fe
parent 27694 2dc363274702
child 27834 476f53058ee8
--- a/hgext/shelve.py	Tue Jan 12 14:31:02 2016 -0800
+++ b/hgext/shelve.py	Tue Jan 12 14:47:21 2016 -0800
@@ -424,8 +424,7 @@
         ui.write(age, label='shelve.age')
         ui.write(' ' * (12 - len(age)))
         used += 12
-        fp = open(name + '.patch', 'rb')
-        try:
+        with open(name + '.patch', 'rb') as fp:
             while True:
                 line = fp.readline()
                 if not line:
@@ -447,8 +446,6 @@
                 for chunk, label in patch.diffstatui(difflines, width=width,
                                                      git=True):
                     ui.write(chunk, label=label)
-        finally:
-            fp.close()
 
 def singlepatchcmds(ui, repo, pats, opts, subcommand):
     """subcommand that displays a single shelf"""