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

Unified Diff: tools/sync-webkit-git.py

Issue 8678023: Fix python scripts in src/tools/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/symsrc/source_index.py ('k') | tools/traceline/traceline/scripts/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sync-webkit-git.py
diff --git a/tools/sync-webkit-git.py b/tools/sync-webkit-git.py
index 4a99886287d8d37a71cd7345b7c3e5eb5b7ebe97..4b98d9cefd49e824849da8d5be27a0ea266c2cb4 100755
--- a/tools/sync-webkit-git.py
+++ b/tools/sync-webkit-git.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -19,6 +19,7 @@ import re
import subprocess
import sys
+
def RunGit(command):
"""Run a git subcommand, returning its output."""
# On Windows, use shell=True to get PATH interpretation.
@@ -30,11 +31,13 @@ def RunGit(command):
logging.info('Returned "%s"' % out)
return out
+
def GetOverrideShortBranchName():
"""Returns the user-configured override branch name, if any."""
override_config_name = 'chromium.sync-branch'
return RunGit(['config', '--get', override_config_name])
+
def GetGClientBranchName():
"""Returns the name of the magic branch that lets us know that DEPS is
managing the update cycle."""
@@ -55,6 +58,7 @@ def GetGClientBranchName():
print "Please fix your git config value '%s'." % overide_config_name
sys.exit(1)
+
def GetWebKitRev():
"""Extract the 'webkit_revision' variable out of DEPS."""
locals = {'Var': lambda _: locals["vars"][_],
@@ -62,6 +66,7 @@ def GetWebKitRev():
execfile('DEPS', {}, locals)
return locals['vars']['webkit_revision']
+
def FindSVNRev(target_rev):
"""Map an SVN revision to a git hash.
Like 'git svn find-rev' but without the git-svn bits."""
@@ -106,6 +111,7 @@ def FindSVNRev(target_rev):
print "Something has likely gone horribly wrong."
return None
+
def GetRemote():
branch = GetOverrideShortBranchName()
if not branch:
@@ -116,6 +122,7 @@ def GetRemote():
return remote
return 'origin'
+
def UpdateGClientBranch(webkit_rev, magic_gclient_branch):
"""Update the magic gclient branch to point at |webkit_rev|.
@@ -139,6 +146,7 @@ def UpdateGClientBranch(webkit_rev, magic_gclient_branch):
shell=(os.name == 'nt'))
return True
+
def UpdateCurrentCheckoutIfAppropriate(magic_gclient_branch):
"""Reset the current gclient branch if that's what we have checked out."""
branch = RunGit(['symbolic-ref', '-q', 'HEAD'])
@@ -154,6 +162,7 @@ def UpdateCurrentCheckoutIfAppropriate(magic_gclient_branch):
print "Resetting tree state to new revision."
subprocess.check_call(['git', 'reset', '--hard'], shell=(os.name == 'nt'))
+
def main():
parser = optparse.OptionParser()
parser.add_option('-v', '--verbose', action='store_true')
@@ -182,5 +191,6 @@ def main():
print "Already on correct revision."
return 0
+
if __name__ == '__main__':
sys.exit(main())
« no previous file with comments | « tools/symsrc/source_index.py ('k') | tools/traceline/traceline/scripts/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698