OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 def GetWebKitRev(): | 28 def GetWebKitRev(): |
29 """Extract the 'webkit_revision' variable out of DEPS.""" | 29 """Extract the 'webkit_revision' variable out of DEPS.""" |
30 locals = {'Var': lambda _: ''} | 30 locals = {'Var': lambda _: ''} |
31 execfile('DEPS', {}, locals) | 31 execfile('DEPS', {}, locals) |
32 return locals['vars']['webkit_revision'] | 32 return locals['vars']['webkit_revision'] |
33 | 33 |
34 def FindSVNRev(rev): | 34 def FindSVNRev(rev): |
35 """Map an SVN revision to a git hash. | 35 """Map an SVN revision to a git hash. |
36 Like 'git svn find-rev' but without the git-svn bits.""" | 36 Like 'git svn find-rev' but without the git-svn bits.""" |
37 # We find r123 by grepping for a line with "git-svn-id: blahblahblah@123". | 37 # We find r123 by grepping for a line with "git-svn-id: blahblahblah@123". |
38 return RunGit(['rev-list', '-n', '1', '--grep=^git-svn-id: .*@%s$' % rev, | 38 return RunGit(['rev-list', '-n', '1', '--grep=^git-svn-id: .*trunk@%s ' % rev, |
39 'origin']) | 39 'origin']) |
40 | 40 |
41 def UpdateGClientBranch(webkit_rev): | 41 def UpdateGClientBranch(webkit_rev): |
42 """Update the magic gclient branch to point at |webkit_rev|. | 42 """Update the magic gclient branch to point at |webkit_rev|. |
43 | 43 |
44 Returns: true if the branch didn't need changes.""" | 44 Returns: true if the branch didn't need changes.""" |
45 target = FindSVNRev(webkit_rev) | 45 target = FindSVNRev(webkit_rev) |
46 if not target: | 46 if not target: |
47 print "r%s not available; fetching." % webkit_rev | 47 print "r%s not available; fetching." % webkit_rev |
48 subprocess.check_call(['git', 'fetch']) | 48 subprocess.check_call(['git', 'fetch']) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 print 'Desired revision: r%s.' % webkit_rev | 84 print 'Desired revision: r%s.' % webkit_rev |
85 os.chdir('third_party/WebKit') | 85 os.chdir('third_party/WebKit') |
86 changed = UpdateGClientBranch(webkit_rev) | 86 changed = UpdateGClientBranch(webkit_rev) |
87 if changed: | 87 if changed: |
88 UpdateCurrentCheckoutIfAppropriate() | 88 UpdateCurrentCheckoutIfAppropriate() |
89 else: | 89 else: |
90 print "Already on correct revision." | 90 print "Already on correct revision." |
91 | 91 |
92 if __name__ == '__main__': | 92 if __name__ == '__main__': |
93 main() | 93 main() |
OLD | NEW |