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 |
index 2c041a4c7e7125da3426f63f4a4332936ac540cd..8f2ca60f2095074f53b033c810b58bd0d34ea25a 100644 |
--- a/chrome/browser/resources/md_history/PRESUBMIT.py |
+++ b/chrome/browser/resources/md_history/PRESUBMIT.py |
@@ -2,30 +2,29 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
-import os.path |
-import time |
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 |
- (not path.endswith('crisper.js')) and |
- (not path.endswith('vulcanized.html')) and |
- (path.endswith('js') or path.endswith('html'))) |
+ def _is_history_source_file(file): |
+ path = file.LocalPath() |
+ return (not path.endswith('externs.js') and |
+ not path.endswith('crisper.js') and |
+ not path.endswith('vulcanized.html') and |
+ (path.endswith('.js') or path.endswith('.html'))) |
- paths = [x.LocalPath() for x in input_api.change.AffectedFiles()] |
- earliest_vulcanize_change = min(os.path.getmtime(x) for x in |
+ os_path = input_api.os_path |
+ earliest_vulcanize_change = min(os_path.getmtime(x) for x in |
['app.vulcanized.html', |
'app.crisper.js', |
'lazy_load.vulcanized.html', |
'lazy_load.crisper.js']) |
- history_changes = filter(_is_md_history_file, paths) |
+ |
+ source_files = input_api.AffectedFiles(file_filter=_is_history_source_file) |
latest_history_change = 0 |
- if history_changes: |
- latest_history_change = max(os.path.getmtime(os.path.split(x)[1]) for x in |
- history_changes) |
+ if source_files: |
+ latest_history_change = max( |
+ os_path.getmtime(os_path.basename(f.LocalPath())) for f in source_files) |
if latest_history_change > earliest_vulcanize_change: |
return [output_api.PresubmitPromptWarning( |