| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 collections | 7 import collections |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 def _GenerateCLDescriptionCommand(angle_current, angle_new, bugs, tbr): | 95 def _GenerateCLDescriptionCommand(angle_current, angle_new, bugs, tbr): |
| 96 def GetChangeString(current_hash, new_hash): | 96 def GetChangeString(current_hash, new_hash): |
| 97 return '%s..%s' % (current_hash[0:7], new_hash[0:7]); | 97 return '%s..%s' % (current_hash[0:7], new_hash[0:7]); |
| 98 | 98 |
| 99 def GetChangeLogURL(git_repo_url, change_string): | 99 def GetChangeLogURL(git_repo_url, change_string): |
| 100 return '%s/+log/%s' % (git_repo_url, change_string) | 100 return '%s/+log/%s' % (git_repo_url, change_string) |
| 101 | 101 |
| 102 def GetBugString(bugs): | 102 def GetBugString(bugs): |
| 103 bug_str = 'BUG=' | 103 bug_str = 'BUG=' |
| 104 for bug in bugs: | 104 for bug in bugs: |
| 105 bug_str += str(bug) + ',' | 105 bug_str += bug + ',' |
| 106 return bug_str.rstrip(',') | 106 return bug_str.rstrip(',') |
| 107 | 107 |
| 108 if angle_current.git_commit != angle_new.git_commit: | 108 if angle_current.git_commit != angle_new.git_commit: |
| 109 change_str = GetChangeString(angle_current.git_commit, | 109 change_str = GetChangeString(angle_current.git_commit, |
| 110 angle_new.git_commit) | 110 angle_new.git_commit) |
| 111 changelog_url = GetChangeLogURL(angle_current.git_repo_url, | 111 changelog_url = GetChangeLogURL(angle_current.git_repo_url, |
| 112 change_str) | 112 change_str) |
| 113 | 113 |
| 114 def GetExtraCQTrybotString(): | 114 def GetExtraCQTrybotString(): |
| 115 s = '' | 115 s = '' |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 logging.debug('Dirty/unversioned files:\n%s', '\n'.join(lines)) | 213 logging.debug('Dirty/unversioned files:\n%s', '\n'.join(lines)) |
| 214 return False | 214 return False |
| 215 | 215 |
| 216 def _GetBugList(self, path_below_src, angle_current, angle_new): | 216 def _GetBugList(self, path_below_src, angle_current, angle_new): |
| 217 working_dir = os.path.join(self._chromium_src, path_below_src) | 217 working_dir = os.path.join(self._chromium_src, path_below_src) |
| 218 lines = self._RunCommand( | 218 lines = self._RunCommand( |
| 219 ['git','log', | 219 ['git','log', |
| 220 '%s..%s' % (angle_current.git_commit, angle_new.git_commit)], | 220 '%s..%s' % (angle_current.git_commit, angle_new.git_commit)], |
| 221 working_dir=working_dir).split('\n') | 221 working_dir=working_dir).split('\n') |
| 222 ignored_projects = set(['angleproject']) |
| 222 bugs = set() | 223 bugs = set() |
| 223 for line in lines: | 224 for line in lines: |
| 224 line = line.strip() | 225 line = line.strip() |
| 225 bug_prefix = 'BUG=' | 226 bug_prefix = 'BUG=' |
| 226 if line.startswith(bug_prefix): | 227 if line.startswith(bug_prefix): |
| 227 bugs_strings = line[len(bug_prefix):].split(',') | 228 bugs_strings = line[len(bug_prefix):].split(',') |
| 228 for bug_string in bugs_strings: | 229 for bug_string in bugs_strings: |
| 229 try: | 230 ignore_bug = False |
| 230 bugs.add(int(bug_string)) | 231 for ignored_project in ignored_projects: |
| 231 except: | 232 if bug_string.startswith(ignored_project + ':'): |
| 232 # skip this, it may be a project specific bug such as | 233 ignore_bug = True |
| 233 # "angleproject:X" or an ill-formed BUG= message | 234 break |
| 234 pass | 235 if not ignore_bug: |
| 236 bugs.add(bug_string) |
| 235 return bugs | 237 return bugs |
| 236 | 238 |
| 237 def _UpdateReadmeFile(self, readme_path, new_revision): | 239 def _UpdateReadmeFile(self, readme_path, new_revision): |
| 238 readme = open(os.path.join(self._chromium_src, readme_path), 'r+') | 240 readme = open(os.path.join(self._chromium_src, readme_path), 'r+') |
| 239 txt = readme.read() | 241 txt = readme.read() |
| 240 m = re.sub(re.compile('.*^Revision\: ([0-9]*).*', re.MULTILINE), | 242 m = re.sub(re.compile('.*^Revision\: ([0-9]*).*', re.MULTILINE), |
| 241 ('Revision: %s' % new_revision), txt) | 243 ('Revision: %s' % new_revision), txt) |
| 242 readme.seek(0) | 244 readme.seek(0) |
| 243 readme.write(m) | 245 readme.write(m) |
| 244 readme.truncate() | 246 readme.truncate() |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 logging.basicConfig(level=logging.ERROR) | 405 logging.basicConfig(level=logging.ERROR) |
| 404 | 406 |
| 405 autoroller = AutoRoller(SRC_DIR) | 407 autoroller = AutoRoller(SRC_DIR) |
| 406 if args.abort: | 408 if args.abort: |
| 407 return autoroller.Abort() | 409 return autoroller.Abort() |
| 408 else: | 410 else: |
| 409 return autoroller.PrepareRoll(args.ignore_checks, args.tbr, args.commit) | 411 return autoroller.PrepareRoll(args.ignore_checks, args.tbr, args.commit) |
| 410 | 412 |
| 411 if __name__ == '__main__': | 413 if __name__ == '__main__': |
| 412 sys.exit(main()) | 414 sys.exit(main()) |
| OLD | NEW |