Title: [90967] trunk/Tools
Revision
90967
Author
[email protected]
Date
2011-07-13 18:03:02 -0700 (Wed, 13 Jul 2011)

Log Message

REGRESSION: GitTestWithMock.test_create_patch fails
https://bugs.webkit.org/show_bug.cgi?id=62945

Reviewed by Daniel Bates.

I was not able to reproduce the exact failure seen in the bug,
however this test was failing on my machine for other reasons.

I went through and did an audit of our run_command usage, it's
entirely in scm classes after this change.  (Not surprising given
that scm.py was the second file ever created in webkit.py.)

The real bug I'm fixing here is that we were setting executive.should_log
when the value had changed to executive._should_log.  Now we set the right one
and the test works again.

* Scripts/webkitpy/common/checkout/checkout.py:
* Scripts/webkitpy/common/checkout/scm/git.py:
* Scripts/webkitpy/common/checkout/scm/scm.py:
* Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
* Scripts/webkitpy/common/checkout/scm/svn.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (90966 => 90967)


--- trunk/Tools/ChangeLog	2011-07-14 00:29:55 UTC (rev 90966)
+++ trunk/Tools/ChangeLog	2011-07-14 01:03:02 UTC (rev 90967)
@@ -1,3 +1,27 @@
+2011-07-13  Eric Seidel  <[email protected]>
+
+        REGRESSION: GitTestWithMock.test_create_patch fails
+        https://bugs.webkit.org/show_bug.cgi?id=62945
+
+        Reviewed by Daniel Bates.
+
+        I was not able to reproduce the exact failure seen in the bug,
+        however this test was failing on my machine for other reasons.
+
+        I went through and did an audit of our run_command usage, it's
+        entirely in scm classes after this change.  (Not surprising given
+        that scm.py was the second file ever created in webkit.py.)
+
+        The real bug I'm fixing here is that we were setting executive.should_log
+        when the value had changed to executive._should_log.  Now we set the right one
+        and the test works again.
+
+        * Scripts/webkitpy/common/checkout/checkout.py:
+        * Scripts/webkitpy/common/checkout/scm/git.py:
+        * Scripts/webkitpy/common/checkout/scm/scm.py:
+        * Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
+        * Scripts/webkitpy/common/checkout/scm/svn.py:
+
 2011-07-13  Ilya Sherman  <[email protected]>
 
         Fix WTF header guard style check

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py (90966 => 90967)


--- trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py	2011-07-14 00:29:55 UTC (rev 90966)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py	2011-07-14 01:03:02 UTC (rev 90967)
@@ -152,7 +152,7 @@
             args += ['--reviewer', patch.reviewer().full_name]
         if force:
             args.append('--force')
-        run_command(args, input=patch.contents())
+        self._scm._executive.run_command(args, input=patch.contents())
 
     def apply_reverse_diff(self, revision):
         self._scm.apply_reverse_diff(revision)

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py (90966 => 90967)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2011-07-14 00:29:55 UTC (rev 90966)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py	2011-07-14 01:03:02 UTC (rev 90967)
@@ -88,6 +88,7 @@
 
     @classmethod
     def in_working_directory(cls, path):
+        # FIXME: This should use an Executive.
         return run_command(['git', 'rev-parse', '--is-inside-work-tree'], cwd=path, error_handler=Executive.ignore_error).rstrip() == "true"
 
     @classmethod
@@ -109,6 +110,7 @@
         # FIXME: This should probably use cwd=self.checkout_root.
         # Pass --get-all for cases where the config has multiple values
         # Pass the cwd if provided so that we can handle the case of running webkit-patch outside of the working directory.
+        # FIXME: This should use an Executive.
         return run_command(["git", "config", "--get-all", key], error_handler=Executive.ignore_error, cwd=cwd).rstrip('\n')
 
     @staticmethod

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py (90966 => 90967)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py	2011-07-14 00:29:55 UTC (rev 90966)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm.py	2011-07-14 01:03:02 UTC (rev 90967)
@@ -36,7 +36,7 @@
 import shutil
 
 from webkitpy.common.system.deprecated_logging import error, log
-from webkitpy.common.system.executive import Executive, run_command, ScriptError
+from webkitpy.common.system.executive import Executive, ScriptError
 from webkitpy.common.system import ospath
 
 

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (90966 => 90967)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2011-07-14 00:29:55 UTC (rev 90966)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py	2011-07-14 01:03:02 UTC (rev 90967)
@@ -107,6 +107,7 @@
 def _make_diff(command, *args):
     # We use this wrapper to disable output decoding. diffs should be treated as
     # binary files since they may include text files of multiple differnet encodings.
+    # FIXME: This should use an Executive.
     return run_command([command, "diff"] + list(args), decode_output=False)
 
 
@@ -1484,27 +1485,28 @@
 # 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)
+    def make_scm(self, logging_executive=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
+        scm = Git(cwd=None, executive=MockExecutive())
+        scm._executive._should_log = logging_executive
+        return scm
 
     def test_create_patch(self):
+        scm = self.make_scm(logging_executive=True)
         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', '--']\nMOCK run_command: ['git', 'log', '-25']\n"
-        OutputCapture().assert_outputs(self, self.scm.create_patch, kwargs={'changed_files': None}, expected_stderr=expected_stderr)
+        OutputCapture().assert_outputs(self, scm.create_patch, expected_stderr=expected_stderr)
 
     def test_push_local_commits_to_server_with_username_and_password(self):
-        self.assertEquals(self.scm.push_local_commits_to_server(username='[email protected]', password='blah'), "MOCK output of child process")
+        self.assertEquals(self.make_scm().push_local_commits_to_server(username='[email protected]', password='blah'), "MOCK output of child process")
 
     def test_push_local_commits_to_server_without_username_and_password(self):
-        self.assertRaises(AuthenticationError, self.scm.push_local_commits_to_server)
+        self.assertRaises(AuthenticationError, self.make_scm().push_local_commits_to_server)
 
     def test_push_local_commits_to_server_with_username_and_without_password(self):
-        self.assertRaises(AuthenticationError, self.scm.push_local_commits_to_server, {'username': '[email protected]'})
+        self.assertRaises(AuthenticationError, self.make_scm().push_local_commits_to_server, {'username': '[email protected]'})
 
     def test_push_local_commits_to_server_without_username_and_with_password(self):
-        self.assertRaises(AuthenticationError, self.scm.push_local_commits_to_server, {'password': 'blah'})
+        self.assertRaises(AuthenticationError, self.make_scm().push_local_commits_to_server, {'password': 'blah'})
 
 if __name__ == '__main__':
     unittest.main()

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py (90966 => 90967)


--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py	2011-07-14 00:29:55 UTC (rev 90966)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py	2011-07-14 01:03:02 UTC (rev 90967)
@@ -92,6 +92,7 @@
     @classmethod
     def value_from_svn_info(cls, path, field_name):
         svn_info_args = ['svn', 'info', path]
+        # FIXME: This should use an Executive.
         info_output = run_command(svn_info_args).rstrip()
         match = re.search("^%s: (?P<value>.+)$" % field_name, info_output, re.MULTILINE)
         if not match:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to