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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return False | 180 return False |
181 else: | 181 else: |
182 print '%s up-to-date' % branch | 182 print '%s up-to-date' % branch |
183 | 183 |
184 git.remove_merge_base(branch) | 184 git.remove_merge_base(branch) |
185 git.get_or_create_merge_base(branch) | 185 git.get_or_create_merge_base(branch) |
186 | 186 |
187 return True | 187 return True |
188 | 188 |
189 | 189 |
190 def main(args=()): | 190 def main(args=None): |
191 parser = argparse.ArgumentParser() | 191 parser = argparse.ArgumentParser() |
192 parser.add_argument('--verbose', '-v', action='store_true') | 192 parser.add_argument('--verbose', '-v', action='store_true') |
193 parser.add_argument('--no_fetch', '--no-fetch', '-n', | 193 parser.add_argument('--no_fetch', '--no-fetch', '-n', |
194 action='store_true', | 194 action='store_true', |
195 help='Skip fetching remotes.') | 195 help='Skip fetching remotes.') |
196 opts = parser.parse_args(args) | 196 opts = parser.parse_args(args) |
197 | 197 |
198 if opts.verbose: # pragma: no cover | 198 if opts.verbose: # pragma: no cover |
199 logging.getLogger().setLevel(logging.DEBUG) | 199 logging.getLogger().setLevel(logging.DEBUG) |
200 | 200 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 "%r was merged with its parent, checking out %r instead." | 263 "%r was merged with its parent, checking out %r instead." |
264 % (return_branch, root_branch) | 264 % (return_branch, root_branch) |
265 ) | 265 ) |
266 git.run('checkout', root_branch) | 266 git.run('checkout', root_branch) |
267 git.set_config(STARTING_BRANCH_KEY, '') | 267 git.set_config(STARTING_BRANCH_KEY, '') |
268 | 268 |
269 return retcode | 269 return retcode |
270 | 270 |
271 | 271 |
272 if __name__ == '__main__': # pragma: no cover | 272 if __name__ == '__main__': # pragma: no cover |
273 sys.exit(main(sys.argv[1:])) | 273 try: |
| 274 sys.exit(main()) |
| 275 except KeyboardInterrupt: |
| 276 sys.stderr.write('interrupted\n') |
| 277 sys.exit(1) |
OLD | NEW |