Diff
Modified: trunk/Tools/ChangeLog (139770 => 139771)
--- trunk/Tools/ChangeLog 2013-01-15 20:02:20 UTC (rev 139770)
+++ trunk/Tools/ChangeLog 2013-01-15 20:03:10 UTC (rev 139771)
@@ -1,3 +1,31 @@
+2013-01-15 Tim 'mithro' Ansell <mit...@mithis.com>
+
+ Renaming CleanWorkingDirectory step to DiscardLocalChanges to make
+ functionality match the name.
+ https://bugs.webkit.org/show_bug.cgi?id=106870
+
+ Reviewed by Adam Barth.
+
+ * Scripts/webkitpy/tool/commands/download.py:
+ (Clean):
+ (Update):
+ (Build):
+ (BuildAndTest):
+ (CheckStyle):
+ (BuildAttachment):
+ (BuildAndTestAttachment):
+ (AbstractPatchApplyingCommand):
+ (ApplyWatchList):
+ (AbstractPatchLandingCommand):
+ (CreateRollout):
+ * Scripts/webkitpy/tool/steps/__init__.py:
+ * Scripts/webkitpy/tool/steps/cleanworkingdirectory.py:
+ (CleanWorkingDirectory.options):
+ (CleanWorkingDirectory.run):
+ * Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py:
+ * Scripts/webkitpy/tool/steps/discardlocalchanges.py: Copied from Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py.
+ * Scripts/webkitpy/tool/steps/discardlocalchanges_unittest.py: Copied from Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py.
+
2013-01-15 Zan Dobersek <zandober...@gmail.com>
[Autotools] Add support for WebKit2-only builds
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/download.py (139770 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/commands/download.py 2013-01-15 20:02:20 UTC (rev 139770)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/download.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -47,7 +47,7 @@
name = "clean"
help_text = "Clean the working copy"
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
]
def _prepare_state(self, options, args, tool):
@@ -58,7 +58,7 @@
name = "update"
help_text = "Update working copy (used internally)"
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
]
@@ -67,7 +67,7 @@
name = "build"
help_text = "Update working copy and build"
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.Build,
]
@@ -80,7 +80,7 @@
name = "build-and-test"
help_text = "Update working copy, build, and run the tests"
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.Build,
steps.RunTests,
@@ -235,7 +235,7 @@
help_text = "Run check-webkit-style on the specified attachments"
argument_names = "ATTACHMENT_ID [ATTACHMENT_IDS]"
main_steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.ApplyPatch,
steps.CheckStyle,
@@ -247,7 +247,7 @@
help_text = "Apply and build patches from bugzilla"
argument_names = "ATTACHMENT_ID [ATTACHMENT_IDS]"
main_steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.ApplyPatch,
steps.Build,
@@ -259,7 +259,7 @@
help_text = "Apply, build, and test patches from bugzilla"
argument_names = "ATTACHMENT_ID [ATTACHMENT_IDS]"
main_steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.ApplyPatch,
steps.Build,
@@ -270,7 +270,7 @@
class AbstractPatchApplyingCommand(AbstractPatchSequencingCommand):
prepare_steps = [
steps.EnsureLocalCommitIfNeeded,
- steps.CleanWorkingDirectoryWithLocalCommits,
+ steps.CleanWorkingDirectory,
steps.Update,
]
main_steps = [
@@ -299,7 +299,7 @@
help_text = "Applies the watchlist to the specified attachments"
argument_names = "ATTACHMENT_ID [ATTACHMENT_IDS]"
main_steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.ApplyPatch,
steps.ApplyWatchList,
@@ -310,7 +310,7 @@
class AbstractPatchLandingCommand(AbstractPatchSequencingCommand):
main_steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.ApplyPatch,
steps.ValidateChangeLogs,
@@ -413,7 +413,7 @@
Creates an appropriate rollout ChangeLog, including a trac link and bug link.
"""
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.RevertRevision,
steps.PrepareChangeLogForRevert,
@@ -424,7 +424,7 @@
name = "create-rollout"
help_text = "Creates a bug to track the broken SVN revision(s) and uploads a rollout patch."
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.RevertRevision,
steps.CreateBug,
@@ -470,7 +470,7 @@
Shows the prepared diff for confirmation.
Commits the revert and updates the bug (including re-opening the bug if necessary)."""
steps = [
- steps.CleanWorkingDirectory,
+ steps.DiscardLocalChanges,
steps.Update,
steps.RevertRevision,
steps.PrepareChangeLogForRevert,
Modified: trunk/Tools/Scripts/webkitpy/tool/steps/__init__.py (139770 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/steps/__init__.py 2013-01-15 20:02:20 UTC (rev 139770)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/__init__.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -35,13 +35,13 @@
from webkitpy.tool.steps.build import Build
from webkitpy.tool.steps.checkstyle import CheckStyle
from webkitpy.tool.steps.cleanworkingdirectory import CleanWorkingDirectory
-from webkitpy.tool.steps.cleanworkingdirectorywithlocalcommits import CleanWorkingDirectoryWithLocalCommits
from webkitpy.tool.steps.closebug import CloseBug
from webkitpy.tool.steps.closebugforlanddiff import CloseBugForLandDiff
from webkitpy.tool.steps.closepatch import ClosePatch
from webkitpy.tool.steps.commit import Commit
from webkitpy.tool.steps.confirmdiff import ConfirmDiff
from webkitpy.tool.steps.createbug import CreateBug
+from webkitpy.tool.steps.discardlocalchanges import DiscardLocalChanges
from webkitpy.tool.steps.editchangelog import EditChangeLog
from webkitpy.tool.steps.ensurebugisopenandassigned import EnsureBugIsOpenAndAssigned
from webkitpy.tool.steps.ensurelocalcommitifneeded import EnsureLocalCommitIfNeeded
Modified: trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py (139770 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py 2013-01-15 20:02:20 UTC (rev 139770)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -32,9 +32,6 @@
class CleanWorkingDirectory(AbstractStep):
- def __init__(self, tool, options, allow_local_commits=False):
- AbstractStep.__init__(self, tool, options)
- self._allow_local_commits = allow_local_commits
@classmethod
def options(cls):
@@ -46,10 +43,8 @@
def run(self, state):
if not self._options.clean:
return
- if not self._allow_local_commits:
- if self._tool.scm().has_local_commits() and not self._options.force_clean:
- raise ScriptError("Repository has local commits, pass --force-clean to continue.")
- self._tool.scm().discard_local_commits()
+
if self._tool.scm().has_working_directory_changes() and not self._options.force_clean:
raise ScriptError("Working directory has changes, pass --force-clean to continue.")
+
self._tool.scm().discard_working_directory_changes()
Modified: trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py (139770 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py 2013-01-15 20:02:20 UTC (rev 139770)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -41,36 +41,16 @@
step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=False))
tool._scm.has_working_directory_changes = lambda: True
self.assertRaises(ScriptError, step.run, {})
- self.assertEqual(tool._scm.discard_local_commits.call_count, 0)
self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 0)
- def test_run_local_commits_no_force(self):
- tool = MockTool()
- tool._scm = Mock()
- step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=False))
- tool._scm.has_local_commits = lambda: True
- self.assertRaises(ScriptError, step.run, {})
- self.assertEqual(tool._scm.discard_local_commits.call_count, 0)
- self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 0)
-
def test_run_working_directory_changes_force(self):
tool = MockTool()
tool._scm = Mock()
step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=True))
tool._scm.has_working_directory_changes = lambda: True
step.run({})
- self.assertEqual(tool._scm.discard_local_commits.call_count, 1)
self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 1)
- def test_run_local_commits_force(self):
- tool = MockTool()
- tool._scm = Mock()
- step = CleanWorkingDirectory(tool, MockOptions(clean=True, force_clean=True))
- tool._scm.has_local_commits = lambda: True
- step.run({})
- self.assertEqual(tool._scm.discard_local_commits.call_count, 1)
- self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 1)
-
def test_run_no_local_changes(self):
tool = MockTool()
tool._scm = Mock()
@@ -78,7 +58,6 @@
tool._scm.has_working_directory_changes = lambda: False
tool._scm.has_local_commits = lambda: False
step.run({})
- self.assertEqual(tool._scm.discard_local_commits.call_count, 1)
self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 1)
def test_no_clean(self):
@@ -86,5 +65,4 @@
tool._scm = Mock()
step = CleanWorkingDirectory(tool, MockOptions(clean=False))
step.run({})
- self.assertEqual(tool._scm.discard_local_commits.call_count, 0)
self.assertEqual(tool._scm.discard_working_directory_changes.call_count, 0)
Deleted: trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectorywithlocalcommits.py (139770 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectorywithlocalcommits.py 2013-01-15 20:02:20 UTC (rev 139770)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectorywithlocalcommits.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -1,34 +0,0 @@
-# Copyright (C) 2010 Google Inc. All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-from webkitpy.tool.steps.cleanworkingdirectory import CleanWorkingDirectory
-
-class CleanWorkingDirectoryWithLocalCommits(CleanWorkingDirectory):
- def __init__(self, tool, options):
- # FIXME: This a bit of a hack. Consider doing this more cleanly.
- CleanWorkingDirectory.__init__(self, tool, options, allow_local_commits=True)
Copied: trunk/Tools/Scripts/webkitpy/tool/steps/discardlocalchanges.py (from rev 139769, trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectorywithlocalcommits.py) (0 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/steps/discardlocalchanges.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/discardlocalchanges.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -0,0 +1,52 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from webkitpy.tool.steps.abstractstep import AbstractStep
+from webkitpy.tool.steps.options import Options
+from webkitpy.common.system.executive import ScriptError
+
+
+class DiscardLocalChanges(AbstractStep):
+
+ @classmethod
+ def options(cls):
+ return AbstractStep.options() + [
+ Options.clean,
+ Options.force_clean,
+ ]
+
+ def run(self, state):
+ if not self._options.clean:
+ return
+
+ if not self._options.force_clean:
+ if self._tool.scm().has_working_directory_changes():
+ raise ScriptError("Working directory has changes, pass --force-clean to continue.")
+ if self._tool.scm().has_local_commits():
+ raise ScriptError("Repository has local commits, pass --force-clean to continue.")
+ self._tool.scm().discard_local_changes()
Copied: trunk/Tools/Scripts/webkitpy/tool/steps/discardlocalchanges_unittest.py (from rev 139769, trunk/Tools/Scripts/webkitpy/tool/steps/cleanworkingdirectory_unittest.py) (0 => 139771)
--- trunk/Tools/Scripts/webkitpy/tool/steps/discardlocalchanges_unittest.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/discardlocalchanges_unittest.py 2013-01-15 20:03:10 UTC (rev 139771)
@@ -0,0 +1,97 @@
+# Copyright (C) 2010 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import unittest
+
+from webkitpy.thirdparty.mock import Mock
+from webkitpy.tool.mocktool import MockOptions, MockTool
+from webkitpy.tool.steps.discardlocalchanges import DiscardLocalChanges
+from webkitpy.common.system.executive import ScriptError
+
+
+class DiscardLocalChangesTest(unittest.TestCase):
+ def test_skip_on_clean(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ step = DiscardLocalChanges(tool, MockOptions(clean=False))
+ step.run({})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 0)
+
+ def test_working_changes_exist_with_force(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ tool._scm.has_working_directory_changes = lambda: True
+ tool._scm.has_local_commits = lambda: False
+ step = DiscardLocalChanges(tool, MockOptions(clean=True, force_clean=True))
+ step.run({})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 1)
+
+ def test_local_commits_exist_with_force(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ tool._scm.has_working_directory_changes = lambda: False
+ tool._scm.has_local_commits = lambda: True
+ step = DiscardLocalChanges(tool, MockOptions(clean=True, force_clean=True))
+ step.run({})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 1)
+
+ def test_local_commits_and_working_changes_exist_with_force(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ tool._scm.has_working_directory_changes = lambda: True
+ tool._scm.has_local_commits = lambda: True
+ step = DiscardLocalChanges(tool, MockOptions(clean=True, force_clean=True))
+ step.run({})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 1)
+
+ def test_no_changes_exist_with_force(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ tool._scm.has_working_directory_changes = lambda: False
+ tool._scm.has_local_commits = lambda: False
+ step = DiscardLocalChanges(tool, MockOptions(clean=True, force_clean=True))
+ step.run({})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 1)
+
+ def test_error_working_changes_exist_without_force(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ tool._scm.has_working_directory_changes = lambda: True
+ tool._scm.has_local_commits = lambda: False
+ step = DiscardLocalChanges(tool, MockOptions(clean=True, force_clean=False))
+ self.assertRaises(ScriptError, step.run, {})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 0)
+
+ def test_error_local_commits_exist_without_force(self):
+ tool = MockTool()
+ tool._scm = Mock()
+ tool._scm.has_working_directory_changes = lambda: False
+ tool._scm.has_local_commits = lambda: True
+ step = DiscardLocalChanges(tool, MockOptions(clean=True, force_clean=False))
+ self.assertRaises(ScriptError, step.run, {})
+ self.assertEqual(tool._scm.discard_local_changes.call_count, 0)