Chromium Code Reviews| 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 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 Loading... | |
| 74 position = get_unique(footers, 'Cr-Commit-Position') | 74 position = get_unique(footers, 'Cr-Commit-Position') |
| 75 if position: | 75 if position: |
| 76 match = CHROME_COMMIT_POSITION_PATTERN.match(position) | 76 match = CHROME_COMMIT_POSITION_PATTERN.match(position) |
| 77 assert match, 'Invalid Cr-Commit-Position value: %s' % position | 77 assert match, 'Invalid Cr-Commit-Position value: %s' % position |
| 78 return (match.group(1), match.group(2)) | 78 return (match.group(1), match.group(2)) |
| 79 | 79 |
| 80 svn_commit = get_unique(footers, 'git-svn-id') | 80 svn_commit = get_unique(footers, 'git-svn-id') |
| 81 if svn_commit: | 81 if svn_commit: |
| 82 match = GIT_SVN_ID_PATTERN.match(svn_commit) | 82 match = GIT_SVN_ID_PATTERN.match(svn_commit) |
| 83 assert match, 'Invalid git-svn-id value: %s' % svn_commit | 83 assert match, 'Invalid git-svn-id value: %s' % svn_commit |
| 84 # V8 has different semantics than Chromium. | |
| 85 if re.match(r'.*https?://v8\.googlecode\.com/svn/trunk', | |
| 86 match.group(1)): | |
| 87 return ('refs/heads/candidates', match.group(2)) | |
| 88 if re.match(r'.*https?://v8\.googlecode\.com/svn/branches/bleeding_edge', | |
| 89 match.group(1)): | |
| 90 return ('refs/heads/master', match.group(2)) | |
| 91 | |
| 84 # Assume that any trunk svn revision will match the commit-position | 92 # Assume that any trunk svn revision will match the commit-position |
| 85 # semantics. | 93 # semantics. |
| 86 if re.match('.*/trunk.*$', match.group(1)): | 94 if re.match('.*/trunk.*$', match.group(1)): |
| 87 return ('refs/heads/master', match.group(2)) | 95 return ('refs/heads/master', match.group(2)) |
| 88 | 96 |
| 97 if re.match('.*/bleeding_edge.*$', match.group(1)): | |
|
Michael Achenbach
2014/10/11 07:28:02
What is this for? When would that match? What does
agable
2014/10/13 08:37:15
Agree, not sure what this is for. The stanzas up a
hinoka
2014/10/13 17:26:07
My bad, this wasn't supposed to be in here.
| |
| 98 return ('refs/heads/', match.group(2)) | |
| 99 | |
| 89 # But for now only support faking branch-heads for chrome. | 100 # But for now only support faking branch-heads for chrome. |
| 90 branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1)) | 101 branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1)) |
| 91 if branch_match: | 102 if branch_match: |
| 92 # svn commit numbers do not map to branches. | 103 # svn commit numbers do not map to branches. |
| 93 return ('refs/branch-heads/%s' % branch_match.group(1), None) | 104 return ('refs/branch-heads/%s' % branch_match.group(1), None) |
| 94 | 105 |
| 95 raise ValueError('Unable to infer commit position from footers') | 106 raise ValueError('Unable to infer commit position from footers') |
| 96 | 107 |
| 97 | 108 |
| 98 def main(args): | 109 def main(args): |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 128 assert pos[1], 'No valid position for commit' | 139 assert pos[1], 'No valid position for commit' |
| 129 print pos[1] | 140 print pos[1] |
| 130 else: | 141 else: |
| 131 for k in footers.keys(): | 142 for k in footers.keys(): |
| 132 for v in footers[k]: | 143 for v in footers[k]: |
| 133 print '%s: %s' % (k, v) | 144 print '%s: %s' % (k, v) |
| 134 | 145 |
| 135 | 146 |
| 136 if __name__ == '__main__': | 147 if __name__ == '__main__': |
| 137 sys.exit(main(sys.argv[1:])) | 148 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |