Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: git_cl.py

Issue 1928343002: Revert of Implement owners check in presubmit for Gerrit. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@P300
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | presubmit_canned_checks.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld and Gerrit.""" 8 """A git-command for integrating reviews on Rietveld and Gerrit."""
9 9
10 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 def UpdateDescription(self, description): 1310 def UpdateDescription(self, description):
1311 self.description = description 1311 self.description = description
1312 return self._codereview_impl.UpdateDescriptionRemote(description) 1312 return self._codereview_impl.UpdateDescriptionRemote(description)
1313 1313
1314 def RunHook(self, committing, may_prompt, verbose, change): 1314 def RunHook(self, committing, may_prompt, verbose, change):
1315 """Calls sys.exit() if the hook fails; returns a HookResults otherwise.""" 1315 """Calls sys.exit() if the hook fails; returns a HookResults otherwise."""
1316 try: 1316 try:
1317 return presubmit_support.DoPresubmitChecks(change, committing, 1317 return presubmit_support.DoPresubmitChecks(change, committing,
1318 verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin, 1318 verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin,
1319 default_presubmit=None, may_prompt=may_prompt, 1319 default_presubmit=None, may_prompt=may_prompt,
1320 rietveld_obj=self._codereview_impl.GetRieveldObjForPresubmit(), 1320 rietveld_obj=self._codereview_impl.GetRieveldObjForPresubmit())
1321 gerrit_obj=self._codereview_impl.GetGerritObjForPresubmit())
1322 except presubmit_support.PresubmitFailure, e: 1321 except presubmit_support.PresubmitFailure, e:
1323 DieWithError( 1322 DieWithError(
1324 ('%s\nMaybe your depot_tools is out of date?\n' 1323 ('%s\nMaybe your depot_tools is out of date?\n'
1325 'If all fails, contact maruel@') % e) 1324 'If all fails, contact maruel@') % e)
1326 1325
1327 def CMDPatchIssue(self, issue_arg, reject, nocommit, directory): 1326 def CMDPatchIssue(self, issue_arg, reject, nocommit, directory):
1328 """Fetches and applies the issue patch from codereview to local branch.""" 1327 """Fetches and applies the issue patch from codereview to local branch."""
1329 if isinstance(issue_arg, (int, long)) or issue_arg.isdigit(): 1328 if isinstance(issue_arg, (int, long)) or issue_arg.isdigit():
1330 parsed_issue_arg = _ParsedIssueNumberArgument(int(issue_arg)) 1329 parsed_issue_arg = _ParsedIssueNumberArgument(int(issue_arg))
1331 else: 1330 else:
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1495 1494
1496 def PatchsetSetting(self): 1495 def PatchsetSetting(self):
1497 """Returns name of git config setting which stores issue number.""" 1496 """Returns name of git config setting which stores issue number."""
1498 raise NotImplementedError() 1497 raise NotImplementedError()
1499 1498
1500 def GetRieveldObjForPresubmit(self): 1499 def GetRieveldObjForPresubmit(self):
1501 # This is an unfortunate Rietveld-embeddedness in presubmit. 1500 # This is an unfortunate Rietveld-embeddedness in presubmit.
1502 # For non-Rietveld codereviews, this probably should return a dummy object. 1501 # For non-Rietveld codereviews, this probably should return a dummy object.
1503 raise NotImplementedError() 1502 raise NotImplementedError()
1504 1503
1505 def GetGerritObjForPresubmit(self):
1506 # None is valid return value, otherwise presubmit_support.GerritAccessor.
1507 return None
1508
1509 def UpdateDescriptionRemote(self, description): 1504 def UpdateDescriptionRemote(self, description):
1510 """Update the description on codereview site.""" 1505 """Update the description on codereview site."""
1511 raise NotImplementedError() 1506 raise NotImplementedError()
1512 1507
1513 def CloseIssue(self): 1508 def CloseIssue(self):
1514 """Closes the issue.""" 1509 """Closes the issue."""
1515 raise NotImplementedError() 1510 raise NotImplementedError()
1516 1511
1517 def GetApprovingReviewers(self): 1512 def GetApprovingReviewers(self):
1518 """Returns a list of reviewers approving the change. 1513 """Returns a list of reviewers approving the change.
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 def __getattr__(self, attr): 2100 def __getattr__(self, attr):
2106 print( 2101 print(
2107 'You aren\'t using Rietveld at the moment, but Gerrit.\n' 2102 'You aren\'t using Rietveld at the moment, but Gerrit.\n'
2108 'Using Rietveld in your PRESUBMIT scripts won\'t work.\n' 2103 'Using Rietveld in your PRESUBMIT scripts won\'t work.\n'
2109 'Please, either change your PRESUBIT to not use rietveld_obj.%s,\n' 2104 'Please, either change your PRESUBIT to not use rietveld_obj.%s,\n'
2110 'or use Rietveld for codereview.\n' 2105 'or use Rietveld for codereview.\n'
2111 'See also http://crbug.com/579160.' % attr) 2106 'See also http://crbug.com/579160.' % attr)
2112 raise NotImplementedError() 2107 raise NotImplementedError()
2113 return ThisIsNotRietveldIssue() 2108 return ThisIsNotRietveldIssue()
2114 2109
2115 def GetGerritObjForPresubmit(self):
2116 return presubmit_support.GerritAccessor(self._GetGerritHost())
2117
2118 def GetStatus(self): 2110 def GetStatus(self):
2119 """Apply a rough heuristic to give a simple summary of an issue's review 2111 """Apply a rough heuristic to give a simple summary of an issue's review
2120 or CQ status, assuming adherence to a common workflow. 2112 or CQ status, assuming adherence to a common workflow.
2121 2113
2122 Returns None if no issue for this branch, or one of the following keywords: 2114 Returns None if no issue for this branch, or one of the following keywords:
2123 * 'error' - error from review tool (including deleted issues) 2115 * 'error' - error from review tool (including deleted issues)
2124 * 'unsent' - no reviewers added 2116 * 'unsent' - no reviewers added
2125 * 'waiting' - waiting for review 2117 * 'waiting' - waiting for review
2126 * 'reply' - waiting for owner to reply to review 2118 * 'reply' - waiting for owner to reply to review
2127 * 'not lgtm' - Code-Review -2 from at least one approved reviewer 2119 * 'not lgtm' - Code-Review -2 from at least one approved reviewer
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after
4863 if __name__ == '__main__': 4855 if __name__ == '__main__':
4864 # These affect sys.stdout so do it outside of main() to simplify mocks in 4856 # These affect sys.stdout so do it outside of main() to simplify mocks in
4865 # unit testing. 4857 # unit testing.
4866 fix_encoding.fix_encoding() 4858 fix_encoding.fix_encoding()
4867 setup_color.init() 4859 setup_color.init()
4868 try: 4860 try:
4869 sys.exit(main(sys.argv[1:])) 4861 sys.exit(main(sys.argv[1:]))
4870 except KeyboardInterrupt: 4862 except KeyboardInterrupt:
4871 sys.stderr.write('interrupted\n') 4863 sys.stderr.write('interrupted\n')
4872 sys.exit(1) 4864 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | presubmit_canned_checks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698