Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1431)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py

Issue 2663623003: Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Remove second paragraph in comment about awesome windows git hack Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
index 7bfd8901bb0116ca88cc188949bfed8539b901a2..b204e2d234391c2a664965c841216d4994515e6b 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
@@ -42,7 +42,6 @@ class MockHost(MockSystemHost):
def __init__(self,
log_executive=False,
- initialize_scm_by_default=True,
web=None,
scm=None,
os_name=None,
@@ -56,13 +55,8 @@ class MockHost(MockSystemHost):
add_unit_tests_to_mock_filesystem(self.filesystem)
self.web = web or MockWeb()
-
self._scm = scm
- # TODO(qyearsley): we should never initialize the SCM by default, since
- # the real object doesn't either. This has caused at least one bug
- # (see bug 89498).
- if initialize_scm_by_default:
- self.initialize_scm()
+
self.buildbot = MockBuildBot()
# Note: We're using a real PortFactory here. Tests which don't wish to depend
@@ -71,17 +65,12 @@ class MockHost(MockSystemHost):
self.builders = BuilderList(BUILDERS)
- def initialize_scm(self, patch_directories=None):
+ def scm(self, path=None):
+ if path:
+ return MockGit(cwd=path, filesystem=self.filesystem, executive=self.executive)
if not self._scm:
self._scm = MockGit(filesystem=self.filesystem, executive=self.executive)
# Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
# Making the checkout_root exist in the mock filesystem makes that chdir not raise.
self.filesystem.maybe_make_directory(self._scm.checkout_root)
-
- def scm(self):
- return self._scm
-
- def scm_for_path(self, path):
- # FIXME: consider supporting more than one SCM so that we can do more comprehensive testing.
- self.initialize_scm()
return self._scm

Powered by Google App Engine
This is Rietveld 408576698