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

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

Issue 2251403002: [MD History] Use modified time to check staleness of vulcanize and crisper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit Created 4 years, 4 months 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 0f0b511dd73ff73a9b9b7f9e49837c6636df1161..a1f55a98f94faa76718b2bfea416bc1cd69301e2 100644
--- a/chrome/browser/resources/md_history/PRESUBMIT.py
+++ b/chrome/browser/resources/md_history/PRESUBMIT.py
@@ -2,6 +2,8 @@
# 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."""
@@ -15,11 +17,15 @@ def CheckChangeOnUpload(input_api, output_api):
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))
+ earliest_vulcanize_change = min(os.path.getmtime(x) for x in
+ ['app.vulcanized.html', 'app.crisper.js'])
history_changes = filter(_is_md_history_file, paths)
+ 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 history_changes and not vulcanize_changes:
+ if latest_history_change > earliest_vulcanize_change:
return [output_api.PresubmitPromptWarning(
'Vulcanize must be run when changing files in md_history. See '
'docs/vulcanize.md.')]
« 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