OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 | |
6 def CheckChangeOnUpload(input_api, output_api): | |
7 """Warn when changing md_history without vulcanizing.""" | |
8 | |
9 def _is_md_history_file(path): | |
10 return (path.startswith('chrome/browser/resources/md_history') and | |
11 (not path.endswith('externs.js')) and | |
12 (path.endswith('js') or path.endswith('html'))) | |
13 | |
14 def _affects_file(filename, paths): | |
15 return any([filename in path for path in paths]) | |
16 | |
17 paths = [x.LocalPath() for x in input_api.change.AffectedFiles()] | |
18 vulcanize_changes = (_affects_file('md_history/app.vulcanized.html', paths) or | |
19 _affects_file('md_history/app.crisper.js', paths)) | |
20 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
| |
21 | |
22 if history_changes and not vulcanize_changes: | |
23 return [output_api.PresubmitPromptWarning( | |
24 'Vulcanize must be run when changing files in md_history. See ' | |
25 '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.
| |
26 return [] | |
OLD | NEW |