comparison mercurial/patch.py @ 14218:202ff575d49b

patch: fix clash between local variable and exception instance The local err variable would be bound to PatchError thrown and it keeps this value even after the except block is executed. The whole thing worked anyway since the rejected variable is set in the except block and this makes the function return -1 when a PatchError is thrown.
author Martin Geisler <mg@aragost.com>
date Fri, 06 May 2011 11:31:40 +0200
parents 71d5287351e9
children 8abe4db2d162
comparison
equal deleted inserted replaced
14217:71d5287351e9 14218:202ff575d49b
1130 try: 1130 try:
1131 current_file, missing = selectfile(afile, bfile, 1131 current_file, missing = selectfile(afile, bfile,
1132 first_hunk, strip) 1132 first_hunk, strip)
1133 current_file = patcher(ui, current_file, opener, 1133 current_file = patcher(ui, current_file, opener,
1134 missing=missing, eolmode=eolmode) 1134 missing=missing, eolmode=eolmode)
1135 except PatchError, err: 1135 except PatchError, inst:
1136 ui.warn(str(err) + '\n') 1136 ui.warn(str(inst) + '\n')
1137 current_file = None 1137 current_file = None
1138 rejects += 1 1138 rejects += 1
1139 continue 1139 continue
1140 elif state == 'git': 1140 elif state == 'git':
1141 for gp in values: 1141 for gp in values: