| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
| 7 | 7 |
| 8 import cStringIO | 8 import cStringIO |
| 9 import codecs | 9 import codecs |
| 10 import collections | 10 import collections |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 git('retry', 'fetch', gerrit_repo, gerrit_ref, cwd=root, tries=1) | 597 git('retry', 'fetch', gerrit_repo, gerrit_ref, cwd=root, tries=1) |
| 598 git('checkout', 'FETCH_HEAD', cwd=root) | 598 git('checkout', 'FETCH_HEAD', cwd=root) |
| 599 | 599 |
| 600 if gerrit_rebase_patch_ref: | 600 if gerrit_rebase_patch_ref: |
| 601 print '===Rebasing===' | 601 print '===Rebasing===' |
| 602 # git rebase requires a branch to operate on. | 602 # git rebase requires a branch to operate on. |
| 603 temp_branch_name = 'tmp/' + uuid.uuid4().hex | 603 temp_branch_name = 'tmp/' + uuid.uuid4().hex |
| 604 try: | 604 try: |
| 605 ok = False | 605 ok = False |
| 606 git('checkout', '-b', temp_branch_name, cwd=root) | 606 git('checkout', '-b', temp_branch_name, cwd=root) |
| 607 git('rebase', base_rev, cwd=root) | 607 try: |
| 608 git('rebase', base_rev, cwd=root) |
| 609 except SubprocessFailed: |
| 610 # Abort the rebase since there were failures. |
| 611 git('rebase', '--abort', cwd=root) |
| 612 raise |
| 608 | 613 |
| 609 # Get off of the temporary branch since it can't be deleted otherwise. | 614 # Get off of the temporary branch since it can't be deleted otherwise. |
| 610 cur_rev = git('rev-parse', 'HEAD', cwd=root).strip() | 615 cur_rev = git('rev-parse', 'HEAD', cwd=root).strip() |
| 611 git('checkout', cur_rev, cwd=root) | 616 git('checkout', cur_rev, cwd=root) |
| 612 git('branch', '-D', temp_branch_name, cwd=root) | 617 git('branch', '-D', temp_branch_name, cwd=root) |
| 613 ok = True | 618 ok = True |
| 614 finally: | 619 finally: |
| 615 if not ok: | 620 if not ok: |
| 616 # Get off of the temporary branch since it can't be deleted otherwise. | 621 # Get off of the temporary branch since it can't be deleted otherwise. |
| 617 git('checkout', base_rev, cwd=root) | 622 git('checkout', base_rev, cwd=root) |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 # download patch failure is still an infra problem. | 1065 # download patch failure is still an infra problem. |
| 1061 if e.code == 3: | 1066 if e.code == 3: |
| 1062 # Patch download problem. | 1067 # Patch download problem. |
| 1063 return 87 | 1068 return 87 |
| 1064 # Genuine patch problem. | 1069 # Genuine patch problem. |
| 1065 return 88 | 1070 return 88 |
| 1066 | 1071 |
| 1067 | 1072 |
| 1068 if __name__ == '__main__': | 1073 if __name__ == '__main__': |
| 1069 sys.exit(main()) | 1074 sys.exit(main()) |
| OLD | NEW |