Commit aba67768 authored by pam@chromium.org's avatar pam@chromium.org

Add a message that the list of directories needing owners may not be accurate...

Add a message that the list of directories needing owners may not be accurate on first upload, because we have no way to know whether the user is an OWNER for any of them.

BUG=117974
TEST=covered by presubmit unit tests

Review URL: http://codereview.chromium.org/9692039

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@126894 0039d316-1c4b-4281-b951-d872f2087c98
parent 2465527f
......@@ -752,19 +752,19 @@ def CheckOwners(input_api, output_api, source_file_filter=None):
approval_needed=input_api.is_committing)
if owner_email:
message = ''
reviewers_plus_owner = reviewers.union(set([owner_email]))
elif input_api.is_committing:
return [output_api.PresubmitWarning(
'The issue was not uploaded so you have no OWNER approval.')]
else:
message = ('\nUntil the issue is uploaded, this list will include '
'directories for which you \nare an OWNER.')
owner_email = ''
reviewers_plus_owner = set()
missing_directories = owners_db.directories_not_covered_by(affected_files,
reviewers_plus_owner)
if missing_directories:
return [output('Missing %s for files in these directories:\n %s' %
(needed, '\n '.join(missing_directories)))]
return [output('Missing %s for files in these directories:\n %s%s' %
(needed, '\n '.join(missing_directories), message))]
if input_api.is_committing and not reviewers:
return [output('Missing LGTM from someone other than %s' % owner_email)]
......
......@@ -2250,14 +2250,28 @@ class CannedChecksUnittest(PresubmitTestsBase):
rietveld_response=response,
expected_output='')
def testCannedCheckOwners_NoIssue(self):
def testCannedCheckOwners_NoIssueNoFiles(self):
self.AssertOwnersWorks(issue=None,
expected_output="OWNERS check failed: this change has no Rietveld "
"issue number, so we can't check it for approvals.\n")
self.AssertOwnersWorks(issue=None, is_committing=False,
expected_output="")
def testCannedCheckOwners_NoIssue(self):
self.AssertOwnersWorks(issue=None,
uncovered_dirs=set(['foo']),
expected_output="OWNERS check failed: this change has no Rietveld "
"issue number, so we can't check it for approvals.\n")
self.AssertOwnersWorks(issue=None,
is_committing=False,
uncovered_dirs=set(['foo']),
expected_output='Missing OWNER reviewers for files in these '
'directories:\n'
' foo\n'
'Until the issue is uploaded, this list will include '
'directories for which you \n'
'are an OWNER.\n')
def testCannedCheckOwners_NoLGTM(self):
self.AssertOwnersWorks(expected_output='Missing LGTM from someone '
'other than john@example.com\n')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment