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

Side by Side Diff: git_footers.py

Issue 559773002: Allow trunk to not end in a slash for git_footers. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 3 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 import argparse 6 import argparse
7 import re 7 import re
8 import sys 8 import sys
9 9
10 from collections import defaultdict 10 from collections import defaultdict
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 match = CHROME_COMMIT_POSITION_PATTERN.match(position) 74 match = CHROME_COMMIT_POSITION_PATTERN.match(position)
75 assert match, 'Invalid Cr-Commit-Position value: %s' % position 75 assert match, 'Invalid Cr-Commit-Position value: %s' % position
76 return (match.group(1), match.group(2)) 76 return (match.group(1), match.group(2))
77 77
78 svn_commit = get_unique(footers, 'git-svn-id') 78 svn_commit = get_unique(footers, 'git-svn-id')
79 if svn_commit: 79 if svn_commit:
80 match = GIT_SVN_ID_PATTERN.match(svn_commit) 80 match = GIT_SVN_ID_PATTERN.match(svn_commit)
81 assert match, 'Invalid git-svn-id value: %s' % svn_commit 81 assert match, 'Invalid git-svn-id value: %s' % svn_commit
82 # Assume that any trunk svn revision will match the commit-position 82 # Assume that any trunk svn revision will match the commit-position
83 # semantics. 83 # semantics.
84 if re.match('.*/trunk/.*$', match.group(1)): 84 if re.match('.*/trunk.*$', match.group(1)):
85 return ('refs/heads/master', match.group(2)) 85 return ('refs/heads/master', match.group(2))
86 86
87 # But for now only support faking branch-heads for chrome. 87 # But for now only support faking branch-heads for chrome.
88 branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1)) 88 branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1))
89 if branch_match: 89 if branch_match:
90 # svn commit numbers do not map to branches. 90 # svn commit numbers do not map to branches.
91 return ('refs/branch-heads/%s' % branch_match.group(1), None) 91 return ('refs/branch-heads/%s' % branch_match.group(1), None)
92 92
93 raise ValueError('Unable to infer commit position from footers') 93 raise ValueError('Unable to infer commit position from footers')
94 94
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 assert pos[1], 'No valid position for commit' 126 assert pos[1], 'No valid position for commit'
127 print pos[1] 127 print pos[1]
128 else: 128 else:
129 for k in footers.keys(): 129 for k in footers.keys():
130 for v in footers[k]: 130 for v in footers[k]:
131 print '%s: %s' % (k, v) 131 print '%s: %s' % (k, v)
132 132
133 133
134 if __name__ == '__main__': 134 if __name__ == '__main__':
135 sys.exit(main(sys.argv[1:])) 135 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