equal
deleted
inserted
replaced
1221 if state == 'hunk': |
1221 if state == 'hunk': |
1222 if not current_file: |
1222 if not current_file: |
1223 continue |
1223 continue |
1224 ret = current_file.apply(values) |
1224 ret = current_file.apply(values) |
1225 if ret >= 0: |
1225 if ret >= 0: |
1226 changed.setdefault(current_file.fname, None) |
1226 changed.add(current_file.fname) |
1227 if ret > 0: |
1227 if ret > 0: |
1228 err = 1 |
1228 err = 1 |
1229 elif state == 'file': |
1229 elif state == 'file': |
1230 if current_file: |
1230 if current_file: |
1231 rejects += current_file.close() |
1231 rejects += current_file.close() |
1234 copysource = None |
1234 copysource = None |
1235 if gp: |
1235 if gp: |
1236 path = pstrip(gp.path) |
1236 path = pstrip(gp.path) |
1237 if gp.oldpath: |
1237 if gp.oldpath: |
1238 copysource = pstrip(gp.oldpath) |
1238 copysource = pstrip(gp.oldpath) |
1239 changed[path] = gp |
1239 changed.add(path) |
1240 if gp.op == 'RENAME': |
1240 if gp.op == 'RENAME': |
1241 backend.unlink(copysource) |
1241 backend.unlink(copysource) |
1242 if not first_hunk: |
1242 if not first_hunk: |
1243 if gp.op == 'DELETE': |
1243 if gp.op == 'DELETE': |
1244 backend.unlink(path) |
1244 backend.unlink(path) |
1304 line = line.rstrip() |
1304 line = line.rstrip() |
1305 ui.note(line + '\n') |
1305 ui.note(line + '\n') |
1306 if line.startswith('patching file '): |
1306 if line.startswith('patching file '): |
1307 pf = util.parsepatchoutput(line) |
1307 pf = util.parsepatchoutput(line) |
1308 printed_file = False |
1308 printed_file = False |
1309 files.setdefault(pf, None) |
1309 files.add(pf) |
1310 elif line.find('with fuzz') >= 0: |
1310 elif line.find('with fuzz') >= 0: |
1311 fuzz = True |
1311 fuzz = True |
1312 if not printed_file: |
1312 if not printed_file: |
1313 ui.warn(pf + '\n') |
1313 ui.warn(pf + '\n') |
1314 printed_file = True |
1314 printed_file = True |
1338 similarity=0): |
1338 similarity=0): |
1339 """use builtin patch to apply <patchobj> to the working directory. |
1339 """use builtin patch to apply <patchobj> to the working directory. |
1340 returns whether patch was applied with fuzz factor.""" |
1340 returns whether patch was applied with fuzz factor.""" |
1341 |
1341 |
1342 if files is None: |
1342 if files is None: |
1343 files = {} |
1343 files = set() |
1344 if eolmode is None: |
1344 if eolmode is None: |
1345 eolmode = ui.config('patch', 'eol', 'strict') |
1345 eolmode = ui.config('patch', 'eol', 'strict') |
1346 if eolmode.lower() not in eolmodes: |
1346 if eolmode.lower() not in eolmodes: |
1347 raise util.Abort(_('unsupported line endings type: %s') % eolmode) |
1347 raise util.Abort(_('unsupported line endings type: %s') % eolmode) |
1348 eolmode = eolmode.lower() |
1348 eolmode = eolmode.lower() |
1357 ret = applydiff(ui, fp, files, backend, store, strip=strip, |
1357 ret = applydiff(ui, fp, files, backend, store, strip=strip, |
1358 eolmode=eolmode) |
1358 eolmode=eolmode) |
1359 finally: |
1359 finally: |
1360 if fp != patchobj: |
1360 if fp != patchobj: |
1361 fp.close() |
1361 fp.close() |
1362 files.update(dict.fromkeys(backend.close())) |
1362 files.update(backend.close()) |
1363 store.close() |
1363 store.close() |
1364 if ret < 0: |
1364 if ret < 0: |
1365 raise PatchError(_('patch failed to apply')) |
1365 raise PatchError(_('patch failed to apply')) |
1366 return ret > 0 |
1366 return ret > 0 |
1367 |
1367 |
1378 |
1378 |
1379 Returns whether patch was applied with fuzz factor. |
1379 Returns whether patch was applied with fuzz factor. |
1380 """ |
1380 """ |
1381 patcher = ui.config('ui', 'patch') |
1381 patcher = ui.config('ui', 'patch') |
1382 if files is None: |
1382 if files is None: |
1383 files = {} |
1383 files = set() |
1384 try: |
1384 try: |
1385 if patcher: |
1385 if patcher: |
1386 return _externalpatch(ui, repo, patcher, patchname, strip, |
1386 return _externalpatch(ui, repo, patcher, patchname, strip, |
1387 files, similarity) |
1387 files, similarity) |
1388 return internalpatch(ui, repo, patchname, strip, files, eolmode, |
1388 return internalpatch(ui, repo, patchname, strip, files, eolmode, |