Commit 80b8a8f5 authored by aroben@apple.com's avatar aroben@apple.com

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90584 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent baf5f053
2011-07-07 Adam Roben <aroben@apple.com>
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 <aroben@apple.com>
Make Term/ReadKey.pm an optional dependency of commit-log-editor
......
......@@ -35,7 +35,7 @@ from webkitpy.common.checkout.commitinfo import CommitInfo
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 @@ class Checkout(object):
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):
......
......@@ -37,7 +37,7 @@ import unittest
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 @@ Second part of this complicated change by me, Tor Arne Vestb\u00f8!
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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment