##// END OF EJS Templates
patch: stop updating changed files set in applydiff()...
Patrick Mezard -
r14565:3cacc232 default
parent child Browse files
Show More
@@ -1193,21 +1193,20 b' def iterhunks(fp):'
1193 1193 gp = gitpatches.pop()[2]
1194 1194 yield 'file', ('a/' + gp.path, 'b/' + gp.path, None, gp)
1195 1195
1196 def applydiff(ui, fp, changed, backend, store, strip=1, eolmode='strict'):
1196 def applydiff(ui, fp, backend, store, strip=1, eolmode='strict'):
1197 1197 """Reads a patch from fp and tries to apply it.
1198 1198
1199 The dict 'changed' is filled in with all of the filenames changed
1200 by the patch. Returns 0 for a clean patch, -1 if any rejects were
1201 found and 1 if there was any fuzz.
1199 Returns 0 for a clean patch, -1 if any rejects were found and 1 if
1200 there was any fuzz.
1202 1201
1203 1202 If 'eolmode' is 'strict', the patch content and patched file are
1204 1203 read in binary mode. Otherwise, line endings are ignored when
1205 1204 patching then normalized according to 'eolmode'.
1206 1205 """
1207 return _applydiff(ui, fp, patchfile, backend, store, changed, strip=strip,
1206 return _applydiff(ui, fp, patchfile, backend, store, strip=strip,
1208 1207 eolmode=eolmode)
1209 1208
1210 def _applydiff(ui, fp, patcher, backend, store, changed, strip=1,
1209 def _applydiff(ui, fp, patcher, backend, store, strip=1,
1211 1210 eolmode='strict'):
1212 1211
1213 1212 def pstrip(p):
@@ -1222,10 +1221,8 b' def _applydiff(ui, fp, patcher, backend,'
1222 1221 if not current_file:
1223 1222 continue
1224 1223 ret = current_file.apply(values)
1225 if ret >= 0:
1226 changed.add(current_file.fname)
1227 if ret > 0:
1228 err = 1
1224 if ret > 0:
1225 err = 1
1229 1226 elif state == 'file':
1230 1227 if current_file:
1231 1228 rejects += current_file.close()
@@ -1236,7 +1233,6 b' def _applydiff(ui, fp, patcher, backend,'
1236 1233 path = pstrip(gp.path)
1237 1234 if gp.oldpath:
1238 1235 copysource = pstrip(gp.oldpath)
1239 changed.add(path)
1240 1236 if gp.op == 'RENAME':
1241 1237 backend.unlink(copysource)
1242 1238 if not first_hunk:
@@ -1354,7 +1350,7 b' def internalpatch(ui, repo, patchobj, st'
1354 1350 except TypeError:
1355 1351 fp = patchobj
1356 1352 try:
1357 ret = applydiff(ui, fp, files, backend, store, strip=strip,
1353 ret = applydiff(ui, fp, backend, store, strip=strip,
1358 1354 eolmode=eolmode)
1359 1355 finally:
1360 1356 if fp != patchobj:
@@ -130,7 +130,7 b' Merge:'
130 130 patch failed, unable to continue (try -v)
131 131 patch failed, rejects left in working dir
132 132 patch didn't work out, merging patcha
133 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
133 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
134 134 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
135 135 (branch merge, don't forget to commit)
136 136 applying patcha2
General Comments 0
You need to be logged in to leave comments. Login now