diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2010-12-07 17:22:45 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2010-12-22 14:15:40 -0800 |
commit | 4576aa36e9a9671459299c7963ac95aa94beaea9 (patch) | |
tree | 3863574e050f168c0126ecb47c83319fab0972d8 /WebKitTools/Scripts/webkitpy/common/checkout | |
parent | 55323ac613cc31553107b68603cb627264d22bb0 (diff) | |
download | external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.zip external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.gz external_webkit-4576aa36e9a9671459299c7963ac95aa94beaea9.tar.bz2 |
Merge WebKit at r73109: Initial merge by git.
Change-Id: I61f1a66d9642e3d8405d3ac6ccab2a53421c75d8
Diffstat (limited to 'WebKitTools/Scripts/webkitpy/common/checkout')
-rw-r--r-- | WebKitTools/Scripts/webkitpy/common/checkout/scm.py | 27 | ||||
-rw-r--r-- | WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py | 4 |
2 files changed, 17 insertions, 14 deletions
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py index 11e82ac..d39b8b4 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py @@ -597,7 +597,8 @@ class Git(SCM): @classmethod def read_git_config(cls, key): # FIXME: This should probably use cwd=self.checkout_root. - return run_command(["git", "config", key], + # Pass --get-all for cases where the config has multiple values + return run_command(["git", "config", "--get-all", key], error_handler=Executive.ignore_error).rstrip('\n') @staticmethod @@ -854,19 +855,17 @@ class Git(SCM): def remote_branch_ref(self): # Use references so that we can avoid collisions, e.g. we don't want to operate on refs/heads/trunk if it exists. - - # FIXME: This should so something like: Git.read_git_config('svn-remote.svn.fetch').split(':')[1] - # but that doesn't work if the git repo is tracking multiple svn branches. - remote_branch_refs = [ - 'refs/remotes/trunk', # A git-svn checkout as per http://trac.webkit.org/wiki/UsingGitWithWebKit. - 'refs/remotes/origin/master', # A git clone of git://git.webkit.org/WebKit.git that is not tracking svn. - ] - - for ref in remote_branch_refs: - if self._branch_ref_exists(ref): - return ref - - raise ScriptError(message="Can't find a branch to diff against. %s branches do not exist." % " and ".join(remote_branch_refs)) + remote_branch_refs = Git.read_git_config('svn-remote.svn.fetch') + if not remote_branch_refs: + remote_master_ref = 'refs/remotes/origin/master' + if not self._branch_ref_exists(remote_master_ref): + raise ScriptError(message="Can't find a branch to diff against. svn-remote.svn.fetch is not in the git config and %s does not exist" % remote_master_ref) + return remote_master_ref + + # FIXME: What's the right behavior when there are multiple svn-remotes listed? + # For now, just use the first one. + first_remote_branch_ref = remote_branch_refs.split('\n')[0] + return first_remote_branch_ref.split(':')[1] def commit_locally_with_message(self, message): self.run(['git', 'commit', '--all', '-F', '-'], input=message) diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py index 8af9ad5..46a2acf 100644 --- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py +++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py @@ -803,6 +803,10 @@ class GitTest(SCMTest): os.chdir(self.untracking_checkout_path) self.assertRaises(ScriptError, self.untracking_scm.remote_branch_ref) + def test_multiple_remotes(self): + run_command(['git', 'config', '--add', 'svn-remote.svn.fetch', 'trunk:remote1']) + run_command(['git', 'config', '--add', 'svn-remote.svn.fetch', 'trunk:remote2']) + self.assertEqual(self.tracking_scm.remote_branch_ref(), 'remote1') class GitSVNTest(SCMTest): |