Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: git_rebase_update.py

Issue 598153003: Fix regexp used for enumerating remotes. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698