From 9641e22aa3ab02a7ed362f9301c20fe8924aa842 Mon Sep 17 00:00:00 2001 From: "enne@chromium.org" Date: Mon, 29 Nov 2010 18:30:15 +0000 Subject: Specify branch when fetching in sync-webkit-git.py. This allows the fetch to succeed even when the current WebKit branch has a different remote than the magic gclient branch. BUG=63850 TEST=none Review URL: http://codereview.chromium.org/5185005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67565 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/sync-webkit-git.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/sync-webkit-git.py b/tools/sync-webkit-git.py index f54976c..96ecc15 100755 --- a/tools/sync-webkit-git.py +++ b/tools/sync-webkit-git.py @@ -30,12 +30,16 @@ 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.""" # Is there an override branch specified? - overide_config_name = 'chromium.sync-branch' - override_branch_name = RunGit(['config', '--get', overide_config_name]) + override_branch_name = GetOverrideShortBranchName() if not override_branch_name: return 'refs/heads/gclient' # No override, so return the default branch. @@ -101,6 +105,16 @@ def FindSVNRev(target_rev): print "Something has likely gone horribly wrong." return None +def GetRemote(): + branch = GetOverrideShortBranchName() + if not branch: + branch = 'gclient' + + remote = RunGit(['config', '--get', 'branch.' + branch + '.remote']) + if remote: + return remote + return 'origin' + def UpdateGClientBranch(webkit_rev, magic_gclient_branch): """Update the magic gclient branch to point at |webkit_rev|. @@ -108,7 +122,8 @@ def UpdateGClientBranch(webkit_rev, magic_gclient_branch): target = FindSVNRev(webkit_rev) if not target: print "r%s not available; fetching." % webkit_rev - subprocess.check_call(['git', 'fetch'], shell=(os.name == 'nt')) + subprocess.check_call(['git', 'fetch', GetRemote()], + shell=(os.name == 'nt')) target = FindSVNRev(webkit_rev) if not target: print "ERROR: Couldn't map r%s to a git revision." % webkit_rev -- cgit v1.1