diff -r 8ceaaf63ca80 -r 3ea35a0769fe hgext/shelve.py --- 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"""