summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-07-08 12:51:48 +0100
committerSteve Block <steveblock@google.com>2010-07-09 15:33:40 +0100
commitca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 (patch)
treebb45155550ec013adc0ad10f4d7d354c6469b022 /WebKitTools/Scripts/webkitpy
parentd4b24d9a829ed7de70381c8b99fb75a07ab40466 (diff)
downloadexternal_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.zip
external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.gz
external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.bz2
Merge WebKit at r62496: Initial merge by git
Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2
Diffstat (limited to 'WebKitTools/Scripts/webkitpy')
-rw-r--r--WebKitTools/Scripts/webkitpy/common/checkout/scm.py161
-rw-r--r--WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py108
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py173
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checker.py2
-rwxr-xr-xWebKitTools/Scripts/webkitpy/style/checker_unittest.py4
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/download.py2
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/commands/upload.py7
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py6
8 files changed, 279 insertions, 184 deletions
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
index fc4c6fd..d7c621c 100644
--- a/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
+++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm.py
@@ -31,6 +31,8 @@
import os
import re
+import sys
+import shutil
from webkitpy.common.system.executive import Executive, run_command, ScriptError
from webkitpy.common.system.user import User
@@ -166,82 +168,95 @@ class SCM:
return match.group('svn_revision')
@staticmethod
+ def _subclass_must_implement():
+ raise NotImplementedError("subclasses must implement")
+
+ @staticmethod
def in_working_directory(path):
- raise NotImplementedError, "subclasses must implement"
+ SCM._subclass_must_implement()
@staticmethod
def find_checkout_root(path):
- raise NotImplementedError, "subclasses must implement"
+ SCM._subclass_must_implement()
@staticmethod
def commit_success_regexp():
- raise NotImplementedError, "subclasses must implement"
+ SCM._subclass_must_implement()
def working_directory_is_clean(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def clean_working_directory(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def status_command(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
- def add(self, path):
- raise NotImplementedError, "subclasses must implement"
+ def add(self, path, return_exit_code=False):
+ self._subclass_must_implement()
+
+ def delete(self, path):
+ self._subclass_must_implement()
def changed_files(self, git_commit=None, squash=None):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def changed_files_for_revision(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def added_files(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def conflicted_files(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def display_name(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def create_patch(self, git_commit=None, squash=None):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def committer_email_for_revision(self, revision):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def contents_at_revision(self, path, revision):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def diff_for_revision(self, revision):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
+
+ def diff_for_file(self, path, log=None):
+ self._subclass_must_implement()
+
+ def show_head(self, path):
+ self._subclass_must_implement()
def apply_reverse_diff(self, revision):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def revert_files(self, file_paths):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def should_squash(self, squash):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def commit_with_message(self, message, username=None, git_commit=None, squash=None):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def svn_commit_log(self, svn_revision):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
def last_svn_commit_log(self):
- raise NotImplementedError, "subclasses must implement"
+ self._subclass_must_implement()
# Subclasses must indicate if they support local commits,
# but the SCM baseclass will only call local_commits methods when this is true.
@staticmethod
def supports_local_commits():
- raise NotImplementedError, "subclasses must implement"
+ SCM._subclass_must_implement()
def remote_merge_base():
- raise NotImplementedError, "subclasses must implement"
+ SCM._subclass_must_implement()
def commit_locally_with_message(self, message):
error("Your source control manager does not support local commits.")
@@ -261,7 +276,8 @@ class SVN(SCM):
def __init__(self, cwd):
SCM.__init__(self, cwd)
self.cached_version = None
-
+ self._bogus_dir = None
+
@staticmethod
def in_working_directory(path):
return os.path.isdir(os.path.join(path, '.svn'))
@@ -343,9 +359,23 @@ class SVN(SCM):
field_count = 6 if self.svn_version() > "1.6" else 5
return "^(?P<status>[%s]).{%s} (?P<filename>.+)$" % (expected_types, field_count)
- def add(self, path):
- # path is assumed to be cwd relative?
- self.run(["svn", "add", path])
+ def _add_parent_directories(self, path):
+ """Does 'svn add' to the path and its parents."""
+ if self.in_working_directory(path):
+ return
+ dirname = os.path.dirname(path)
+ # We have dirname directry - ensure it added.
+ if dirname != path:
+ self._add_parent_directories(dirname)
+ self.add(path)
+
+ def add(self, path, return_exit_code=False):
+ self._add_parent_directories(os.path.dirname(os.path.abspath(path)))
+ return self.run(["svn", "add", path], return_exit_code=return_exit_code)
+
+ def delete(self, path):
+ parent, base = os.path.split(os.path.abspath(path))
+ return self.run(["svn", "delete", "--force", base], cwd=parent)
def changed_files(self, git_commit=None, squash=None):
return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("ACDMR"))
@@ -362,6 +392,9 @@ class SVN(SCM):
def added_files(self):
return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("A"))
+ def deleted_files(self):
+ return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("D"))
+
@staticmethod
def supports_local_commits():
return False
@@ -391,6 +424,44 @@ class SVN(SCM):
# FIXME: This should probably use cwd=self.checkout_root
return self.run(['svn', 'diff', '-c', revision])
+ def _bogus_dir_name(self):
+ if sys.platform.startswith("win"):
+ parent_dir = tempfile.gettempdir()
+ else:
+ parent_dir = sys.path[0] # tempdir is not secure.
+ return os.path.join(parent_dir, "temp_svn_config")
+
+ def _setup_bogus_dir(self, log):
+ self._bogus_dir = self._bogus_dir_name()
+ if not os.path.exists(self._bogus_dir):
+ os.mkdir(self._bogus_dir)
+ self._delete_bogus_dir = True
+ else:
+ self._delete_bogus_dir = False
+ if log:
+ log.debug(' Html: temp config dir: "%s".', self._bogus_dir)
+
+ def _teardown_bogus_dir(self, log):
+ if self._delete_bogus_dir:
+ shutil.rmtree(self._bogus_dir, True)
+ if log:
+ log.debug(' Html: removed temp config dir: "%s".', self._bogus_dir)
+ self._bogus_dir = None
+
+ def diff_for_file(self, path, log=None):
+ self._setup_bogus_dir(log)
+ try:
+ args = ['svn', 'diff']
+ if self._bogus_dir:
+ args += ['--config-dir', self._bogus_dir]
+ args.append(path)
+ return self.run(args)
+ finally:
+ self._teardown_bogus_dir(log)
+
+ def show_head(self, path):
+ return self.run(['svn', 'cat', '-r', 'BASE', path], decode_output=False)
+
def _repository_url(self):
return self.value_from_svn_info(self.checkout_root, 'URL')
@@ -435,6 +506,14 @@ class SVN(SCM):
# http://svnbook.red-bean.com/en/1.0/ch03s03.html
return self.svn_commit_log('BASE')
+ def propset(self, pname, pvalue, path):
+ dir, base = os.path.split(path)
+ return self.run(['svn', 'pset', pname, pvalue, base], cwd=dir)
+
+ def propget(self, pname, path):
+ dir, base = os.path.split(path)
+ return self.run(['svn', 'pget', pname, base], cwd=dir).encode('utf-8').rstrip("\n")
+
# All git-specific logic should go here.
class Git(SCM):
def __init__(self, cwd):
@@ -447,13 +526,18 @@ class Git(SCM):
@classmethod
def find_checkout_root(cls, path):
# "git rev-parse --show-cdup" would be another way to get to the root
- (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=path))
+ (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=(path or "./")))
# If we were using 2.6 # checkout_root = os.path.relpath(checkout_root, path)
if not os.path.isabs(checkout_root): # Sometimes git returns relative paths
checkout_root = os.path.join(path, checkout_root)
return checkout_root
@classmethod
+ def to_object_name(cls, filepath):
+ root_end_with_slash = os.path.join(cls.find_checkout_root(os.path.dirname(filepath)), '')
+ return filepath.replace(root_end_with_slash, '')
+
+ @classmethod
def read_git_config(cls, key):
# FIXME: This should probably use cwd=self.checkout_root.
return run_command(["git", "config", key],
@@ -494,9 +578,11 @@ class Git(SCM):
def _status_regexp(self, expected_types):
return '^(?P<status>[%s])\t(?P<filename>.+)$' % expected_types
- def add(self, path):
- # path is assumed to be cwd relative?
- self.run(["git", "add", path])
+ def add(self, path, return_exit_code=False):
+ return self.run(["git", "add", path], return_exit_code=return_exit_code)
+
+ def delete(self, path):
+ return self.run(["git", "rm", "-f", path])
def _merge_base(self, git_commit, squash):
if git_commit:
@@ -537,6 +623,9 @@ class Git(SCM):
def added_files(self):
return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("A"))
+ def deleted_files(self):
+ return self.run_status_and_extract_filenames(self.status_command(), self._status_regexp("D"))
+
@staticmethod
def supports_local_commits():
return True
@@ -569,6 +658,12 @@ class Git(SCM):
git_commit = self.git_commit_from_svn_revision(revision)
return self.create_patch(git_commit)
+ def diff_for_file(self, path, log=None):
+ return self.run(['git', 'diff', 'HEAD', '--', path])
+
+ def show_head(self, path):
+ return self.run(['git', 'show', 'HEAD:' + self.to_object_name(path)], decode_output=False)
+
def committer_email_for_revision(self, revision):
git_commit = self.git_commit_from_svn_revision(revision)
committer_email = self.run(["git", "log", "-1", "--pretty=format:%ce", git_commit])
diff --git a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
index 36a1d1c..eaa3b46 100644
--- a/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/common/checkout/scm_unittest.py
@@ -40,6 +40,7 @@ import subprocess
import tempfile
import unittest
import urllib
+import shutil
from datetime import date
from webkitpy.common.checkout.api import Checkout
@@ -63,8 +64,12 @@ def run_silent(args, cwd=None):
def write_into_file_at_path(file_path, contents, encoding="utf-8"):
- with codecs.open(file_path, "w", encoding) as file:
- file.write(contents)
+ if encoding:
+ with codecs.open(file_path, "w", encoding) as file:
+ file.write(contents)
+ else:
+ with open(file_path, "w") as file:
+ file.write(contents)
def read_from_path(file_path, encoding="utf-8"):
@@ -388,6 +393,11 @@ OcmYex&reD$;sO8*F9L)B
# Cannot delete again.
self.assertRaises(ScriptError, self.checkout.apply_patch, self._create_patch(git_binary_deletion))
+ def _shared_test_add_recursively(self):
+ os.mkdir("added_dir")
+ write_into_file_at_path("added_dir/added_file", "new stuff")
+ self.scm.add("added_dir/added_file")
+ self.assertTrue("added_dir/added_file" in self.scm.added_files())
class SVNTest(SCMTest):
@@ -632,6 +642,60 @@ Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
def test_committer_email_for_revision(self):
self._shared_test_committer_email_for_revision()
+ def test_add_recursively(self):
+ self._shared_test_add_recursively()
+
+ def test_delete(self):
+ os.chdir(self.svn_checkout_path)
+ self.scm.delete("test_file")
+ self.assertTrue("test_file" in self.scm.deleted_files())
+
+ def test_propset_propget(self):
+ filepath = os.path.join(self.svn_checkout_path, "test_file")
+ expected_mime_type = "x-application/foo-bar"
+ self.scm.propset("svn:mime-type", expected_mime_type, filepath)
+ self.assertEqual(expected_mime_type, self.scm.propget("svn:mime-type", filepath))
+
+ def test_show_head(self):
+ write_into_file_at_path("test_file", u"Hello!", "utf-8")
+ SVNTestRepository._svn_commit("fourth commit")
+ self.assertEqual("Hello!", self.scm.show_head('test_file'))
+
+ def test_show_head_binary(self):
+ data = "\244"
+ write_into_file_at_path("binary_file", data, encoding=None)
+ self.scm.add("binary_file")
+ self.scm.commit_with_message("a test commit")
+ self.assertEqual(data, self.scm.show_head('binary_file'))
+
+ def do_test_diff_for_file(self):
+ write_into_file_at_path('test_file', 'some content')
+ self.scm.commit_with_message("a test commit")
+ diff = self.scm.diff_for_file('test_file')
+ self.assertEqual(diff, "")
+
+ write_into_file_at_path("test_file", "changed content")
+ diff = self.scm.diff_for_file('test_file')
+ self.assertTrue("-some content" in diff)
+ self.assertTrue("+changed content" in diff)
+
+ def clean_bogus_dir(self):
+ self.bogus_dir = self.scm._bogus_dir_name()
+ if os.path.exists(self.bogus_dir):
+ shutil.rmtree(self.bogus_dir)
+
+ def test_diff_for_file_with_existing_bogus_dir(self):
+ self.clean_bogus_dir()
+ os.mkdir(self.bogus_dir)
+ self.do_test_diff_for_file()
+ self.assertTrue(os.path.exists(self.bogus_dir))
+ shutil.rmtree(self.bogus_dir)
+
+ def test_diff_for_file_with_missing_bogus_dir(self):
+ self.clean_bogus_dir()
+ self.do_test_diff_for_file()
+ self.assertFalse(os.path.exists(self.bogus_dir))
+
class GitTest(SCMTest):
@@ -1098,6 +1162,46 @@ class GitSVNTest(SCMTest):
def test_committer_email_for_revision(self):
self._shared_test_committer_email_for_revision()
+ def test_add_recursively(self):
+ self._shared_test_add_recursively()
+
+ def test_delete(self):
+ self._two_local_commits()
+ self.scm.delete('test_file_commit1')
+ self.assertTrue("test_file_commit1" in self.scm.deleted_files())
+
+ def test_to_object_name(self):
+ relpath = 'test_file_commit1'
+ fullpath = os.path.join(self.git_checkout_path, relpath)
+ self._two_local_commits()
+ self.assertEqual(relpath, self.scm.to_object_name(fullpath))
+
+ def test_show_head(self):
+ self._two_local_commits()
+ self.assertEqual("more test content", self.scm.show_head('test_file_commit1'))
+
+ def test_show_head_binary(self):
+ self._two_local_commits()
+ data = "\244"
+ write_into_file_at_path("binary_file", data, encoding=None)
+ self.scm.add("binary_file")
+ self.scm.commit_locally_with_message("a test commit")
+ self.assertEqual(data, self.scm.show_head('binary_file'))
+
+ def test_diff_for_file(self):
+ self._two_local_commits()
+ write_into_file_at_path('test_file_commit1', "Updated", encoding=None)
+
+ diff = self.scm.diff_for_file('test_file_commit1')
+ cached_diff = self.scm.diff_for_file('test_file_commit1')
+ self.assertTrue("+Updated" in diff)
+ self.assertTrue("-more test content" in diff)
+
+ self.scm.add('test_file_commit1')
+
+ cached_diff = self.scm.diff_for_file('test_file_commit1')
+ self.assertTrue("+Updated" in cached_diff)
+ self.assertTrue("-more test content" in cached_diff)
if __name__ == '__main__':
unittest.main()
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
index f11b8a9..35f32d4 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py
@@ -58,7 +58,9 @@ import urllib
import webbrowser
import zipfile
-from webkitpy.common.system.executive import run_command
+from webkitpy.common.system.executive import run_command, ScriptError
+from webkitpy.common.checkout.scm import detect_scm_system
+import webkitpy.common.checkout.scm as scm
import port
from layout_package import test_expectations
@@ -68,9 +70,6 @@ from test_types import text_diff
_log = logging.getLogger("webkitpy.layout_tests."
"rebaseline_chromium_webkit_tests")
-# Repository type constants.
-REPO_SVN, REPO_UNKNOWN = range(2)
-
BASELINE_SUFFIXES = ['.txt', '.png', '.checksum']
REBASELINE_PLATFORM_ORDER = ['mac', 'win', 'win-xp', 'win-vista', 'linux']
ARCHIVE_DIR_NAME_DICT = {'win': 'webkit-rel',
@@ -241,8 +240,7 @@ class Rebaseliner(object):
self._platform,
False,
False)
-
- self._repo_type = self._get_repo_type()
+ self._scm = detect_scm_system(os.getcwd())
def run(self, backup):
"""Run rebaseline process."""
@@ -285,15 +283,6 @@ class Rebaseliner(object):
def get_rebaselining_tests(self):
return self._rebaselining_tests
- # FIXME: Callers should use scm.py instead.
- def _get_repo_type(self):
- """Get the repository type that client is using."""
- return_code = run_command(['svn', 'info'], return_exit_code=True)
- if return_code == 0:
- return REPO_SVN
-
- return REPO_UNKNOWN
-
def _compile_rebaselining_tests(self):
"""Compile list of tests that need rebaselining for the platform.
@@ -371,6 +360,9 @@ class Rebaseliner(object):
None on failure
"""
+ if self._options.force_archive_url:
+ return self._options.force_archive_url
+
dir_name = self._get_archive_dir_name(self._platform,
self._options.webkit_canary)
if not dir_name:
@@ -431,7 +423,7 @@ class Rebaseliner(object):
_log.info('Test %d: %s', test_no, test)
found = False
- svn_error = False
+ scm_error = False
test_basename = os.path.splitext(test)[0]
for suffix in BASELINE_SUFFIXES:
archive_test_name = ('layout-test-results/%s-actual%s' %
@@ -480,16 +472,17 @@ class Rebaseliner(object):
shutil.move(temp_name, expected_fullpath)
- if not self._svn_add(expected_fullpath):
- svn_error = True
+ if 0 != self._scm.add(expected_fullpath, return_exit_code=True):
+ # FIXME: print detailed diagnose messages
+ scm_error = True
elif suffix != '.checksum':
self._create_html_baseline_files(expected_fullpath)
if not found:
_log.warn(' No new baselines found in archive.')
else:
- if svn_error:
- _log.warn(' Failed to add baselines to SVN.')
+ if scm_error:
+ _log.warn(' Failed to add baselines to your repository.')
else:
_log.info(' Rebaseline succeeded.')
self._rebaselined_tests.append(test)
@@ -572,15 +565,7 @@ class Rebaseliner(object):
if not filename or not os.path.isfile(filename):
return
-
- if self._repo_type == REPO_SVN:
- parent_dir, basename = os.path.split(filename)
- original_dir = os.getcwd()
- os.chdir(parent_dir)
- run_shell(['svn', 'delete', '--force', basename], False)
- os.chdir(original_dir)
- else:
- os.remove(filename)
+ self._scm.delete(filename)
def _update_rebaselined_tests_in_file(self, backup):
"""Update the rebaselined tests in test expectations file.
@@ -609,91 +594,10 @@ class Rebaseliner(object):
# Or is new_expectations always a byte array?
with open(path, "w") as file:
file.write(new_expectations)
+ self._scm.add(path)
else:
_log.info('No test was rebaselined so nothing to remove.')
- # FIXME: Callers should move to SCM.add instead.
- def _svn_add(self, filename):
- """Add the file to SVN repository.
-
- Args:
- filename: full path of the file to add.
-
- Returns:
- True if the file already exists in SVN or is sucessfully added
- to SVN.
- False otherwise.
- """
-
- if not filename:
- return False
-
- parent_dir, basename = os.path.split(filename)
- if self._repo_type != REPO_SVN or parent_dir == filename:
- _log.info("No svn checkout found, skip svn add.")
- return True
-
- original_dir = os.getcwd()
- os.chdir(parent_dir)
- status_output = run_shell(['svn', 'status', basename], False)
- os.chdir(original_dir)
- output = status_output.upper()
- if output.startswith('A') or output.startswith('M'):
- _log.info(' File already added to SVN: "%s"', filename)
- return True
-
- if output.find('IS NOT A WORKING COPY') >= 0:
- _log.info(' File is not a working copy, add its parent: "%s"',
- parent_dir)
- return self._svn_add(parent_dir)
-
- os.chdir(parent_dir)
- add_output = run_shell(['svn', 'add', basename], True)
- os.chdir(original_dir)
- output = add_output.upper().rstrip()
- if output.startswith('A') and output.find(basename.upper()) >= 0:
- _log.info(' Added new file: "%s"', filename)
- self._svn_prop_set(filename)
- return True
-
- if (not status_output) and (add_output.upper().find(
- 'ALREADY UNDER VERSION CONTROL') >= 0):
- _log.info(' File already under SVN and has no change: "%s"',
- filename)
- return True
-
- _log.warn(' Failed to add file to SVN: "%s"', filename)
- _log.warn(' Svn status output: "%s"', status_output)
- _log.warn(' Svn add output: "%s"', add_output)
- return False
-
- def _svn_prop_set(self, filename):
- """Set the baseline property
-
- Args:
- filename: full path of the file to add.
-
- Returns:
- True if the file already exists in SVN or is sucessfully added
- to SVN.
- False otherwise.
- """
- ext = os.path.splitext(filename)[1].upper()
- if ext != '.TXT' and ext != '.PNG' and ext != '.CHECKSUM':
- return
-
- parent_dir, basename = os.path.split(filename)
- original_dir = os.getcwd()
- os.chdir(parent_dir)
- if ext == '.PNG':
- cmd = ['svn', 'pset', 'svn:mime-type', 'image/png', basename]
- else:
- cmd = ['svn', 'pset', 'svn:eol-style', 'LF', basename]
-
- _log.debug(' Set svn prop: %s', ' '.join(cmd))
- run_shell(cmd, False)
- os.chdir(original_dir)
-
def _create_html_baseline_files(self, baseline_fullpath):
"""Create baseline files (old, new and diff) in html directory.
@@ -715,8 +619,13 @@ class Rebaseliner(object):
_log.info(' Html: copied new baseline file from "%s" to "%s".',
baseline_fullpath, new_file)
- # Get the old baseline from SVN and save to the html directory.
- output = run_shell(['svn', 'cat', '-r', 'BASE', baseline_fullpath])
+ # Get the old baseline from the repository and save to the html directory.
+ try:
+ output = self._scm.show_head(baseline_fullpath)
+ except ScriptError, e:
+ _log.info(e)
+ output = ""
+
if (not output) or (output.upper().rstrip().endswith(
'NO SUCH FILE OR DIRECTORY')):
_log.info(' No base file: "%s"', baseline_fullpath)
@@ -733,27 +642,7 @@ class Rebaseliner(object):
# Get the diff between old and new baselines and save to the html dir.
if baseline_filename.upper().endswith('.TXT'):
- # If the user specified a custom diff command in their svn config
- # file, then it'll be used when we do svn diff, which we don't want
- # to happen since we want the unified diff. Using --diff-cmd=diff
- # doesn't always work, since they can have another diff executable
- # in their path that gives different line endings. So we use a
- # bogus temp directory as the config directory, which gets
- # around these problems.
- if sys.platform.startswith("win"):
- parent_dir = tempfile.gettempdir()
- else:
- parent_dir = sys.path[0] # tempdir is not secure.
- bogus_dir = os.path.join(parent_dir, "temp_svn_config")
- _log.debug(' Html: temp config dir: "%s".', bogus_dir)
- if not os.path.exists(bogus_dir):
- os.mkdir(bogus_dir)
- delete_bogus_dir = True
- else:
- delete_bogus_dir = False
-
- output = run_shell(["svn", "diff", "--config-dir", bogus_dir,
- baseline_fullpath])
+ output = self._scm.diff_for_file(baseline_fullpath, log=_log)
if output:
diff_file = get_result_file_fullpath(
self._options.html_directory, baseline_filename,
@@ -764,12 +653,6 @@ class Rebaseliner(object):
_log.info(' Html: created baseline diff file: "%s".',
diff_file)
- if delete_bogus_dir:
- shutil.rmtree(bogus_dir, True)
- _log.debug(' Html: removed temp config dir: "%s".',
- bogus_dir)
-
-
class HtmlGenerator(object):
"""Class to generate rebaselining result comparison html."""
@@ -1001,6 +884,10 @@ def main():
default=False,
help='include debug-level logging.')
+ option_parser.add_option('-q', '--quiet',
+ action='store_true',
+ help='Suppress result HTML viewing')
+
option_parser.add_option('-p', '--platforms',
default='mac,win,win-xp,win-vista,linux',
help=('Comma delimited list of platforms '
@@ -1011,6 +898,9 @@ def main():
'layout_test_results'),
help=('Url to find the layout test result archive'
' file.'))
+ option_parser.add_option('-U', '--force_archive_url',
+ help=('Url of result zip file. This option is for debugging '
+ 'purposes'))
option_parser.add_option('-w', '--webkit_canary',
action='store_true',
@@ -1106,7 +996,8 @@ def main():
rebaseline_platforms,
rebaselining_tests)
html_generator.generate_html()
- html_generator.show_html()
+ if not options.quiet:
+ html_generator.show_html()
log_dashed_string('Rebaselining result comparison done', None)
sys.exit(0)
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py
index 5d75a1b..e3c56c5 100644
--- a/WebKitTools/Scripts/webkitpy/style/checker.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker.py
@@ -205,7 +205,7 @@ _SKIPPED_FILES_WITH_WARNING = [
# The Qt API and tests do not follow WebKit style.
# They follow Qt style. :)
"gtk2drawing.c", # WebCore/platform/gtk/gtk2drawing.c
- "gtk2drawing.h", # WebCore/platform/gtk/gtk2drawing.h
+ "gtkdrawing.h", # WebCore/platform/gtk/gtkdrawing.h
"JavaScriptCore/qt/api/",
"WebKit/gtk/tests/",
"WebKit/qt/Api/",
diff --git a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
index e99ac68..5254275 100755
--- a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
@@ -281,10 +281,10 @@ class CheckerDispatcherSkipTest(unittest.TestCase):
# Check skipped files.
paths_to_skip = [
"gtk2drawing.c",
- "gtk2drawing.h",
+ "gtkdrawing.h",
"JavaScriptCore/qt/api/qscriptengine_p.h",
"WebCore/platform/gtk/gtk2drawing.c",
- "WebCore/platform/gtk/gtk2drawing.h",
+ "WebCore/platform/gtk/gtkdrawing.h",
"WebKit/gtk/tests/testatk.c",
"WebKit/qt/Api/qwebpage.h",
"WebKit/qt/tests/qwebsecurityorigin/tst_qwebsecurityorigin.cpp",
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/download.py b/WebKitTools/Scripts/webkitpy/tool/commands/download.py
index 17fb12c..59af16a 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/download.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/download.py
@@ -82,7 +82,6 @@ class Land(AbstractSequencedCommand):
steps.EnsureBuildersAreGreen,
steps.UpdateChangeLogsWithReviewer,
steps.ValidateReviewer,
- steps.EnsureBuildersAreGreen,
steps.Build,
steps.RunTests,
steps.Commit,
@@ -243,7 +242,6 @@ class AbstractPatchLandingCommand(AbstractPatchSequencingCommand):
steps.Update,
steps.ApplyPatch,
steps.ValidateReviewer,
- steps.EnsureBuildersAreGreen,
steps.Build,
steps.RunTests,
steps.Commit,
diff --git a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
index e682ca7..9c935e8 100644
--- a/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
+++ b/WebKitTools/Scripts/webkitpy/tool/commands/upload.py
@@ -178,8 +178,13 @@ class Post(AbstractPatchUploadingCommand):
class LandSafely(AbstractPatchUploadingCommand):
name = "land-safely"
- help_text = "Land the current diff via the commit-queue (Experimental)"
+ help_text = "Land the current diff via the commit-queue"
argument_names = "[BUGID]"
+ long_help = """land-safely updates the ChangeLog with the reviewer listed
+ in bugs.webkit.org for BUGID (or the bug ID detected from the ChangeLog).
+ The command then uploads the current diff to the bug and marks it for
+ commit by the commit-queue."""
+ show_in_main_help = True
steps = [
steps.UpdateChangeLogsWithReviewer,
steps.ObsoletePatches,
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py b/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py
index 40bc302..7b717ef 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/ensurebuildersaregreen.py
@@ -28,7 +28,7 @@
from webkitpy.tool.steps.abstractstep import AbstractStep
from webkitpy.tool.steps.options import Options
-from webkitpy.common.system.deprecated_logging import error
+from webkitpy.common.system.deprecated_logging import log, error
class EnsureBuildersAreGreen(AbstractStep):
@@ -45,4 +45,6 @@ class EnsureBuildersAreGreen(AbstractStep):
if not red_builders_names:
return
red_builders_names = map(lambda name: "\"%s\"" % name, red_builders_names) # Add quotes around the names.
- error("Builders [%s] are red, please do not commit.\nSee http://%s.\nPass --ignore-builders to bypass this check." % (", ".join(red_builders_names), self._tool.buildbot.buildbot_host))
+ log("\nBuilders [%s] are red, please do not commit.\nSee http://%s/console?category=core\n" % (", ".join(red_builders_names), self._tool.buildbot.buildbot_host))
+ if not self._tool.user.confirm("Are you sure you want to continue?"):
+ error("User aborted.")