| 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 26 matching lines...) Expand all Loading... |
| 37 return return_branch | 37 return return_branch |
| 38 | 38 |
| 39 | 39 |
| 40 def fetch_remotes(branch_tree): | 40 def fetch_remotes(branch_tree): |
| 41 """Fetches all remotes which are needed to update |branch_tree|.""" | 41 """Fetches all remotes which are needed to update |branch_tree|.""" |
| 42 fetch_tags = False | 42 fetch_tags = False |
| 43 remotes = set() | 43 remotes = set() |
| 44 tag_set = git.tags() | 44 tag_set = git.tags() |
| 45 fetchspec_map = {} | 45 fetchspec_map = {} |
| 46 all_fetchspec_configs = git.run( | 46 all_fetchspec_configs = git.run( |
| 47 'config', '--get-regexp', r'remote\..*\.fetch').strip() | 47 'config', '--get-regexp', r'^remote\..*\.fetch').strip() |
| 48 for fetchspec_config in all_fetchspec_configs.splitlines(): | 48 for fetchspec_config in all_fetchspec_configs.splitlines(): |
| 49 key, _, fetchspec = fetchspec_config.partition(' ') | 49 key, _, fetchspec = fetchspec_config.partition(' ') |
| 50 dest_spec = fetchspec.partition(':')[2] | 50 dest_spec = fetchspec.partition(':')[2] |
| 51 remote_name = key.split('.')[1] | 51 remote_name = key.split('.')[1] |
| 52 fetchspec_map[dest_spec] = remote_name | 52 fetchspec_map[dest_spec] = remote_name |
| 53 for parent in branch_tree.itervalues(): | 53 for parent in branch_tree.itervalues(): |
| 54 if parent in tag_set: | 54 if parent in tag_set: |
| 55 fetch_tags = True | 55 fetch_tags = True |
| 56 else: | 56 else: |
| 57 full_ref = git.run('rev-parse', '--symbolic-full-name', parent) | 57 full_ref = git.run('rev-parse', '--symbolic-full-name', parent) |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 % (return_branch, root_branch) | 252 % (return_branch, root_branch) |
| 253 ) | 253 ) |
| 254 git.run('checkout', root_branch) | 254 git.run('checkout', root_branch) |
| 255 git.set_config(STARTING_BRANCH_KEY, '') | 255 git.set_config(STARTING_BRANCH_KEY, '') |
| 256 | 256 |
| 257 return retcode | 257 return retcode |
| 258 | 258 |
| 259 | 259 |
| 260 if __name__ == '__main__': # pragma: no cover | 260 if __name__ == '__main__': # pragma: no cover |
| 261 sys.exit(main(sys.argv[1:])) | 261 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |