[webkitpy] Remove lingering return_exit_code usage in scm_mock and rebaselineserver.
authorglenn@skynav.com <glenn@skynav.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2013 08:27:06 +0000 (08:27 +0000)
committerglenn@skynav.com <glenn@skynav.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Apr 2013 08:27:06 +0000 (08:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=114418

Reviewed by Ryosuke Niwa.

* Scripts/webkitpy/common/checkout/scm/scm_mock.py:
(MockSCM.add): Remove optional remove_exit_code argument.
(MockSCM.add_list): Remove optional remove_exit_code argument and return value.
* Scripts/webkitpy/tool/servers/rebaselineserver.py:
(_rebaseline_test): Use ScriptError to capture SCM.add() failure and exit code.
(_move_test_baselines): Use ScriptError to capture SCM.add() failure and exit code.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@148183 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py
Tools/Scripts/webkitpy/tool/servers/rebaselineserver.py

index a411080..1240102 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-11  Glenn Adams  <glenn@skynav.com>
+
+        [webkitpy] Remove lingering return_exit_code usage in scm_mock and rebaselineserver.
+        https://bugs.webkit.org/show_bug.cgi?id=114418
+
+        Reviewed by Ryosuke Niwa.
+
+        * Scripts/webkitpy/common/checkout/scm/scm_mock.py:
+        (MockSCM.add): Remove optional remove_exit_code argument.
+        (MockSCM.add_list): Remove optional remove_exit_code argument and return value.
+        * Scripts/webkitpy/tool/servers/rebaselineserver.py:
+        (_rebaseline_test): Use ScriptError to capture SCM.add() failure and exit code.
+        (_move_test_baselines): Use ScriptError to capture SCM.add() failure and exit code.
+
 2013-04-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Fix roll-chromium-deps and hi.
index b701c34..c5d10fc 100644 (file)
@@ -38,13 +38,11 @@ class MockSCM(object):
         self._filesystem = filesystem or MockFileSystem()
         self._executive = executive or MockExecutive()
 
-    def add(self, destination_path, return_exit_code=False):
-        self.add_list([destination_path], return_exit_code)
+    def add(self, destination_path):
+        self.add_list([destination_path])
 
-    def add_list(self, destination_paths, return_exit_code=False):
+    def add_list(self, destination_paths):
         self.added_paths.update(set(destination_paths))
-        if return_exit_code:
-            return 0
 
     def has_working_directory_changes(self):
         return False
index 9e9c379..04ce517 100644 (file)
@@ -32,6 +32,7 @@ import os.path
 import BaseHTTPServer
 
 from webkitpy.common.host import Host  # FIXME: This should not be needed!
+from webkitpy.common.system.executive import ScriptError
 from webkitpy.layout_tests.port.base import Port
 from webkitpy.tool.servers.reflectionhandler import ReflectionHandler
 
@@ -114,13 +115,13 @@ def _rebaseline_test(test_file, baseline_target, baseline_move_to, test_config,
         destination_path = filesystem.join(
             target_expectations_directory, destination_file)
         filesystem.copyfile(source_path, destination_path)
-        exit_code = scm.add(destination_path, return_exit_code=True)
-        if exit_code:
+        try:
+            scm.add(destination_path)
+            log('    Updated %s' % destination_file)
+        except ScriptError, error:
             log('    Could not update %s in SCM, exit code %d' %
-                (destination_file, exit_code))
+                (destination_file, error.exit_code))
             return False
-        else:
-            log('    Updated %s' % destination_file)
 
     return True
 
@@ -150,13 +151,13 @@ def _move_test_baselines(test_file, extensions_to_move, source_platform, destina
         source_path = filesystem.join(source_directory, file_name)
         destination_path = filesystem.join(destination_directory, file_name)
         filesystem.copyfile(source_path, destination_path)
-        exit_code = test_config.scm.add(destination_path, return_exit_code=True)
-        if exit_code:
+        try:
+            test_config.scm.add(destination_path)
+            log('    Moved %s' % file_name)
+        except ScriptError, error:
             log('    Could not update %s in SCM, exit code %d' %
-                (file_name, exit_code))
+                (file_name, error.exit_code))
             return False
-        else:
-            log('    Moved %s' % file_name)
 
     return True