comparison mercurial/patch.py @ 16813:6d42c797ca6e stable

patch: keep patching after missing copy source (issue3480) When applying a patch renaming/copying 'a' to 'b' on a revision where 'a' does not exist, the patching process would abort immediately, without processing the remaining hunks and without reporting it. This patch makes the patching no longer abort and possible hunks applied on the copied/renamed file be written in reject files.
author Patrick Mezard <patrick@mezard.eu>
date Fri, 01 Jun 2012 17:37:56 +0200
parents fcb97d9a26cd
children 8abee656e14c
comparison
equal deleted inserted replaced
16805:9a99224a6409 16813:6d42c797ca6e
1341 rejects += 1 1341 rejects += 1
1342 continue 1342 continue
1343 elif state == 'git': 1343 elif state == 'git':
1344 for gp in values: 1344 for gp in values:
1345 path = pstrip(gp.oldpath) 1345 path = pstrip(gp.oldpath)
1346 data, mode = backend.getfile(path) 1346 try:
1347 store.setfile(path, data, mode) 1347 data, mode = backend.getfile(path)
1348 except IOError, e:
1349 if e.errno != errno.ENOENT:
1350 raise
1351 # The error ignored here will trigger a getfile()
1352 # error in a place more appropriate for error
1353 # handling, and will not interrupt the patching
1354 # process.
1355 else:
1356 store.setfile(path, data, mode)
1348 else: 1357 else:
1349 raise util.Abort(_('unsupported parser state: %s') % state) 1358 raise util.Abort(_('unsupported parser state: %s') % state)
1350 1359
1351 if current_file: 1360 if current_file:
1352 rejects += current_file.close() 1361 rejects += current_file.close()