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

Side by Side Diff: appengine/monorail/sql/PRESUBMIT.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « appengine/monorail/sitewide/userupdates.py ('k') | appengine/monorail/sql/alter-table-log.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Presubmit script just for Monorail's SQL files."""
7
8
9 def AlterTableCheck(input_api, output_api): # pragma: no cover
10 this_dir = input_api.PresubmitLocalPath()
11 sql_files = set(x for x in input_api.os_listdir(this_dir)
12 if (x.endswith('.sql') and x != 'queries.sql'))
13 log_file = input_api.os_path.join(this_dir, 'alter-table-log.txt')
14 affected_files = set(f.LocalPath() for f in input_api.AffectedTextFiles())
15
16 if (any(f in affected_files for f in sql_files) ^
17 (log_file in affected_files)):
18 return [output_api.PresubmitPromptOrNotify(
19 'It looks like you have modified the sql schema without updating\n'
20 'the alter-table-log, or vice versa. Are you sure you want to do this?')
21 ]
22 return []
23
24
25 def CheckChangeOnUpload(input_api, output_api): # pragma: no cover
26 output = AlterTableCheck(input_api, output_api)
27 return output
28
29
30 def CheckChangeOnCommit(input_api, output_api): # pragma: no cover
31 output = AlterTableCheck(input_api, output_api)
32 return output
OLDNEW
« no previous file with comments | « appengine/monorail/sitewide/userupdates.py ('k') | appengine/monorail/sql/alter-table-log.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698