| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if not ignore_exit_code and p.returncode != 0: | 169 if not ignore_exit_code and p.returncode != 0: |
| 170 logging.error('Command failed: %s\n%s', str(command), output) | 170 logging.error('Command failed: %s\n%s', str(command), output) |
| 171 sys.exit(p.returncode) | 171 sys.exit(p.returncode) |
| 172 return output | 172 return output |
| 173 | 173 |
| 174 def _GetCommitInfo(self, path_below_src, git_hash=None, git_repo_url=None): | 174 def _GetCommitInfo(self, path_below_src, git_hash=None, git_repo_url=None): |
| 175 working_dir = os.path.join(self._chromium_src, path_below_src) | 175 working_dir = os.path.join(self._chromium_src, path_below_src) |
| 176 self._RunCommand(['git', 'fetch', 'origin'], working_dir=working_dir) | 176 self._RunCommand(['git', 'fetch', 'origin'], working_dir=working_dir) |
| 177 revision_range = git_hash or 'origin' | 177 revision_range = git_hash or 'origin' |
| 178 ret = self._RunCommand( | 178 ret = self._RunCommand( |
| 179 ['git', '--no-pager', 'log', revision_range, '--pretty=full', '-1'], | 179 ['git', '--no-pager', 'log', revision_range, |
| 180 '--no-abbrev-commit', '--pretty=full', '-1'], |
| 180 working_dir=working_dir) | 181 working_dir=working_dir) |
| 181 return CommitInfo(_ParseGitCommitHash(ret), git_repo_url) | 182 return CommitInfo(_ParseGitCommitHash(ret), git_repo_url) |
| 182 | 183 |
| 183 def _GetDepsCommitInfo(self, deps_dict, path_below_src): | 184 def _GetDepsCommitInfo(self, deps_dict, path_below_src): |
| 184 entry = deps_dict['deps'][_PosixPath('src/%s' % path_below_src)] | 185 entry = deps_dict['deps'][_PosixPath('src/%s' % path_below_src)] |
| 185 at_index = entry.find('@') | 186 at_index = entry.find('@') |
| 186 git_repo_url = entry[:at_index] | 187 git_repo_url = entry[:at_index] |
| 187 git_hash = entry[at_index + 1:] | 188 git_hash = entry[at_index + 1:] |
| 188 return self._GetCommitInfo(path_below_src, git_hash, git_repo_url) | 189 return self._GetCommitInfo(path_below_src, git_hash, git_repo_url) |
| 189 | 190 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 logging.basicConfig(level=logging.ERROR) | 410 logging.basicConfig(level=logging.ERROR) |
| 410 | 411 |
| 411 autoroller = AutoRoller(SRC_DIR) | 412 autoroller = AutoRoller(SRC_DIR) |
| 412 if args.abort: | 413 if args.abort: |
| 413 return autoroller.Abort() | 414 return autoroller.Abort() |
| 414 else: | 415 else: |
| 415 return autoroller.PrepareRoll(args.ignore_checks, args.tbr, args.commit) | 416 return autoroller.PrepareRoll(args.ignore_checks, args.tbr, args.commit) |
| 416 | 417 |
| 417 if __name__ == '__main__': | 418 if __name__ == '__main__': |
| 418 sys.exit(main()) | 419 sys.exit(main()) |
| OLD | NEW |