Changeset 100118 in webkit
- Timestamp:
- Nov 14, 2011, 2:48:35 AM (14 years ago)
- Location:
- trunk/Tools
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r100116 r100118 1 2011-11-14 Tony Gentilcore <tonyg@chromium.org> 2 3 Unreviewed, rolling out r100104. 4 http://trac.webkit.org/changeset/100104 5 https://bugs.webkit.org/show_bug.cgi?id=72247 6 7 broke windows builds 8 9 * Scripts/check-webkit-style: 10 * Scripts/webkitpy/common/checkout/checkout_unittest.py: 11 * Scripts/webkitpy/common/checkout/deps.py: 12 * Scripts/webkitpy/common/checkout/scm/__init__.py: 13 * Scripts/webkitpy/common/checkout/scm/detection.py: 14 * Scripts/webkitpy/common/checkout/scm/git.py: 15 * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: 16 * Scripts/webkitpy/common/checkout/scm/svn.py: 17 * Scripts/webkitpy/common/host.py: 18 * Scripts/webkitpy/common/host_mock.py: 19 * Scripts/webkitpy/layout_tests/controllers/manager.py: 20 * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py: 21 * Scripts/webkitpy/layout_tests/port/base.py: 22 * Scripts/webkitpy/layout_tests/port/mock_drt.py: 23 * Scripts/webkitpy/layout_tests/run_webkit_tests.py: 24 * Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py: 25 * Scripts/webkitpy/tool/servers/rebaselineserver.py: 26 1 27 2011-11-14 Philippe Normand <pnormand@igalia.com> 2 28 -
trunk/Tools/Scripts/check-webkit-style
r100104 r100118 49 49 import sys 50 50 51 from webkitpy.common.checkout.scm .detectionimport detect_scm_system51 from webkitpy.common.checkout.scm import detect_scm_system 52 52 import webkitpy.style.checker as checker 53 53 from webkitpy.style.patchreader import PatchReader -
trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py
r100104 r100118 37 37 from .checkout import Checkout 38 38 from .changelog import ChangeLogEntry 39 from .scm import CommitMessage, SCMDetector39 from .scm import detect_scm_system, CommitMessage 40 40 from .scm.scm_mock import MockSCM 41 41 from webkitpy.common.system.executive import Executive, ScriptError 42 from webkitpy.common.system.filesystem import FileSystem # FIXME: This should not be needed.43 42 from webkitpy.common.system.filesystem_mock import MockFileSystem 44 43 from webkitpy.common.system.executive_mock import MockExecutive … … 46 45 47 46 47 48 # FIXME: Copied from scm_unittest.py 49 def write_into_file_at_path(file_path, contents, encoding="utf-8"): 50 with codecs.open(file_path, "w", encoding) as file: 51 file.write(contents) 52 53 48 54 _changelog1entry1 = u"""2010-03-25 Tor Arne Vestb\u00f8 <vestbo@webkit.org> 49 55 … … 98 104 99 105 def setUp(self): 100 # FIXME: This should not need to touch the filesystem, however 101 # ChangeLog is difficult to mock at current. 102 self.filesystem = FileSystem() 103 self.temp_dir = str(self.filesystem.mkdtemp(suffix="changelogs")) 104 self.old_cwd = self.filesystem.getcwd() 105 self.filesystem.chdir(self.temp_dir) 106 self.temp_dir = tempfile.mkdtemp(suffix="changelogs") 107 self.old_cwd = os.getcwd() 108 os.chdir(self.temp_dir) 106 109 107 110 # Trick commit-log-editor into thinking we're in a Subversion working copy so it won't 108 111 # complain about not being able to figure out what SCM is in use. 109 self.filesystem.maybe_make_directory(".svn")110 111 self.changelogs = map( self.filesystem.abspath, (self.filesystem.join("Tools", "ChangeLog"), self.filesystem.join("LayoutTests", "ChangeLog")))112 os.mkdir(".svn") 113 114 self.changelogs = map(os.path.abspath, (os.path.join("Tools", "ChangeLog"), os.path.join("LayoutTests", "ChangeLog"))) 112 115 for path, contents in zip(self.changelogs, (_changelog1, _changelog2)): 113 self.filesystem.maybe_make_directory(self.filesystem.dirname(path))114 self.filesystem.write_text_file(path, contents)116 os.makedirs(os.path.dirname(path)) 117 write_into_file_at_path(path, contents) 115 118 116 119 def tearDown(self): 117 self.filesystem.rmtree(self.temp_dir) 118 self.filesystem.chdir(self.old_cwd) 119 120 shutil.rmtree(self.temp_dir, ignore_errors=True) 121 os.chdir(self.old_cwd) 122 123 # FIXME: This should not need to touch the file system, however 124 # ChangeLog is difficult to mock at current. 120 125 def test_commit_message_for_this_commit(self): 121 executive = Executive()122 123 126 def mock_run(*args, **kwargs): 124 127 # Note that we use a real Executive here, not a MockExecutive, so we can test that we're … … 127 130 env['CHANGE_LOG_EMAIL_ADDRESS'] = 'vestbo@webkit.org' 128 131 kwargs['env'] = env 129 return executive.run_command(*args, **kwargs) 130 131 detector = SCMDetector(self.filesystem, executive) 132 real_scm = detector.detect_scm_system(self.old_cwd) 132 return Executive().run_command(*args, **kwargs) 133 134 real_scm = detect_scm_system(self.old_cwd) 133 135 134 136 mock_scm = MockSCM() -
trunk/Tools/Scripts/webkitpy/common/checkout/deps.py
r100104 r100118 31 31 import codecs 32 32 import fileinput 33 import os.path 33 34 import re 34 35 import textwrap … … 40 41 41 42 def __init__(self, path): 42 # FIXME: This should take a FileSystem object.43 43 self._path = path 44 44 -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/__init__.py
r100104 r100118 3 3 # We only export public API here. 4 4 from .commitmessage import CommitMessage 5 from .detection import SCMDetector5 from .detection import find_checkout_root, default_scm, detect_scm_system 6 6 from .git import Git, AmbiguousCommitError 7 7 from .scm import SCM, AuthenticationError, CheckoutNeedsUpdate -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/detection.py
r100104 r100118 28 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 29 30 from webkitpy.common.system.filesystem import FileSystem 31 from webkitpy.common.system.executive import Executive 30 import os 32 31 33 from webkitpy.common.system.deprecated_logging import log32 from webkitpy.common.system.deprecated_logging import error, log 34 33 35 34 from .svn import SVN … … 37 36 38 37 39 class SCMDetector(object): 40 def __init__(self, filesystem, executive): 41 self._filesystem = filesystem 42 self._executive = executive 38 def find_checkout_root(): 39 """Returns the current checkout root (as determined by default_scm(). 43 40 44 def default_scm(self, patch_directories=None):45 """Return the default SCM object as determined by the CWD and running code.41 Returns the absolute path to the top of the WebKit checkout, or None 42 if it cannot be determined. 46 43 47 Returns the default SCM object for the current working directory; if the 48 CWD is not in a checkout, then we attempt to figure out if the SCM module 49 itself is part of a checkout, and return that one. If neither is part of 50 a checkout, None is returned. 51 52 """ 53 cwd = self._filesystem.getcwd() 54 scm_system = self.detect_scm_system(cwd, patch_directories) 55 if not scm_system: 56 script_directory = self._filesystem.dirname(self._filesystem.path_to_module(self.__module__)) 57 scm_system = self.detect_scm_system(script_directory, patch_directories) 58 if scm_system: 59 log("The current directory (%s) is not a WebKit checkout, using %s" % (cwd, scm_system.checkout_root)) 60 else: 61 raise Exception("FATAL: Failed to determine the SCM system for either %s or %s" % (cwd, script_directory)) 62 return scm_system 63 64 def detect_scm_system(self, path, patch_directories=None): 65 absolute_path = self._filesystem.abspath(path) 66 67 if patch_directories == []: 68 patch_directories = None 69 70 if SVN.in_working_directory(absolute_path): 71 return SVN(cwd=absolute_path, patch_directories=patch_directories, filesystem=self._filesystem, executive=self._executive) 72 73 if Git.in_working_directory(absolute_path): 74 return Git(cwd=absolute_path, filesystem=self._filesystem, executive=self._executive) 75 76 return None 44 """ 45 scm_system = default_scm() 46 if scm_system: 47 return scm_system.checkout_root 48 return None 77 49 78 50 79 # FIXME: These free functions are all deprecated: 51 def default_scm(patch_directories=None): 52 """Return the default SCM object as determined by the CWD and running code. 53 54 Returns the default SCM object for the current working directory; if the 55 CWD is not in a checkout, then we attempt to figure out if the SCM module 56 itself is part of a checkout, and return that one. If neither is part of 57 a checkout, None is returned. 58 59 """ 60 cwd = os.getcwd() 61 scm_system = detect_scm_system(cwd, patch_directories) 62 if not scm_system: 63 script_directory = os.path.dirname(os.path.abspath(__file__)) 64 scm_system = detect_scm_system(script_directory, patch_directories) 65 if scm_system: 66 log("The current directory (%s) is not a WebKit checkout, using %s" % (cwd, scm_system.checkout_root)) 67 else: 68 error("FATAL: Failed to determine the SCM system for either %s or %s" % (cwd, script_directory)) 69 return scm_system 70 80 71 81 72 def detect_scm_system(path, patch_directories=None): 82 return SCMDetector(FileSystem(), Executive()).detect_scm_system(path, patch_directories) 73 absolute_path = os.path.abspath(path) 74 75 if patch_directories == []: 76 patch_directories = None 77 78 if SVN.in_working_directory(absolute_path): 79 return SVN(cwd=absolute_path, patch_directories=patch_directories) 80 81 if Git.in_working_directory(absolute_path): 82 return Git(cwd=absolute_path) 83 84 return None -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/git.py
r100104 r100118 63 63 ERROR_FILE_IS_MISSING = 128 64 64 65 def __init__(self, cwd, **kwargs):66 SCM.__init__(self, cwd, **kwargs)65 def __init__(self, cwd, executive=None): 66 SCM.__init__(self, cwd, executive) 67 67 self._check_git_architecture() 68 68 -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py
r100104 r100118 234 234 235 235 236 # FIXME: This should move to testing SCMDetector instead.237 236 class StandaloneFunctionsTest(unittest.TestCase): 238 237 """This class tests any standalone/top-level functions in the package.""" … … 284 283 self.assertRaises(SystemExit, default_scm) 285 284 os.path.abspath = self.orig_abspath 286 287 285 288 286 # For testing the SCM baseclass directly. -
trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py
r100104 r100118 73 73 _svn_metadata_files = frozenset(['.svn', '_svn']) 74 74 75 def __init__(self, cwd, patch_directories, **kwargs):76 SCM.__init__(self, cwd, **kwargs)75 def __init__(self, cwd, patch_directories, executive=None): 76 SCM.__init__(self, cwd, executive) 77 77 self._bogus_dir = None 78 78 if patch_directories == []: … … 80 80 raise ScriptError(script_args=svn_info_args, message='Empty list of patch directories passed to SCM.__init__') 81 81 elif patch_directories == None: 82 self._patch_directories = [ self._filesystem.relpath(cwd, self.checkout_root)]82 self._patch_directories = [ospath.relpath(cwd, self.checkout_root)] 83 83 else: 84 84 self._patch_directories = patch_directories -
trunk/Tools/Scripts/webkitpy/common/host.py
r100104 r100118 30 30 31 31 from webkitpy.common.checkout import Checkout 32 from webkitpy.common.checkout.scm .detection import SCMDetector32 from webkitpy.common.checkout.scm import default_scm 33 33 from webkitpy.common.memoized import memoized 34 34 from webkitpy.common.net import bugzilla, buildbot, web … … 65 65 66 66 def _initialize_scm(self, patch_directories=None): 67 detector = SCMDetector(self.filesystem, self.executive) 68 self._scm = detector.default_scm(patch_directories) 67 self._scm = default_scm(patch_directories) 69 68 self._checkout = Checkout(self.scm()) 70 69 -
trunk/Tools/Scripts/webkitpy/common/host_mock.py
r100104 r100118 67 67 self._watch_list = MockWatchList() 68 68 69 def _initialize_scm(self, patch_directories=None):70 pass71 72 69 def scm(self): 73 70 return self._scm -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
r100104 r100118 47 47 import time 48 48 49 from webkitpy.common.checkout.scm import default_scm 49 50 from webkitpy.layout_tests.controllers import manager_worker_broker 50 51 from webkitpy.layout_tests.controllers import worker … … 231 232 results['has_pretty_patch'] = port_obj.pretty_patch_available() 232 233 try: 233 results['revision'] = port_obj.host.scm().head_svn_revision()234 results['revision'] = default_scm().head_svn_revision() 234 235 except Exception, e: 235 _log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e)) 236 # FIXME: We would like to warn here, but that would cause all passing_run integration tests 237 # to fail, since they assert that we have no logging output. 238 # The revision lookup always fails when running the tests since it tries to read from 239 # "/mock-checkout" using the real file system (since there is no way to mock out detect_scm_system at current). 240 # Once we fix detect_scm_system to use the mock file system we can add this log back. 241 #_log.warn("Failed to determine svn revision for checkout (cwd: %s, webkit_base: %s), leaving 'revision' key blank in full_results.json.\n%s" % (port_obj._filesystem.getcwd(), port_obj.path_from_webkit_base(), e)) 236 242 # Handle cases where we're running outside of version control. 237 243 import traceback -
trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py
r100104 r100118 256 256 # so this function can be properly mocked! 257 257 host = Host() 258 host._initialize_scm()259 258 port_obj = host.port_factory.get(self._platform_name, options) 260 259 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py
r100104 r100118 38 38 import os 39 39 40 from webkitpy.common.checkout.scm import detect_scm_system 40 41 from webkitpy.common.memoized import memoized 41 42 -
trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
r100104 r100118 280 280 # FIXME: Why is this using a real Host object instead of MockHost? 281 281 host = Host() 282 host._initialize_scm()283 282 sys.exit(main(sys.argv[1:], host, sys.stdin, sys.stdout, sys.stderr)) -
trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
r100104 r100118 431 431 options, args = parse_args() 432 432 host = Host() 433 host._initialize_scm()434 433 port = host.port_factory.get(options.platform, options) 435 434 return run(port, options, args) -
trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py
r100104 r100118 945 945 946 946 host = Host() 947 host._initialize_scm()948 947 target_port_obj = host.port_factory.get(None, target_options) 949 948 host_port_obj = get_host_port_object(host.port_factory, options) -
trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py
r100104 r100118 165 165 # FIXME: This seems like a hack. This only seems used to access the Port.expected_baselines logic. 166 166 class AllPlatformsPort(WebKitPort): 167 def __init__(self, host): 168 WebKitPort.__init__(self, host) 167 def __init__(self): 168 # FIXME: This should get the Host from the test_config to be mockable! 169 WebKitPort.__init__(self, Host(), filesystem=test_config.filesystem) 169 170 self._platforms_by_directory = dict([(self._webkit_baseline_path(p), p) for p in test_config.platforms]) 170 171 … … 177 178 test_path = test_config.filesystem.join(test_config.layout_tests_directory, test_file) 178 179 179 # FIXME: This should get the Host from the test_config to be mockable! 180 host = Host() 181 host._initialize_scm() 182 host.filesystem = test_config.filesystem 183 all_platforms_port = AllPlatformsPort(host) 180 all_platforms_port = AllPlatformsPort() 184 181 185 182 all_test_baselines = {}
Note:
See TracChangeset
for help on using the changeset viewer.