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 try: | 607 git('rebase', base_rev, cwd=root) |
608 git('rebase', base_rev, cwd=root) | |
609 finally: | |
610 # Abort the rebase since there were failures. | |
611 git('rebase', '--abort', cwd=root) | |
612 | 608 |
613 # Get off of the temporary branch since it can't be deleted otherwise. | 609 # Get off of the temporary branch since it can't be deleted otherwise. |
614 cur_rev = git('rev-parse', 'HEAD', cwd=root).strip() | 610 cur_rev = git('rev-parse', 'HEAD', cwd=root).strip() |
615 git('checkout', cur_rev, cwd=root) | 611 git('checkout', cur_rev, cwd=root) |
616 git('branch', '-D', temp_branch_name, cwd=root) | 612 git('branch', '-D', temp_branch_name, cwd=root) |
617 ok = True | 613 ok = True |
618 finally: | 614 finally: |
619 if not ok: | 615 if not ok: |
620 # Get off of the temporary branch since it can't be deleted otherwise. | 616 # Get off of the temporary branch since it can't be deleted otherwise. |
621 git('checkout', base_rev, cwd=root) | 617 git('checkout', base_rev, cwd=root) |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 # download patch failure is still an infra problem. | 1060 # download patch failure is still an infra problem. |
1065 if e.code == 3: | 1061 if e.code == 3: |
1066 # Patch download problem. | 1062 # Patch download problem. |
1067 return 87 | 1063 return 87 |
1068 # Genuine patch problem. | 1064 # Genuine patch problem. |
1069 return 88 | 1065 return 88 |
1070 | 1066 |
1071 | 1067 |
1072 if __name__ == '__main__': | 1068 if __name__ == '__main__': |
1073 sys.exit(main()) | 1069 sys.exit(main()) |
OLD | NEW |