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 """Generate a CL to roll a DEPS entry to the specified revision number and post | 6 """Generate a CL to roll a DEPS entry to the specified revision number and post |
7 it to Rietveld so that the CL will land automatically if it passes the | 7 it to Rietveld so that the CL will land automatically if it passes the |
8 commit-queue's checks. | 8 commit-queue's checks. |
9 """ | 9 """ |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 os.chdir(root_dir) | 81 os.chdir(root_dir) |
82 | 82 |
83 project = args[0] | 83 project = args[0] |
84 new_rev = int(args[1]) | 84 new_rev = int(args[1]) |
85 | 85 |
86 # Silence the editor. | 86 # Silence the editor. |
87 os.environ['EDITOR'] = 'true' | 87 os.environ['EDITOR'] = 'true' |
88 | 88 |
89 if options.force and not options.dry_run: | 89 if options.force and not options.dry_run: |
90 subprocess2.check_call(['git', 'clean', '-d', '-f']) | 90 subprocess2.check_call(['git', 'clean', '-d', '-f']) |
91 subprocess2.check_call(['git', 'rebase', '--abort']) | 91 subprocess2.call(['git', 'rebase', '--abort']) |
92 | 92 |
93 old_branch = scm.GIT.GetBranch(root_dir) | 93 old_branch = scm.GIT.GetBranch(root_dir) |
94 new_branch = '%s_roll' % project | 94 new_branch = '%s_roll' % project |
95 | 95 |
96 if options.upstream == new_branch: | 96 if options.upstream == new_branch: |
97 parser.error('Cannot set %s as its own upstream.' % new_branch) | 97 parser.error('Cannot set %s as its own upstream.' % new_branch) |
98 | 98 |
99 if old_branch == new_branch: | 99 if old_branch == new_branch: |
100 if options.force: | 100 if options.force: |
101 if not options.dry_run: | 101 if not options.dry_run: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 subprocess2.check_call(upload_cmd) | 139 subprocess2.check_call(upload_cmd) |
140 finally: | 140 finally: |
141 if not options.dry_run: | 141 if not options.dry_run: |
142 subprocess2.check_output(['git', 'checkout', old_branch]) | 142 subprocess2.check_output(['git', 'checkout', old_branch]) |
143 subprocess2.check_output(['git', 'branch', '-D', new_branch]) | 143 subprocess2.check_output(['git', 'branch', '-D', new_branch]) |
144 return 0 | 144 return 0 |
145 | 145 |
146 | 146 |
147 if __name__ == '__main__': | 147 if __name__ == '__main__': |
148 sys.exit(main()) | 148 sys.exit(main()) |
OLD | NEW |