| Index: pending_manager.py
|
| diff --git a/pending_manager.py b/pending_manager.py
|
| index df009233b37db00b35001aecf80c2029dfd88516..09310f68a78538b3163776c995aaf84283065f9c 100644
|
| --- a/pending_manager.py
|
| +++ b/pending_manager.py
|
| @@ -25,6 +25,7 @@ import find_depot_tools # pylint: disable=W0611
|
| import breakpad
|
|
|
| import model
|
| +import patch
|
| from verification import base
|
|
|
|
|
| @@ -38,20 +39,6 @@ def send_stack(e):
|
| maxlen=2000)
|
|
|
|
|
| -def auto_mangle_git_patch(patch):
|
| - """Mangles a patch and automatically strip out git decoration."""
|
| - # Git patches have a/ at the beginning of source paths. We strip that out
|
| - # with a regexp rather than the -p flag to patch so we can feed either Git
|
| - # or svn-style patches into the same apply command. re.sub() should be used
|
| - # but flags=re.MULTILINE is only in python 2.7.
|
| - out = []
|
| - for line in patch.splitlines(True):
|
| - # TODO: It should just process the header lines.
|
| - out.append(re.sub(r'^--- a/', r'--- ',
|
| - re.sub(r'^\+\+\+ b/', r'+++ ', line)))
|
| - return ''.join(out)
|
| -
|
| -
|
| class PendingCommit(base.Verified):
|
| """Represents a pending commit that is being processed."""
|
| persistent = base.Verified.persistent + [
|
| @@ -277,9 +264,9 @@ class PendingManager(object):
|
|
|
| def _apply_patch(self, pending, revision):
|
| """Applies the pending patch to the checkout and throws if it fails."""
|
| - patch = urllib2.urlopen(pending.patch_url()).read()
|
| - patch = auto_mangle_git_patch(patch)
|
| - if not self.checkout.apply_patch(patch):
|
| + patch_data = urllib2.urlopen(pending.patch_url()).read()
|
| + patch_data = patch.auto_mangle_git_patch(patch_data)
|
| + if not self.checkout.apply_patch(patch_data):
|
| raise base.DiscardPending(pending,
|
| 'Patch failed to apply against %s.' % revision)
|
|
|
|
|