[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
eric at webkit.org
eric at webkit.org
Sun Feb 20 22:57:15 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit dffe34a7b6f6fcd46c5468cc6478be9b177fbb25
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 14 12:33:22 2011 +0000
2011-01-14 Eric Seidel <eric at webkit.org>
Original patch from Peter Gal <galpater at inf.u-szeged.hu>
Reviewed by Adam Barth.
Fix when running Tools/Scripts/check-webkit-style without arguments.
https://bugs.webkit.org/show_bug.cgi?id=52261#c16
* Scripts/webkitpy/common/checkout/scm.py: Handle None for changed_files argument better in Git.create_patch method.
* Scripts/webkitpy/common/checkout/scm_unittest.py:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75787 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 36b9e09..514e482 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-14 Eric Seidel <eric at webkit.org>
+
+ Original patch from Peter Gal <galpater at inf.u-szeged.hu>
+
+ Reviewed by Adam Barth.
+
+ Fix when running Tools/Scripts/check-webkit-style without arguments.
+ https://bugs.webkit.org/show_bug.cgi?id=52261#c16
+
+ * Scripts/webkitpy/common/checkout/scm.py: Handle None for changed_files argument better in Git.create_patch method.
+ * Scripts/webkitpy/common/checkout/scm_unittest.py:
+
2011-01-04 Jochen Eisinger <jochen at chromium.org>
Reviewed by David Levin.
diff --git a/Tools/Scripts/webkitpy/common/checkout/scm.py b/Tools/Scripts/webkitpy/common/checkout/scm.py
index d5d29f5..421c0dc 100644
--- a/Tools/Scripts/webkitpy/common/checkout/scm.py
+++ b/Tools/Scripts/webkitpy/common/checkout/scm.py
@@ -145,16 +145,16 @@ class AmbiguousCommitError(Exception):
# SCM methods are expected to return paths relative to self.checkout_root.
class SCM:
- def __init__(self, cwd):
+ def __init__(self, cwd, executive=None):
self.cwd = cwd
self.checkout_root = self.find_checkout_root(self.cwd)
self.dryrun = False
+ self._executive = executive or Executive()
# A wrapper used by subclasses to create processes.
def run(self, args, cwd=None, input=None, error_handler=None, return_exit_code=False, return_stderr=True, decode_output=True):
# FIXME: We should set cwd appropriately.
- # FIXME: We should use Executive.
- return run_command(args,
+ return self._executive.run_command(args,
cwd=cwd,
input=input,
error_handler=error_handler,
@@ -266,7 +266,7 @@ class SCM:
def display_name(self):
self._subclass_must_implement()
- def create_patch(self, git_commit=None, changed_files=[]):
+ def create_patch(self, git_commit=None, changed_files=None):
self._subclass_must_implement()
def committer_email_for_revision(self, revision):
@@ -319,14 +319,15 @@ class SCM:
class SVN(SCM):
- # FIXME: We should move these values to a WebKit-specific config. file.
+ # FIXME: We should move these values to a WebKit-specific config file.
svn_server_host = "svn.webkit.org"
svn_server_realm = "<http://svn.webkit.org:80> Mac OS Forge"
- def __init__(self, cwd, patch_directories):
- SCM.__init__(self, cwd)
+ def __init__(self, cwd, patch_directories, executive=None):
+ SCM.__init__(self, cwd, executive)
self._bogus_dir = None
if patch_directories == []:
+ # FIXME: ScriptError is for Executive, this should probably be a normal Exception.
raise ScriptError(script_args=svn_info_args, message='Empty list of patch directories passed to SCM.__init__')
elif patch_directories == None:
self._patch_directories = [ospath.relpath(cwd, self.checkout_root)]
@@ -591,8 +592,8 @@ class SVN(SCM):
# All git-specific logic should go here.
class Git(SCM):
- def __init__(self, cwd):
- SCM.__init__(self, cwd)
+ def __init__(self, cwd, executive=None):
+ SCM.__init__(self, cwd, executive)
self._check_git_architecture()
def _machine_is_64bit(self):
@@ -745,11 +746,14 @@ class Git(SCM):
def display_name(self):
return "git"
- def create_patch(self, git_commit=None, changed_files=[]):
+ def create_patch(self, git_commit=None, changed_files=None):
"""Returns a byte array (str()) representing the patch file.
Patch files are effectively binary since they may contain
files of multiple different encodings."""
- return self.run(['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "-M", self.merge_base(git_commit), "--"] + changed_files, decode_output=False, cwd=self.checkout_root)
+ command = ['git', 'diff', '--binary', "--no-ext-diff", "--full-index", "-M", self.merge_base(git_commit), "--"]
+ if changed_files:
+ command += changed_files
+ return self.run(command, decode_output=False, cwd=self.checkout_root)
def _run_git_svn_find_rev(self, arg):
# git svn find-rev always exits 0, even when the revision or commit is not found.
diff --git a/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py b/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
index 8f24beb..64122b4 100644
--- a/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
+++ b/Tools/Scripts/webkitpy/common/checkout/scm_unittest.py
@@ -45,11 +45,12 @@ import shutil
from datetime import date
from webkitpy.common.checkout.api import Checkout
-from webkitpy.common.checkout.scm import detect_scm_system, SCM, SVN, CheckoutNeedsUpdate, commit_error_handler, AuthenticationError, AmbiguousCommitError, find_checkout_root, default_scm
+from webkitpy.common.checkout.scm import detect_scm_system, SCM, SVN, Git, CheckoutNeedsUpdate, commit_error_handler, AuthenticationError, AmbiguousCommitError, find_checkout_root, default_scm
from webkitpy.common.config.committers import Committer # FIXME: This should not be needed
from webkitpy.common.net.bugzilla import Attachment # FIXME: This should not be needed
from webkitpy.common.system.executive import Executive, run_command, ScriptError
from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.tool.mocktool import MockExecutive
# Eventually we will want to write tests which work for both scms. (like update_webkit, changed_files, etc.)
# Perhaps through some SCMTest base-class which both SVNTest and GitTest inherit from.
@@ -456,6 +457,7 @@ OcmYex&reD$;sO8*F9L)B
self.scm.add("added_dir/added_file")
self.assertTrue("added_dir/added_file" in self.scm.added_files())
+
class SVNTest(SCMTest):
@staticmethod
@@ -1316,5 +1318,20 @@ class GitSVNTest(SCMTest):
self.assertTrue("+Updated" in cached_diff)
self.assertTrue("-more test content" in cached_diff)
+
+# We need to split off more of these SCM tests to use mocks instead of the filesystem.
+# This class is the first part of that.
+class GitTestWithMock(unittest.TestCase):
+ def setUp(self):
+ executive = MockExecutive(should_log=False)
+ # We do this should_log dance to avoid logging when Git.__init__ runs sysctl on mac to check for 64-bit support.
+ self.scm = Git(None, executive=executive)
+ executive.should_log = True
+
+ def test_create_patch(self):
+ expected_stderr = "MOCK run_command: ['git', 'merge-base', u'refs/remotes/origin/master', 'HEAD']\nMOCK run_command: ['git', 'diff', '--binary', '--no-ext-diff', '--full-index', '-M', 'MOCK output of child process', '--']\n"
+ OutputCapture().assert_outputs(self, self.scm.create_patch, kwargs={'changed_files': None}, expected_stderr=expected_stderr)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/Tools/Scripts/webkitpy/tool/mocktool.py b/Tools/Scripts/webkitpy/tool/mocktool.py
index d8c8ff0..7db2996 100644
--- a/Tools/Scripts/webkitpy/tool/mocktool.py
+++ b/Tools/Scripts/webkitpy/tool/mocktool.py
@@ -623,10 +623,10 @@ class MockStatusServer(object):
# FIXME: Unify with common.system.executive_mock.MockExecutive.
class MockExecutive(Mock):
def __init__(self, should_log):
- self._should_log = should_log
+ self.should_log = should_log
def run_and_throw_if_fail(self, args, quiet=False):
- if self._should_log:
+ if self.should_log:
log("MOCK run_and_throw_if_fail: %s" % args)
return "MOCK output of child process"
@@ -638,7 +638,7 @@ class MockExecutive(Mock):
return_exit_code=False,
return_stderr=True,
decode_output=False):
- if self._should_log:
+ if self.should_log:
log("MOCK run_command: %s" % args)
return "MOCK output of child process"
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list