Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/patch.py Tue May 29 18:27:12 2012 +0300 +++ b/mercurial/patch.py Fri Jun 01 17:37:56 2012 +0200 @@ -1343,8 +1343,17 @@ elif state == 'git': for gp in values: path = pstrip(gp.oldpath) - data, mode = backend.getfile(path) - store.setfile(path, data, mode) + try: + data, mode = backend.getfile(path) + except IOError, e: + if e.errno != errno.ENOENT: + raise + # The error ignored here will trigger a getfile() + # error in a place more appropriate for error + # handling, and will not interrupt the patching + # process. + else: + store.setfile(path, data, mode) else: raise util.Abort(_('unsupported parser state: %s') % state)