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

Side by Side Diff: PRESUBMIT.py

Issue 9432013: Add presubmit checks and watchlist for FFmpeg repo. (Closed) Base URL: ssh://gerrit.chromium.org:29418/chromium/third_party/ffmpeg.git@master
Patch Set: Remove status. Created 8 years, 10 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 | « no previous file | codereview.settings » ('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 (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Presubmit script for FFmpeg repository.
6
7 Does the following:
8 - Displays a message indicating that all changes must be pushed to SVN.
9 - Prevents changes inside the git-svn and svn repositories.
10 - Warns users when a change is made without updating the README file.
11 """
12
13 import re
14 import subprocess
15
16
17 # Setup some basic ANSI colors.
18 BOLD_RED = '\033[1;31m'
19 BOLD_BLUE = '\033[1;34m'
20
21
22 def Color(color, string):
23 return ''.join([color, string, '\033[m'])
24
25
26 def _CheckForMainRepository(input_api, output_api):
27 """Ensure no commits are allowed to the Subversion repository."""
28 try:
29 stdout = subprocess.Popen('git config --get remote.origin.url', shell=True,
30 cwd=input_api.PresubmitLocalPath(),
31 stdout=subprocess.PIPE).communicate()[0]
32 if 'chromium/third_party/ffmpeg.git' in stdout:
33 return []
34 except Exception, e:
35 # Not everyone has a working Git configuration, so print the exception text
36 # and move on.
37 print e
38
39 return [output_api.PresubmitError('\n'.join([
40 'Commits to the FFmpeg repository must be made through Git. The easiest',
41 'way to do this is to switch to using NewGit:\n',
42 ' http://code.google.com/p/chromium/wiki/UsingNewGit\n',
43 'Alternatively, you can clone the repository directly using:\n',
44 ' git clone http://git.chromium.org/chromium/third_party/ffmpeg.git']))]
45
46
47 def _WarnAboutManualSteps():
48 """Warn about the manual steps required for rolling the FFmpeg repository."""
49 print Color(BOLD_RED, '[ REMEMBER ]'.center(70, '*'))
50 print Color(
51 BOLD_BLUE, '\n'.join([
52 'Updates to FFmpeg require the following additional manual steps:',
53 ' - Rebuild and commit of Chrome and Chromium Windows DLLs.',
54 ' - Push of new sources from Git to Subversion. See sync_svn.py.',
55 ' - Internal and external DEPS roll.',
56 ' - If new source files were added, generate_gyp.py must be run.\n',
57 'For help, please consult the following resources:',
58 ' - chromium/README.chromium help text.',
59 ' - Chromium development list: chromium-dev@chromium.org',
60 ' - "Communication" section of http://www.chromium.org/developers']))
61 print Color(BOLD_RED, 70 * '*')
62
63
64 def _WarnIfReadmeIsUnchanged(input_api, output_api):
65 """Warn if the README file hasn't been updated with change notes."""
66 readme_re = re.compile(r'.*[/\\]chromium[/\\]patches[/\\]README$')
67 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile):
68 if readme_re.match(f.LocalPath()):
69 return []
70
71 return [output_api.PresubmitPromptWarning('\n'.join([
72 'FFmpeg changes detected without any update to chromium/patches/README,',
73 'it\'s good practice to update this file with a note about your changes.'
74 ]))]
75
76
77 def CheckChangeOnUpload(input_api, output_api):
78 _WarnAboutManualSteps()
79 results = []
80 results.extend(_CheckForMainRepository(input_api, output_api))
81 results.extend(_WarnIfReadmeIsUnchanged(input_api, output_api))
82 return results
OLDNEW
« no previous file with comments | « no previous file | codereview.settings » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698