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

Side by Side Diff: tools/sync-webkit-git.py

Issue 3015007: sync-webkit-git: exit with an error code on failure (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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 | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 """Update third_party/WebKit using git. 6 """Update third_party/WebKit using git.
7 7
8 Under the assumption third_party/WebKit is a clone of git.webkit.org, 8 Under the assumption third_party/WebKit is a clone of git.webkit.org,
9 we can use git commands to make it match the version requested by DEPS. 9 we can use git commands to make it match the version requested by DEPS.
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 return True 98 return True
99 99
100 def UpdateCurrentCheckoutIfAppropriate(): 100 def UpdateCurrentCheckoutIfAppropriate():
101 """Reset the current gclient branch if that's what we have checked out.""" 101 """Reset the current gclient branch if that's what we have checked out."""
102 branch = RunGit(['symbolic-ref', '-q', 'HEAD']) 102 branch = RunGit(['symbolic-ref', '-q', 'HEAD'])
103 if branch != MAGIC_GCLIENT_BRANCH: 103 if branch != MAGIC_GCLIENT_BRANCH:
104 print "We have now updated the 'gclient' branch, but third_party/WebKit" 104 print "We have now updated the 'gclient' branch, but third_party/WebKit"
105 print "has some other branch ('%s') checked out." % branch 105 print "has some other branch ('%s') checked out." % branch
106 print "Run 'git checkout gclient' under third_party/WebKit if you want" 106 print "Run 'git checkout gclient' under third_party/WebKit if you want"
107 print "to switch it to the version requested by DEPS." 107 print "to switch it to the version requested by DEPS."
108 return 108 return 1
109 109
110 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat', 110 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat',
111 'HEAD']): 111 'HEAD']):
112 print "Resetting tree state to new revision." 112 print "Resetting tree state to new revision."
113 subprocess.check_call(['git', 'reset', '--hard']) 113 subprocess.check_call(['git', 'reset', '--hard'])
114 114
115 def main(): 115 def main():
116 if not os.path.exists('third_party/WebKit/.git'): 116 if not os.path.exists('third_party/WebKit/.git'):
117 if os.path.exists('third_party/WebKit'): 117 if os.path.exists('third_party/WebKit'):
118 print "ERROR: third_party/WebKit appears to not be under git control." 118 print "ERROR: third_party/WebKit appears to not be under git control."
119 else: 119 else:
120 print "ERROR: third_party/WebKit could not be found." 120 print "ERROR: third_party/WebKit could not be found."
121 print "Did you run this script from the right directory?" 121 print "Did you run this script from the right directory?"
122 122
123 print "See http://code.google.com/p/chromium/wiki/UsingWebKitGit for" 123 print "See http://code.google.com/p/chromium/wiki/UsingWebKitGit for"
124 print "setup instructions." 124 print "setup instructions."
125 return 125 return 1
126 126
127 webkit_rev = GetWebKitRev() 127 webkit_rev = GetWebKitRev()
128 print 'Desired revision: r%s.' % webkit_rev 128 print 'Desired revision: r%s.' % webkit_rev
129 os.chdir('third_party/WebKit') 129 os.chdir('third_party/WebKit')
130 changed = UpdateGClientBranch(webkit_rev) 130 changed = UpdateGClientBranch(webkit_rev)
131 if changed: 131 if changed:
132 UpdateCurrentCheckoutIfAppropriate() 132 return UpdateCurrentCheckoutIfAppropriate()
133 else: 133 else:
134 print "Already on correct revision." 134 print "Already on correct revision."
tony 2010/07/17 01:26:54 Nit: Specify a return 0 at the end of the function
135 135
136 if __name__ == '__main__': 136 if __name__ == '__main__':
137 main() 137 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