| 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 """ | 6 """ |
| 7 Tool to update all branches to have the latest changes from their upstreams. | 7 Tool to update all branches to have the latest changes from their upstreams. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 empty_rebase = git.hash_one(squash_branch) == git.hash_one(parent) | 130 empty_rebase = git.hash_one(squash_branch) == git.hash_one(parent) |
| 131 git.run('checkout', branch) | 131 git.run('checkout', branch) |
| 132 git.run('branch', '-D', squash_branch) | 132 git.run('branch', '-D', squash_branch) |
| 133 if squash_ret.success and empty_rebase: | 133 if squash_ret.success and empty_rebase: |
| 134 print 'Success!' | 134 print 'Success!' |
| 135 git.squash_current_branch(merge_base=start_hash) | 135 git.squash_current_branch(merge_base=start_hash) |
| 136 git.rebase(parent, start_hash, branch) | 136 git.rebase(parent, start_hash, branch) |
| 137 else: | 137 else: |
| 138 # rebase and leave in mid-rebase state. | 138 # rebase and leave in mid-rebase state. |
| 139 git.rebase(parent, start_hash, branch) | 139 git.rebase(parent, start_hash, branch) |
| 140 print "Failed!" |
| 141 print |
| 142 print "Here's what git-rebase had to say:" |
| 140 print squash_ret.message | 143 print squash_ret.message |
| 141 print | 144 print |
| 142 print textwrap.dedent( | 145 print textwrap.dedent( |
| 143 """ | 146 """ |
| 144 Squashing failed. You probably have a real merge conflict. | 147 Squashing failed. You probably have a real merge conflict. |
| 145 | 148 |
| 146 Your working copy is in mid-rebase. Either: | 149 Your working copy is in mid-rebase. Either: |
| 147 * completely resolve like a normal git-rebase; OR | 150 * completely resolve like a normal git-rebase; OR |
| 148 * abort the rebase and mark this branch as dormant: | 151 * abort the rebase and mark this branch as dormant: |
| 149 git config branch.%s.dormant true | 152 git config branch.%s.dormant true |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 % (return_branch, root_branch) | 239 % (return_branch, root_branch) |
| 237 ) | 240 ) |
| 238 git.run('checkout', root_branch) | 241 git.run('checkout', root_branch) |
| 239 git.del_config(STARTING_BRANCH_KEY) | 242 git.del_config(STARTING_BRANCH_KEY) |
| 240 | 243 |
| 241 return retcode | 244 return retcode |
| 242 | 245 |
| 243 | 246 |
| 244 if __name__ == '__main__': # pragma: no cover | 247 if __name__ == '__main__': # pragma: no cover |
| 245 sys.exit(main(sys.argv[1:])) | 248 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |