diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 07:12:48 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-02 07:12:48 +0000 |
commit | 877264800c010ed75c0e60b6ae67fa8cdb4c0a08 (patch) | |
tree | 4fae7813f6fabe07551b09969d586f426a1c6ade /chrome/common/extensions/PRESUBMIT.py | |
parent | c4c7b0e6e704ff3a88598a1eecf0d920cf2fc5e6 (diff) | |
download | chromium_src-877264800c010ed75c0e60b6ae67fa8cdb4c0a08.zip chromium_src-877264800c010ed75c0e60b6ae67fa8cdb4c0a08.tar.gz chromium_src-877264800c010ed75c0e60b6ae67fa8cdb4c0a08.tar.bz2 |
Warn the user to regenerate docs when changing examples.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3331002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/PRESUBMIT.py')
-rw-r--r-- | chrome/common/extensions/PRESUBMIT.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/chrome/common/extensions/PRESUBMIT.py b/chrome/common/extensions/PRESUBMIT.py new file mode 100644 index 0000000..4370630 --- /dev/null +++ b/chrome/common/extensions/PRESUBMIT.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# Copyright (c) 2009 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. + +import os.path + +# When files in these directories are changed, we display a warning. +DEPENDENT_DIRS = set([ + os.path.normpath("chrome/common/extensions/api"), + os.path.normpath("chrome/common/extensions/docs") +]) + +# Except for these directories. +BLACKLIST_DIRS = set([ + os.path.normpath("chrome/common/extensions/docs/server") +]) + +REBUILD_WARNING = """ +This change modifies file(s) which the extension docs depend on. You must +rebuild the extension docs. + +Build by running the build.py script in chrome/common/extensions/docs/build/. + +Be sure to include any modified resulting static files +(/common/extension/docs/*.html) in your final changelist. +""" + +def CheckChange(input_api, output_api): + for f in input_api.AffectedFiles(): + dir = os.path.normpath(input_api.os_path.dirname(f.LocalPath())) + while len(dir): + if dir in BLACKLIST_DIRS: + return [] + if dir in DEPENDENT_DIRS: + return [output_api.PresubmitPromptWarning(REBUILD_WARNING)] + dir = os.path.dirname(dir) + return [] + +def CheckChangeOnUpload(input_api, output_api): + return CheckChange(input_api, output_api) + +def CheckChangeOnCommit(input_api, output_api): + return CheckChange(input_api, output_api) |