Changeset 73733 in webkit


Ignore:
Timestamp:
Dec 10, 2010 9:00:11 AM (13 years ago)
Author:
eric@webkit.org
Message:

2010-12-10 Eric Seidel <eric@webkit.org>

Reviewed by Ojan Vafai.

webkit-patch: not possible to use build-and-test with local commits
https://bugs.webkit.org/show_bug.cgi?id=33378

Make --no-clean not even check if we have local commits.
It's unclear to me why the code was originally written this way.
I was unable to dig up a reason from svn history.

  • Scripts/webkitpy/tool/steps/cleanworkingdirectory.py:
  • Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py: Copied from WebKitTools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py.
Location:
trunk/WebKitTools
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r73732 r73733  
     12010-12-10  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        webkit-patch: not possible to use build-and-test with local commits
     6        https://bugs.webkit.org/show_bug.cgi?id=33378
     7
     8        Make --no-clean not even check if we have local commits.
     9        It's unclear to me why the code was originally written this way.
     10        I was unable to dig up a reason from svn history.
     11
     12        * Scripts/webkitpy/tool/steps/cleanworkingdirectory.py:
     13        * Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py: Copied from WebKitTools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py.
     14
    1152010-12-10  Mario Sanchez Prada  <msanchez@igalia.com>
    216
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py

    r58328 r73733  
    4646
    4747    def run(self, state):
     48        if not self._options.clean:
     49            return
     50        # FIXME: This chdir should not be necessary.
    4851        os.chdir(self._tool.scm().checkout_root)
    4952        if not self._allow_local_commits:
    5053            self._tool.scm().ensure_no_local_commits(self._options.force_clean)
    51         if self._options.clean:
    52             self._tool.scm().ensure_clean_working_directory(force_clean=self._options.force_clean)
     54        self._tool.scm().ensure_clean_working_directory(force_clean=self._options.force_clean)
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py

    r73732 r73733  
    11# Copyright (C) 2010 Google Inc. All rights reserved.
    2 # 
     2#
    33# Redistribution and use in source and binary forms, with or without
    44# modification, are permitted provided that the following conditions are
    55# met:
    6 # 
     6#
    77#     * Redistributions of source code must retain the above copyright
    88# notice, this list of conditions and the following disclaimer.
     
    1414# contributors may be used to endorse or promote products derived from
    1515# this software without specific prior written permission.
    16 # 
     16#
    1717# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1818# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 import os
     29import unittest
    3030
    31 from webkitpy.tool.steps.abstractstep import AbstractStep
    32 from webkitpy.tool.steps.options import Options
     31from webkitpy.thirdparty.mock import Mock
     32from webkitpy.tool.mocktool import MockOptions, MockTool
     33from webkitpy.tool.steps.cleanworkingdirectory import CleanWorkingDirectory
    3334
    3435
    35 class CleanWorkingDirectory(AbstractStep):
    36     def __init__(self, tool, options, allow_local_commits=False):
    37         AbstractStep.__init__(self, tool, options)
    38         self._allow_local_commits = allow_local_commits
     36class CleanWorkingDirectoryTest(unittest.TestCase):
     37    def test_run(self):
     38        tool = MockTool()
     39        step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=False))
     40        step.run({})
     41        self.assertEqual(tool._scm.ensure_no_local_commits.call_count, 1)
     42        self.assertEqual(tool._scm.ensure_clean_working_directory.call_count, 1)
    3943
    40     @classmethod
    41     def options(cls):
    42         return AbstractStep.options() + [
    43             Options.force_clean,
    44             Options.clean,
    45         ]
    46 
    47     def run(self, state):
    48         os.chdir(self._tool.scm().checkout_root)
    49         if not self._allow_local_commits:
    50             self._tool.scm().ensure_no_local_commits(self._options.force_clean)
    51         if self._options.clean:
    52             self._tool.scm().ensure_clean_working_directory(force_clean=self._options.force_clean)
     44    def test_no_clean(self):
     45        tool = MockTool()
     46        step = CleanWorkingDirectory(tool, MockOptions(clean=False))
     47        step.run({})
     48        self.assertEqual(tool._scm.ensure_no_local_commits.call_count, 0)
     49        self.assertEqual(tool._scm.ensure_clean_working_directory.call_count, 0)
Note: See TracChangeset for help on using the changeset viewer.