diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-07-31 14:11:56 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-07-31 14:33:47 +0200 |
commit | 68940fb2055b350f4a07b9eec96367a85d78a1e3 (patch) | |
tree | 0ce9c95ac5a20ad647e96eb7e1b16c9bf30fc9cf | |
parent | 61e659dbb7bb8199ae9925e9d7fef938a607618d (diff) |
pq: Retry patch with whitespace fixup on failure
This helps patches with CRLF line endings and we don't lose anything
since we'd failed otherwise anyway.
Closes: #833066
-rw-r--r-- | gbp/scripts/common/pq.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py index 5580426b..e0abc196 100644 --- a/gbp/scripts/common/pq.py +++ b/gbp/scripts/common/pq.py @@ -316,7 +316,11 @@ def apply_and_commit_patch(repo, patch, fallback_author, topic=None, name=None): else: gbp.log.warn("Patch '%s' has no authorship information" % patch_fn) - repo.apply_patch(patch.path, strip=patch.strip) + try: + repo.apply_patch(patch.path, strip=patch.strip) + except GitRepositoryError: + gbp.log.warn("Patch %s failed to apply, retrying with whitespace fixup" % patch_fn) + repo.apply_patch(patch.path, strip=patch.strip, fix_ws=True) tree = repo.write_tree() msg = "%s\n\n%s" % (patch.subject, patch.long_desc) if topic: |