##// END OF EJS Templates
shelve: use a context manager for file I/O in listcmd
Bryan O'Sullivan -
r27775:3ea35a07 default
parent child Browse files
Show More
@@ -424,8 +424,7 b' def listcmd(ui, repo, pats, opts):'
424 ui.write(age, label='shelve.age')
424 ui.write(age, label='shelve.age')
425 ui.write(' ' * (12 - len(age)))
425 ui.write(' ' * (12 - len(age)))
426 used += 12
426 used += 12
427 fp = open(name + '.patch', 'rb')
427 with open(name + '.patch', 'rb') as fp:
428 try:
429 while True:
428 while True:
430 line = fp.readline()
429 line = fp.readline()
431 if not line:
430 if not line:
@@ -447,8 +446,6 b' def listcmd(ui, repo, pats, opts):'
447 for chunk, label in patch.diffstatui(difflines, width=width,
446 for chunk, label in patch.diffstatui(difflines, width=width,
448 git=True):
447 git=True):
449 ui.write(chunk, label=label)
448 ui.write(chunk, label=label)
450 finally:
451 fp.close()
452
449
453 def singlepatchcmds(ui, repo, pats, opts, subcommand):
450 def singlepatchcmds(ui, repo, pats, opts, subcommand):
454 """subcommand that displays a single shelf"""
451 """subcommand that displays a single shelf"""
General Comments 0
You need to be logged in to leave comments. Login now