1197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# Copyright (C) 2014 Google Inc. All rights reserved. 2197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# 3197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# Redistribution and use in source and binary forms, with or without 4197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# modification, are permitted provided that the following conditions are 5197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# met: 6197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# 7197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# * Redistributions of source code must retain the above copyright 8197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# notice, this list of conditions and the following disclaimer. 9197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# * Redistributions in binary form must reproduce the above 10197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# copyright notice, this list of conditions and the following disclaimer 11197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# in the documentation and/or other materials provided with the 12197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# distribution. 13197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# * Neither the name of Google Inc. nor the names of its 14197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# contributors may be used to endorse or promote products derived from 15197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# this software without specific prior written permission. 16197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# 17197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 29197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 30197021e6b966cfb06891637935ef33fff06433d1Ben Murdochdef _CheckCodeMirrorChanges(input_api, output_api): 31197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch errorText = ("ERROR: Attempt to modify CodeMirror. The only allowed changes are " 32197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch "rolls from the upstream (http://codemirror.net). If this is a roll, " 33197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch "make sure you mention 'roll CodeMirror' (no quotes) in the change description.\n" 34197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch "CodeMirror rolling instructions:\n" 35197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch " https://sites.google.com/a/chromium.org/devtools-codemirror-rolling") 36197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch changeDescription = input_api.change.DescriptionText() 37197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch errors = [] 38197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch if not "roll codemirror" in changeDescription.lower(): 39197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch errors.append(output_api.PresubmitError(errorText)) 40197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch return errors 41197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 42197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch 43197021e6b966cfb06891637935ef33fff06433d1Ben Murdochdef CheckChangeOnUpload(input_api, output_api): 44197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch results = [] 45197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch results.extend(_CheckCodeMirrorChanges(input_api, output_api)) 46197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch return results 47