##// END OF EJS Templates
patch: minor cleanup of _applydiff
Mads Kiilerich -
r11021:c47a1cfa default
parent child Browse files
Show More
@@ -1153,8 +1153,8 b' def _applydiff(ui, fp, patcher, copyfn, '
1153 rejects = 0
1153 rejects = 0
1154 err = 0
1154 err = 0
1155 current_file = None
1155 current_file = None
1156 gitpatches = None
1156 cwd = os.getcwd()
1157 opener = util.opener(os.getcwd())
1157 opener = util.opener(cwd)
1158
1158
1159 def closefile():
1159 def closefile():
1160 if not current_file:
1160 if not current_file:
@@ -1166,8 +1166,7 b' def _applydiff(ui, fp, patcher, copyfn, '
1166 if state == 'hunk':
1166 if state == 'hunk':
1167 if not current_file:
1167 if not current_file:
1168 continue
1168 continue
1169 current_hunk = values
1169 ret = current_file.apply(values)
1170 ret = current_file.apply(current_hunk)
1171 if ret >= 0:
1170 if ret >= 0:
1172 changed.setdefault(current_file.fname, None)
1171 changed.setdefault(current_file.fname, None)
1173 if ret > 0:
1172 if ret > 0:
@@ -1186,13 +1185,11 b' def _applydiff(ui, fp, patcher, copyfn, '
1186 missing=missing, eolmode=eolmode)
1185 missing=missing, eolmode=eolmode)
1187 except PatchError, err:
1186 except PatchError, err:
1188 ui.warn(str(err) + '\n')
1187 ui.warn(str(err) + '\n')
1189 current_file, current_hunk = None, None
1188 current_file = None
1190 rejects += 1
1189 rejects += 1
1191 continue
1190 continue
1192 elif state == 'git':
1191 elif state == 'git':
1193 gitpatches = values
1192 for gp in values:
1194 cwd = os.getcwd()
1195 for gp in gitpatches:
1196 if gp.op in ('COPY', 'RENAME'):
1193 if gp.op in ('COPY', 'RENAME'):
1197 copyfn(gp.oldpath, gp.path, cwd)
1194 copyfn(gp.oldpath, gp.path, cwd)
1198 changed[gp.path] = gp
1195 changed[gp.path] = gp
General Comments 0
You need to be logged in to leave comments. Login now