| 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 |
| 89 # But for now only support faking branch-heads for chrome. | 97 # But for now only support faking branch-heads for chrome. |
| 90 branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1)) | 98 branch_match = re.match('.*/chrome/branches/([\w/-]+)/src$', match.group(1)) |
| 91 if branch_match: | 99 if branch_match: |
| 92 # svn commit numbers do not map to branches. | 100 # svn commit numbers do not map to branches. |
| 93 return ('refs/branch-heads/%s' % branch_match.group(1), None) | 101 return ('refs/branch-heads/%s' % branch_match.group(1), None) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 assert pos[1], 'No valid position for commit' | 136 assert pos[1], 'No valid position for commit' |
| 129 print pos[1] | 137 print pos[1] |
| 130 else: | 138 else: |
| 131 for k in footers.keys(): | 139 for k in footers.keys(): |
| 132 for v in footers[k]: | 140 for v in footers[k]: |
| 133 print '%s: %s' % (k, v) | 141 print '%s: %s' % (k, v) |
| 134 | 142 |
| 135 | 143 |
| 136 if __name__ == '__main__': | 144 if __name__ == '__main__': |
| 137 sys.exit(main(sys.argv[1:])) | 145 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |