Title: [90584] trunk/Tools
Revision
90584
Author
[email protected]
Date
2011-07-07 12:13:46 -0700 (Thu, 07 Jul 2011)

Log Message

Make Checkout use SCM's Executive instead of conjuring up its own

This will improve integration with the rest of webkitpy, particularly when invoked via
webkit-patch.

Fixes <http://webkit.org/b/64115> REGRESSION (r90564): webkitpy's Checkout class uses
Executive inappropriately

Reviewed by Adam Barth.

* Scripts/webkitpy/common/checkout/checkout.py:
(Checkout.commit_message_for_this_commit): Use SCM.run instead of creating an Executive for
our own use. SCM might have some super-special Executive that it uses under the covers, and
we want to use it, too!

* Scripts/webkitpy/common/checkout/checkout_unittest.py:
(CommitMessageForThisCommitTest.test_commit_message_for_this_commit): Mock the SCM.run
method to call through to Executive.run_command.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (90583 => 90584)


--- trunk/Tools/ChangeLog	2011-07-07 18:47:22 UTC (rev 90583)
+++ trunk/Tools/ChangeLog	2011-07-07 19:13:46 UTC (rev 90584)
@@ -1,5 +1,26 @@
 2011-07-07  Adam Roben  <[email protected]>
 
+        Make Checkout use SCM's Executive instead of conjuring up its own
+
+        This will improve integration with the rest of webkitpy, particularly when invoked via
+        webkit-patch.
+
+        Fixes <http://webkit.org/b/64115> REGRESSION (r90564): webkitpy's Checkout class uses
+        Executive inappropriately
+
+        Reviewed by Adam Barth.
+
+        * Scripts/webkitpy/common/checkout/checkout.py:
+        (Checkout.commit_message_for_this_commit): Use SCM.run instead of creating an Executive for
+        our own use. SCM might have some super-special Executive that it uses under the covers, and
+        we want to use it, too!
+
+        * Scripts/webkitpy/common/checkout/checkout_unittest.py:
+        (CommitMessageForThisCommitTest.test_commit_message_for_this_commit): Mock the SCM.run
+        method to call through to Executive.run_command.
+
+2011-07-07  Adam Roben  <[email protected]>
+
         Make Term/ReadKey.pm an optional dependency of commit-log-editor
 
         When Term/ReadKey.pm isn't present, the --regenerate-log switch will be non-functional.

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py (90583 => 90584)


--- trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py	2011-07-07 18:47:22 UTC (rev 90583)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/checkout.py	2011-07-07 19:13:46 UTC (rev 90584)
@@ -35,7 +35,7 @@
 from webkitpy.common.checkout.scm import CommitMessage
 from webkitpy.common.checkout.deps import DEPS
 from webkitpy.common.memoized import memoized
-from webkitpy.common.system.executive import Executive, run_command, ScriptError
+from webkitpy.common.system.executive import run_command, ScriptError
 from webkitpy.common.system.deprecated_logging import log
 
 
@@ -120,7 +120,7 @@
             raise ScriptError(message="Found no modified ChangeLogs, cannot create a commit message.\n"
                               "All changes require a ChangeLog.  See:\n %s" % urls.contribution_guidelines)
 
-        message_text = Executive().run_command([self._scm.script_path('commit-log-editor'), '--print-log'] + changelog_paths, return_stderr=False)
+        message_text = self._scm.run([self._scm.script_path('commit-log-editor'), '--print-log'] + changelog_paths, return_stderr=False)
         return CommitMessage(message_text.splitlines())
 
     def recent_commit_infos_for_files(self, paths):

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py (90583 => 90584)


--- trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py	2011-07-07 18:47:22 UTC (rev 90583)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py	2011-07-07 19:13:46 UTC (rev 90584)
@@ -37,7 +37,7 @@
 from .checkout import Checkout
 from .changelog import ChangeLogEntry
 from .scm import detect_scm_system, CommitMessage
-from webkitpy.common.system.executive import ScriptError
+from webkitpy.common.system.executive import Executive, ScriptError
 from webkitpy.thirdparty.mock import Mock
 
 
@@ -121,9 +121,15 @@
     def test_commit_message_for_this_commit(self):
         scm = Mock()
 
+        def mock_run(*args, **kwargs):
+            # Note that we use a real Executive here, not a MockExecutive, so we can test that we're
+            # invoking commit-log-editor correctly.
+            return Executive().run_command(*args, **kwargs)
+
         def mock_script_path(script):
             return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', script))
 
+        scm.run = mock_run
         scm.script_path = mock_script_path
 
         checkout = Checkout(scm)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to