Changeset 100118 in webkit


Ignore:
Timestamp:
Nov 14, 2011, 2:48:35 AM (14 years ago)
Author:
tonyg@chromium.org
Message:

Unreviewed, rolling out r100104.
http://trac.webkit.org/changeset/100104
https://bugs.webkit.org/show_bug.cgi?id=72247

broke windows builds

  • Scripts/check-webkit-style:
  • Scripts/webkitpy/common/checkout/checkout_unittest.py:
  • Scripts/webkitpy/common/checkout/deps.py:
  • Scripts/webkitpy/common/checkout/scm/init.py:
  • Scripts/webkitpy/common/checkout/scm/detection.py:
  • Scripts/webkitpy/common/checkout/scm/git.py:
  • Scripts/webkitpy/common/checkout/scm/scm_unittest.py:
  • Scripts/webkitpy/common/checkout/scm/svn.py:
  • Scripts/webkitpy/common/host.py:
  • Scripts/webkitpy/common/host_mock.py:
  • Scripts/webkitpy/layout_tests/controllers/manager.py:
  • Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
  • Scripts/webkitpy/layout_tests/port/base.py:
  • Scripts/webkitpy/layout_tests/port/mock_drt.py:
  • Scripts/webkitpy/layout_tests/run_webkit_tests.py:
  • Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py:
  • Scripts/webkitpy/tool/servers/rebaselineserver.py:
Location:
trunk/Tools
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r100116 r100118  
     12011-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
    1272011-11-14  Philippe Normand  <pnormand@igalia.com>
    228
  • trunk/Tools/Scripts/check-webkit-style

    r100104 r100118  
    4949import sys
    5050
    51 from webkitpy.common.checkout.scm.detection import detect_scm_system
     51from webkitpy.common.checkout.scm import detect_scm_system
    5252import webkitpy.style.checker as checker
    5353from webkitpy.style.patchreader import PatchReader
  • trunk/Tools/Scripts/webkitpy/common/checkout/checkout_unittest.py

    r100104 r100118  
    3737from .checkout import Checkout
    3838from .changelog import ChangeLogEntry
    39 from .scm import CommitMessage, SCMDetector
     39from .scm import detect_scm_system, CommitMessage
    4040from .scm.scm_mock import MockSCM
    4141from webkitpy.common.system.executive import Executive, ScriptError
    42 from webkitpy.common.system.filesystem import FileSystem  # FIXME: This should not be needed.
    4342from webkitpy.common.system.filesystem_mock import MockFileSystem
    4443from webkitpy.common.system.executive_mock import MockExecutive
     
    4645
    4746
     47
     48# FIXME: Copied from scm_unittest.py
     49def 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
    4854_changelog1entry1 = u"""2010-03-25  Tor Arne Vestb\u00f8  <vestbo@webkit.org>
    4955
     
    98104
    99105    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)
    106109
    107110        # Trick commit-log-editor into thinking we're in a Subversion working copy so it won't
    108111        # 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")))
    112115        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)
    115118
    116119    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.
    120125    def test_commit_message_for_this_commit(self):
    121         executive = Executive()
    122 
    123126        def mock_run(*args, **kwargs):
    124127            # Note that we use a real Executive here, not a MockExecutive, so we can test that we're
     
    127130            env['CHANGE_LOG_EMAIL_ADDRESS'] = 'vestbo@webkit.org'
    128131            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)
    133135
    134136        mock_scm = MockSCM()
  • trunk/Tools/Scripts/webkitpy/common/checkout/deps.py

    r100104 r100118  
    3131import codecs
    3232import fileinput
     33import os.path
    3334import re
    3435import textwrap
     
    4041
    4142    def __init__(self, path):
    42         # FIXME: This should take a FileSystem object.
    4343        self._path = path
    4444
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/__init__.py

    r100104 r100118  
    33# We only export public API here.
    44from .commitmessage import CommitMessage
    5 from .detection import SCMDetector
     5from .detection import find_checkout_root, default_scm, detect_scm_system
    66from .git import Git, AmbiguousCommitError
    77from .scm import SCM, AuthenticationError, CheckoutNeedsUpdate
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/detection.py

    r100104 r100118  
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
    30 from webkitpy.common.system.filesystem import FileSystem
    31 from webkitpy.common.system.executive import Executive
     30import os
    3231
    33 from webkitpy.common.system.deprecated_logging import log
     32from webkitpy.common.system.deprecated_logging import error, log
    3433
    3534from .svn import SVN
     
    3736
    3837
    39 class SCMDetector(object):
    40     def __init__(self, filesystem, executive):
    41         self._filesystem = filesystem
    42         self._executive = executive
     38def find_checkout_root():
     39    """Returns the current checkout root (as determined by default_scm().
    4340
    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.
    4643
    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
    7749
    7850
    79 # FIXME: These free functions are all deprecated:
     51def 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
    8071
    8172def 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  
    6363    ERROR_FILE_IS_MISSING = 128
    6464
    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)
    6767        self._check_git_architecture()
    6868
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py

    r100104 r100118  
    234234
    235235
    236 # FIXME: This should move to testing SCMDetector instead.
    237236class StandaloneFunctionsTest(unittest.TestCase):
    238237    """This class tests any standalone/top-level functions in the package."""
     
    284283        self.assertRaises(SystemExit, default_scm)
    285284        os.path.abspath = self.orig_abspath
    286 
    287285
    288286# For testing the SCM baseclass directly.
  • trunk/Tools/Scripts/webkitpy/common/checkout/scm/svn.py

    r100104 r100118  
    7373    _svn_metadata_files = frozenset(['.svn', '_svn'])
    7474
    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)
    7777        self._bogus_dir = None
    7878        if patch_directories == []:
     
    8080            raise ScriptError(script_args=svn_info_args, message='Empty list of patch directories passed to SCM.__init__')
    8181        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)]
    8383        else:
    8484            self._patch_directories = patch_directories
  • trunk/Tools/Scripts/webkitpy/common/host.py

    r100104 r100118  
    3030
    3131from webkitpy.common.checkout import Checkout
    32 from webkitpy.common.checkout.scm.detection import SCMDetector
     32from webkitpy.common.checkout.scm import default_scm
    3333from webkitpy.common.memoized import memoized
    3434from webkitpy.common.net import bugzilla, buildbot, web
     
    6565
    6666    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)
    6968        self._checkout = Checkout(self.scm())
    7069
  • trunk/Tools/Scripts/webkitpy/common/host_mock.py

    r100104 r100118  
    6767        self._watch_list = MockWatchList()
    6868
    69     def _initialize_scm(self, patch_directories=None):
    70         pass
    71 
    7269    def scm(self):
    7370        return self._scm
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py

    r100104 r100118  
    4747import time
    4848
     49from webkitpy.common.checkout.scm import default_scm
    4950from webkitpy.layout_tests.controllers import manager_worker_broker
    5051from webkitpy.layout_tests.controllers import worker
     
    231232    results['has_pretty_patch'] = port_obj.pretty_patch_available()
    232233    try:
    233         results['revision'] = port_obj.host.scm().head_svn_revision()
     234        results['revision'] = default_scm().head_svn_revision()
    234235    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))
    236242        # Handle cases where we're running outside of version control.
    237243        import traceback
  • trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py

    r100104 r100118  
    256256            # so this function can be properly mocked!
    257257            host = Host()
    258             host._initialize_scm()
    259258            port_obj = host.port_factory.get(self._platform_name, options)
    260259
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py

    r100104 r100118  
    3838import os
    3939
     40from webkitpy.common.checkout.scm import detect_scm_system
    4041from webkitpy.common.memoized import memoized
    4142
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py

    r100104 r100118  
    280280    # FIXME: Why is this using a real Host object instead of MockHost?
    281281    host = Host()
    282     host._initialize_scm()
    283282    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  
    431431    options, args = parse_args()
    432432    host = Host()
    433     host._initialize_scm()
    434433    port = host.port_factory.get(options.platform, options)
    435434    return run(port, options, args)
  • trunk/Tools/Scripts/webkitpy/to_be_moved/rebaseline_chromium_webkit_tests.py

    r100104 r100118  
    945945
    946946    host = Host()
    947     host._initialize_scm()
    948947    target_port_obj = host.port_factory.get(None, target_options)
    949948    host_port_obj = get_host_port_object(host.port_factory, options)
  • trunk/Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py

    r100104 r100118  
    165165    # FIXME: This seems like a hack. This only seems used to access the Port.expected_baselines logic.
    166166    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)
    169170            self._platforms_by_directory = dict([(self._webkit_baseline_path(p), p) for p in test_config.platforms])
    170171
     
    177178    test_path = test_config.filesystem.join(test_config.layout_tests_directory, test_file)
    178179
    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()
    184181
    185182    all_test_baselines = {}
Note: See TracChangeset for help on using the changeset viewer.