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

Side by Side Diff: tools/safely-roll-webkit.py

Issue 10532110: Show old revision number in WebKit rolls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generate a CL to roll webkit to the specified revision number and post 6 """Generate a CL to roll webkit to the specified revision number and post
7 it to Rietveld so that the CL will land automatically if it passes the 7 it to Rietveld so that the CL will land automatically if it passes the
8 commit-queue's checks. 8 commit-queue's checks.
9 """ 9 """
10 10
(...skipping 17 matching lines...) Expand all
28 """Update webkit_revision to |new_issue|. 28 """Update webkit_revision to |new_issue|.
29 29
30 A bit hacky, could it be made better? 30 A bit hacky, could it be made better?
31 """ 31 """
32 content = open(path).read() 32 content = open(path).read()
33 old_line = r'(\s+)"webkit_revision": "(\d+)",' 33 old_line = r'(\s+)"webkit_revision": "(\d+)",'
34 new_line = r'\1"webkit_revision": "%d",' % new_rev 34 new_line = r'\1"webkit_revision": "%d",' % new_rev
35 new_content = re.sub(old_line, new_line, content, 1) 35 new_content = re.sub(old_line, new_line, content, 1)
36 if new_content == content: 36 if new_content == content:
37 die_with_error('Failed to update the DEPS file') 37 die_with_error('Failed to update the DEPS file')
38
39 old_rev = re.search(old_line, content)
M-A Ruel 2012/06/12 22:01:29 what about moving this just before line 35 and "as
38 open(path, 'w').write(new_content) 40 open(path, 'w').write(new_content)
41 return old_rev.group(2)
39 42
40 43
41 def main(): 44 def main():
42 tool_dir = os.path.dirname(os.path.abspath(__file__)) 45 tool_dir = os.path.dirname(os.path.abspath(__file__))
43 parser = optparse.OptionParser(usage='<new webkit rev>') 46 parser = optparse.OptionParser(usage='<new webkit rev>')
44 parser.add_option('-v', '--verbose', action='count', default=0) 47 parser.add_option('-v', '--verbose', action='count', default=0)
45 options, args = parser.parse_args() 48 options, args = parser.parse_args()
46 logging.basicConfig( 49 logging.basicConfig(
47 level= 50 level=
48 [logging.WARNING, logging.INFO, logging.DEBUG][ 51 [logging.WARNING, logging.INFO, logging.DEBUG][
49 min(2, options.verbose)]) 52 min(2, options.verbose)])
50 if len(args) != 1: 53 if len(args) != 1:
51 parser.error('Need only one arg: new webkit revision to roll to.') 54 parser.error('Need only one arg: new webkit revision to roll to.')
52 55
53 root_dir = os.path.dirname(tool_dir) 56 root_dir = os.path.dirname(tool_dir)
54 os.chdir(root_dir) 57 os.chdir(root_dir)
55 58
56 new_rev = int(args[0]) 59 new_rev = int(args[0])
57 msg = 'Roll webkit revision to %s' % new_rev 60 print 'Roll webkit revision to %s' % new_rev
58 print msg
59 61
60 # Silence the editor. 62 # Silence the editor.
61 os.environ['EDITOR'] = 'true' 63 os.environ['EDITOR'] = 'true'
62 64
63 old_branch = scm.GIT.GetBranch(root_dir) 65 old_branch = scm.GIT.GetBranch(root_dir)
64 if old_branch == 'webkit_roll': 66 if old_branch == 'webkit_roll':
65 parser.error( 67 parser.error(
66 'Please delete the branch webkit_roll and move to a different branch') 68 'Please delete the branch webkit_roll and move to a different branch')
67 subprocess2.check_output( 69 subprocess2.check_output(
68 ['git', 'checkout', '-b', 'webkit_roll', 'origin/master']) 70 ['git', 'checkout', '-b', 'webkit_roll', 'origin/master'])
69 try: 71 try:
70 process_deps(os.path.join(root_dir, 'DEPS'), new_rev) 72 old_rev = process_deps(os.path.join(root_dir, 'DEPS'), new_rev)
71 commit_msg = msg + '\n\nTBR=\n' 73 commit_msg = 'Webkit roll %s:%s\n\nTBR=\n' % (old_rev, new_rev)
72 subprocess2.check_output(['git', 'commit', '-m', commit_msg, 'DEPS']) 74 subprocess2.check_output(['git', 'commit', '-m', commit_msg, 'DEPS'])
73 subprocess2.check_call(['git', 'diff', 'origin/master']) 75 subprocess2.check_call(['git', 'diff', 'origin/master'])
74 subprocess2.check_call(['git', 'cl', 'upload', '--use-commit-queue']) 76 subprocess2.check_call(['git', 'cl', 'upload', '--use-commit-queue'])
75 finally: 77 finally:
76 subprocess2.check_output(['git', 'checkout', old_branch]) 78 subprocess2.check_output(['git', 'checkout', old_branch])
77 subprocess2.check_output(['git', 'branch', '-D', 'webkit_roll']) 79 subprocess2.check_output(['git', 'branch', '-D', 'webkit_roll'])
78 return 0 80 return 0
79 81
80 82
81 if __name__ == '__main__': 83 if __name__ == '__main__':
82 sys.exit(main()) 84 sys.exit(main())
OLDNEW
« 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