[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ojan at chromium.org ojan at chromium.org
Wed Dec 22 16:23:56 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 727b88a1209c06b01edf212ac64c11471df7c463
Author: ojan at chromium.org <ojan at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 23 00:56:08 2010 +0000

    2010-11-22  Ojan Vafai  <ojan at chromium.org>
    
            Reviewed by Adam Barth.
    
            update scm to work with different remote branches
            https://bugs.webkit.org/show_bug.cgi?id=49949
    
            This works if there are multiple svn tracking branches
            and/or if the tracking branch is refs/remots/origin/master
            instead of refs/remotes/trunk which is the direction we're trying
            to head since that makes fetches faster.
    
            * Scripts/webkitpy/common/checkout/scm.py:
            * Scripts/webkitpy/common/checkout/scm_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72575 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 51c7009..54b00ab 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-22  Ojan Vafai  <ojan at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        update scm to work with different remote branches
+        https://bugs.webkit.org/show_bug.cgi?id=49949
+
+        This works if there are multiple svn tracking branches
+        and/or if the tracking branch is refs/remots/origin/master
+        instead of refs/remotes/trunk which is the direction we're trying
+        to head since that makes fetches faster.
+
+        * Scripts/webkitpy/common/checkout/scm.py:
+        * Scripts/webkitpy/common/checkout/scm_unittest.py:
+
 2010-11-22  Hayato Ito  <hayato at chromium.org>
 
         Reviewed by Shinichiro Hamaji.
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):
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list