Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1470)

Unified Diff: chrome/browser/resources/md_history/PRESUBMIT.py

Issue 2599593003: Touch up md_history presubmit (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698