##// END OF EJS Templates
with: use context manager for I/O in changedfiles in patch
Bryan O'Sullivan -
r27796:f7f3958d default
parent child Browse files
Show More
@@ -2099,8 +2099,7 b' def patch(ui, repo, patchname, strip=1, '
2099 2099
2100 2100 def changedfiles(ui, repo, patchpath, strip=1):
2101 2101 backend = fsbackend(ui, repo.root)
2102 fp = open(patchpath, 'rb')
2103 try:
2102 with open(patchpath, 'rb') as fp:
2104 2103 changed = set()
2105 2104 for state, values in iterhunks(fp):
2106 2105 if state == 'file':
@@ -2118,8 +2117,6 b' def changedfiles(ui, repo, patchpath, st'
2118 2117 elif state not in ('hunk', 'git'):
2119 2118 raise error.Abort(_('unsupported parser state: %s') % state)
2120 2119 return changed
2121 finally:
2122 fp.close()
2123 2120
2124 2121 class GitDiffRequired(Exception):
2125 2122 pass
General Comments 0
You need to be logged in to leave comments. Login now