| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return True | 68 return True |
| 69 | 69 |
| 70 def UpdateCurrentCheckoutIfAppropriate(): | 70 def UpdateCurrentCheckoutIfAppropriate(): |
| 71 """Reset the current gclient branch if that's what we have checked out.""" | 71 """Reset the current gclient branch if that's what we have checked out.""" |
| 72 branch = RunGit(['symbolic-ref', '-q', 'HEAD']) | 72 branch = RunGit(['symbolic-ref', '-q', 'HEAD']) |
| 73 if branch != MAGIC_GCLIENT_BRANCH: | 73 if branch != MAGIC_GCLIENT_BRANCH: |
| 74 print "Directory has some other branch ('%s') checked out." % branch | 74 print "Directory has some other branch ('%s') checked out." % branch |
| 75 print "Run 'git checkout gclient' to put this under control of gclient." | 75 print "Run 'git checkout gclient' to put this under control of gclient." |
| 76 return | 76 return |
| 77 | 77 |
| 78 if subprocess.call(['git', 'diff-index', '--exit-code', 'HEAD']): | 78 if subprocess.call(['git', 'diff-index', '--exit-code', '--shortstat', |
| 79 » 'HEAD']): |
| 79 print "Resetting tree state to new revision." | 80 print "Resetting tree state to new revision." |
| 80 subprocess.check_call(['git', 'reset', '--hard']) | 81 subprocess.check_call(['git', 'reset', '--hard']) |
| 81 | 82 |
| 82 def main(): | 83 def main(): |
| 83 webkit_rev = GetWebKitRev() | 84 webkit_rev = GetWebKitRev() |
| 84 print 'Desired revision: r%s.' % webkit_rev | 85 print 'Desired revision: r%s.' % webkit_rev |
| 85 os.chdir('third_party/WebKit') | 86 os.chdir('third_party/WebKit') |
| 86 changed = UpdateGClientBranch(webkit_rev) | 87 changed = UpdateGClientBranch(webkit_rev) |
| 87 if changed: | 88 if changed: |
| 88 UpdateCurrentCheckoutIfAppropriate() | 89 UpdateCurrentCheckoutIfAppropriate() |
| 89 | 90 |
| 90 if __name__ == '__main__': | 91 if __name__ == '__main__': |
| 91 main() | 92 main() |
| OLD | NEW |