summaryrefslogtreecommitdiff
path: root/chromium/components/segmentation_platform/internal/proto/PRESUBMIT.py
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/segmentation_platform/internal/proto/PRESUBMIT.py')
-rw-r--r--chromium/components/segmentation_platform/internal/proto/PRESUBMIT.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/chromium/components/segmentation_platform/internal/proto/PRESUBMIT.py b/chromium/components/segmentation_platform/internal/proto/PRESUBMIT.py
new file mode 100644
index 00000000000..e4183d8e5c7
--- /dev/null
+++ b/chromium/components/segmentation_platform/internal/proto/PRESUBMIT.py
@@ -0,0 +1,30 @@
+# Copyright 2022 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
+for more details on the presubmit API built into depot_tools.
+"""
+
+USE_PYTHON3 = True
+
+def CheckChange(input_api, output_api):
+ cwd = input_api.PresubmitLocalPath()
+ for f in input_api.AffectedFiles():
+ p = f.AbsoluteLocalPath()
+
+ # Only do PRESUBMIT checks when |p| is under |cwd| and is a proto file.
+ if input_api.os_path.commonprefix([p, cwd]) == cwd \
+ and p.endswith('.proto'):
+ return [output_api.PresubmitPromptWarning(
+ 'Segmentation platform proto files were updated, consider ' +
+ 'updating the VERSION field in components/' +
+ 'segmentation_platform/internal/proto/model_metadata.proto.')]
+ return []
+
+def CheckChangeOnUpload(input_api, output_api):
+ return CheckChange(input_api, output_api)
+
+def CheckChangeOnCommit(input_api, output_api):
+ return CheckChange(input_api, output_api)