| 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 |
| 11 | 11 |
| 12 import git_common as git | 12 import git_common as git |
| 13 | 13 |
| 14 |
| 14 FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): (.*)$') | 15 FOOTER_PATTERN = re.compile(r'^\s*([\w-]+): (.*)$') |
| 15 CHROME_COMMIT_POSITION_PATTERN = re.compile(r'^([\w/-]+)@{#(\d+)}$') | 16 CHROME_COMMIT_POSITION_PATTERN = re.compile(r'^([\w/-]+)@{#(\d+)}$') |
| 16 GIT_SVN_ID_PATTERN = re.compile('^([^\s@]+)@(\d+)') | 17 GIT_SVN_ID_PATTERN = re.compile('^([^\s@]+)@(\d+)') |
| 17 | 18 |
| 19 |
| 18 def normalize_name(header): | 20 def normalize_name(header): |
| 19 return '-'.join([ word.title() for word in header.strip().split('-') ]) | 21 return '-'.join([ word.title() for word in header.strip().split('-') ]) |
| 20 | 22 |
| 21 | 23 |
| 22 def parse_footer(line): | 24 def parse_footer(line): |
| 23 match = FOOTER_PATTERN.match(line) | 25 match = FOOTER_PATTERN.match(line) |
| 24 if match: | 26 if match: |
| 25 return (match.group(1), match.group(2)) | 27 return (match.group(1), match.group(2)) |
| 26 else: | 28 else: |
| 27 return None | 29 return None |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 assert pos[1], 'No valid position for commit' | 128 assert pos[1], 'No valid position for commit' |
| 127 print pos[1] | 129 print pos[1] |
| 128 else: | 130 else: |
| 129 for k in footers.keys(): | 131 for k in footers.keys(): |
| 130 for v in footers[k]: | 132 for v in footers[k]: |
| 131 print '%s: %s' % (k, v) | 133 print '%s: %s' % (k, v) |
| 132 | 134 |
| 133 | 135 |
| 134 if __name__ == '__main__': | 136 if __name__ == '__main__': |
| 135 sys.exit(main(sys.argv[1:])) | 137 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |