##// 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 def changedfiles(ui, repo, patchpath, strip=1):
2100 def changedfiles(ui, repo, patchpath, strip=1):
2101 backend = fsbackend(ui, repo.root)
2101 backend = fsbackend(ui, repo.root)
2102 fp = open(patchpath, 'rb')
2102 with open(patchpath, 'rb') as fp:
2103 try:
2104 changed = set()
2103 changed = set()
2105 for state, values in iterhunks(fp):
2104 for state, values in iterhunks(fp):
2106 if state == 'file':
2105 if state == 'file':
@@ -2118,8 +2117,6 b' def changedfiles(ui, repo, patchpath, st'
2118 elif state not in ('hunk', 'git'):
2117 elif state not in ('hunk', 'git'):
2119 raise error.Abort(_('unsupported parser state: %s') % state)
2118 raise error.Abort(_('unsupported parser state: %s') % state)
2120 return changed
2119 return changed
2121 finally:
2122 fp.close()
2123
2120
2124 class GitDiffRequired(Exception):
2121 class GitDiffRequired(Exception):
2125 pass
2122 pass
General Comments 0
You need to be logged in to leave comments. Login now