Show More
@@ -227,14 +227,14 b' def patch(patchname, ui, strip=1, cwd=No' | |||||
227 | """apply the patch <patchname> to the working directory. |
|
227 | """apply the patch <patchname> to the working directory. | |
228 | a list of patched files is returned""" |
|
228 | a list of patched files is returned""" | |
229 |
|
229 | |||
230 | (dopatch, gitpatches) = readgitpatch(patchname) |
|
230 | # helper function | |
|
231 | def __patch(patchname): | |||
|
232 | """patch and updates the files and fuzz variables""" | |||
|
233 | files = {} | |||
|
234 | fuzz = False | |||
231 |
|
235 | |||
232 | files = {} |
|
236 | patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), | |
233 | fuzz = False |
|
237 | 'patch') | |
234 | if dopatch: |
|
|||
235 | if dopatch == 'filter': |
|
|||
236 | patchname = dogitpatch(patchname, gitpatches, cwd=cwd) |
|
|||
237 | patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') |
|
|||
238 | args = [] |
|
238 | args = [] | |
239 | if cwd: |
|
239 | if cwd: | |
240 | args.append('-d %s' % util.shellquote(cwd)) |
|
240 | args.append('-d %s' % util.shellquote(cwd)) | |
@@ -261,14 +261,24 b' def patch(patchname, ui, strip=1, cwd=No' | |||||
261 | ui.warn(pf + '\n') |
|
261 | ui.warn(pf + '\n') | |
262 | printed_file = True |
|
262 | printed_file = True | |
263 | ui.warn(line + '\n') |
|
263 | ui.warn(line + '\n') | |
264 |
|
||||
265 | if dopatch == 'filter': |
|
|||
266 | os.unlink(patchname) |
|
|||
267 |
|
||||
268 | code = fp.close() |
|
264 | code = fp.close() | |
269 | if code: |
|
265 | if code: | |
270 | raise util.Abort(_("patch command failed: %s") % |
|
266 | raise util.Abort(_("patch command failed: %s") % | |
271 | util.explain_exit(code)[0]) |
|
267 | util.explain_exit(code)[0]) | |
|
268 | return files, fuzz | |||
|
269 | ||||
|
270 | (dopatch, gitpatches) = readgitpatch(patchname) | |||
|
271 | ||||
|
272 | if dopatch: | |||
|
273 | if dopatch == 'filter': | |||
|
274 | patchname = dogitpatch(patchname, gitpatches, cwd=cwd) | |||
|
275 | try: | |||
|
276 | files, fuzz = __patch(patchname) | |||
|
277 | finally: | |||
|
278 | if dopatch == 'filter': | |||
|
279 | os.unlink(patchname) | |||
|
280 | else: | |||
|
281 | files, fuzz = {}, False | |||
272 |
|
282 | |||
273 | for gp in gitpatches: |
|
283 | for gp in gitpatches: | |
274 | files[gp.path] = (gp.op, gp) |
|
284 | files[gp.path] = (gp.op, gp) |
General Comments 0
You need to be logged in to leave comments.
Login now