Index: chrome/browser/resources/md_history/PRESUBMIT.py |
diff --git a/chrome/browser/resources/md_history/PRESUBMIT.py b/chrome/browser/resources/md_history/PRESUBMIT.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8fc6e5efa5e46d2fbcd0992a8a7c17008495c5a8 |
--- /dev/null |
+++ b/chrome/browser/resources/md_history/PRESUBMIT.py |
@@ -0,0 +1,26 @@ |
+# Copyright 2016 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. |
+ |
+ |
+def CheckChangeOnUpload(input_api, output_api): |
+ """Warn when changing md_history without vulcanizing.""" |
+ |
+ def _is_md_history_file(path): |
+ return (path.startswith('chrome/browser/resources/md_history') and |
+ (not path.endswith('externs.js')) and |
+ (path.endswith('js') or path.endswith('html'))) |
+ |
+ def _affects_file(filename, paths): |
+ return any([filename in path for path in paths]) |
+ |
+ paths = [x.LocalPath() for x in input_api.change.AffectedFiles()] |
+ vulcanize_changes = (_affects_file('md_history/app.vulcanized.html', paths) or |
+ _affects_file('md_history/app.crisper.js', paths)) |
+ history_changes = filter(_is_md_history_file, paths) |
michaelpg
2016/08/11 07:42:14
IDK how useful this is; we ought to include change
tsergeant
2016/08/15 05:54:18
I'm aware that this will have false negatives, and
|
+ |
+ if history_changes and not vulcanize_changes: |
+ return [output_api.PresubmitPromptWarning( |
+ 'Vulcanize must be run when changing files in md_history. See ' |
+ 'chrome/browser/resources/vulcanize.py.')] |
michaelpg
2016/08/11 07:42:14
maybe docs/vulcanize.md instead?
tsergeant
2016/08/15 05:54:18
Done.
|
+ return [] |