Presubmit script that prohibits cls to both trunk/webrtc and trunk/talk.

BUG=N/A
R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/7999006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5582 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrike@webrtc.org 2014-02-19 23:18:19 +00:00
parent 78f0db4710
commit 056176b962

View File

@ -93,6 +93,23 @@ def _CheckApprovedFilesLintClean(input_api, output_api,
return result
def _CheckTalkOrWebrtcOnly(input_api, output_api):
base_folders = set(["webrtc", "talk"])
base_folders_in_cl = set()
for f in input_api.AffectedFiles():
full_path = f.LocalPath()
base_folders_in_cl.add(full_path[:full_path.find('/')])
results = []
if base_folders.issubset(base_folders_in_cl):
error_type = output_api.PresubmitError
results.append(error_type(
'It is not allowed to check in files to ' + ', '.join(base_folders) +
' in the same cl',
[]))
return results
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
# TODO(kjellander): Use presubmit_canned_checks.PanProjectChecks too.
@ -133,6 +150,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckApprovedFilesLintClean(input_api, output_api))
results.extend(_CheckNoIOStreamInHeaders(input_api, output_api))
results.extend(_CheckNoFRIEND_TEST(input_api, output_api))
results.extend(_CheckTalkOrWebrtcOnly(input_api, output_api))
return results
def CheckChangeOnUpload(input_api, output_api):