Index: Tools/Scripts/webkitpy/w3c/test_importer.py |
diff --git a/Tools/Scripts/webkitpy/w3c/test_importer.py b/Tools/Scripts/webkitpy/w3c/test_importer.py |
index b7d89bd29a9b93eabd42af9c659841145b83713c..e7bdb86ac051f8ef4f4ba99cadf1ef1717d97e34 100644 |
--- a/Tools/Scripts/webkitpy/w3c/test_importer.py |
+++ b/Tools/Scripts/webkitpy/w3c/test_importer.py |
@@ -166,6 +166,7 @@ class TestImporter(object): |
self.destination_directory = self.filesystem.normpath(self.filesystem.join(self.layout_tests_dir, options.destination, |
self.filesystem.basename(self.top_of_repo))) |
self.import_in_place = (self.dir_to_import == self.destination_directory) |
+ self.dir_above_repo = self.filesystem.dirname(self.top_of_repo) |
self.changeset = CHANGESET_NOT_AVAILABLE |
@@ -189,7 +190,7 @@ class TestImporter(object): |
paths_to_skip = self.find_paths_to_skip() |
for root, dirs, files in os.walk(directory): |
- cur_dir = root.replace(self.layout_tests_dir + '/', '') + '/' |
+ cur_dir = root.replace(self.dir_above_repo + '/', '') + '/' |
_log.info(' scanning ' + cur_dir + '...') |
total_tests = 0 |
reftests = 0 |
@@ -202,13 +203,17 @@ class TestImporter(object): |
dirs.remove(d) |
for path in paths_to_skip: |
- path_base = path.replace(cur_dir, '') |
+ path_base = path.replace(self.options.destination + '/', '') |
+ path_base = path_base.replace(cur_dir, '') |
path_full = self.filesystem.join(root, path_base) |
if path_base in dirs: |
dirs.remove(path_base) |
if not self.options.dry_run and self.import_in_place: |
_log.info(" pruning %s" % path_base) |
self.filesystem.rmtree(path_full) |
+ else: |
+ _log.info(" skipping %s" % path_base) |
+ |
copy_list = [] |
@@ -220,6 +225,8 @@ class TestImporter(object): |
_log.info(" pruning %s" % path_base) |
self.filesystem.remove(path_full) |
continue |
+ else: |
+ continue |
# FIXME: This block should really be a separate function, but the early-continues make that difficult. |
if filename.startswith('.') or filename.endswith('.pl'): |
@@ -350,13 +357,14 @@ class TestImporter(object): |
if not self.import_in_place and not self.options.dry_run: |
os.makedirs(os.path.dirname(new_filepath)) |
+ relpath = os.path.relpath(new_filepath, self.layout_tests_dir) |
if not self.options.overwrite and os.path.exists(new_filepath): |
- _log.info(' skipping import of existing file ' + new_filepath) |
+ _log.info(' skipping %s' % relpath) |
else: |
# FIXME: Maybe doing a file diff is in order here for existing files? |
# In other words, there's no sense in overwriting identical files, but |
# there's no harm in copying the identical thing. |
- _log.info(' importing %s', os.path.relpath(new_filepath, self.layout_tests_dir)) |
+ _log.info(' %s' % relpath) |
# Only html, xml, or css should be converted |
# FIXME: Eventually, so should js when support is added for this type of conversion |
@@ -383,10 +391,6 @@ class TestImporter(object): |
copied_files.append(new_filepath.replace(self._webkit_root, '')) |
- if not self.import_in_place and not self.options.dry_run: |
- self.remove_deleted_files(new_path, copied_files) |
- self.write_import_log(new_path, copied_files, prefixed_properties) |
- |
_log.info('') |
_log.info('Import complete') |
_log.info('') |
@@ -395,9 +399,11 @@ class TestImporter(object): |
_log.info('Imported %d JS tests', total_imported_jstests) |
_log.info('Imported %d pixel/manual tests', total_imported_tests - total_imported_jstests - total_imported_reftests) |
_log.info('') |
- _log.info('Properties needing prefixes (by count):') |
- for prefixed_property in sorted(total_prefixed_properties, key=lambda p: total_prefixed_properties[p]): |
- _log.info(' %s: %s', prefixed_property, total_prefixed_properties[prefixed_property]) |
+ |
+ if total_prefixed_properties: |
+ _log.info('Properties needing prefixes (by count):') |
+ for prefixed_property in sorted(total_prefixed_properties, key=lambda p: total_prefixed_properties[p]): |
+ _log.info(' %s: %s', prefixed_property, total_prefixed_properties[prefixed_property]) |
def setup_destination_directory(self): |
""" Creates a destination directory that mirrors that of the source directory """ |
@@ -410,51 +416,3 @@ class TestImporter(object): |
os.makedirs(destination_directory) |
_log.info('Tests will be imported into: %s', destination_directory) |
- |
- def remove_deleted_files(self, dir_to_import, new_file_list): |
- previous_file_list = [] |
- |
- import_log_file = os.path.join(dir_to_import, 'w3c-import.log') |
- if not os.path.exists(import_log_file): |
- return |
- |
- import_log = open(import_log_file, 'r') |
- contents = import_log.readlines() |
- |
- if 'List of files\n' in contents: |
- list_index = contents.index('List of files:\n') + 1 |
- previous_file_list = [filename.strip() for filename in contents[list_index:]] |
- |
- deleted_files = set(previous_file_list) - set(new_file_list) |
- for deleted_file in deleted_files: |
- _log.info('Deleting file removed from the W3C repo: %s', deleted_file) |
- deleted_file = os.path.join(self._webkit_root, deleted_file) |
- os.remove(deleted_file) |
- |
- import_log.close() |
- |
- def write_import_log(self, dir_to_import, file_list, prop_list): |
- now = datetime.datetime.now() |
- |
- import_log = open(os.path.join(dir_to_import, 'w3c-import.log'), 'w') |
- import_log.write('The tests in this directory were imported from the W3C repository.\n') |
- import_log.write('Do NOT modify these tests directly in Webkit. Instead, push changes to the W3C CSS repo:\n\n') |
- import_log.write('http://hg.csswg.org/test\n\n') |
- import_log.write('Then run the Tools/Scripts/import-w3c-tests in Webkit to reimport\n\n') |
- import_log.write('Do NOT modify or remove this file\n\n') |
- import_log.write('------------------------------------------------------------------------\n') |
- import_log.write('Last Import: ' + now.strftime('%Y-%m-%d %H:%M') + '\n') |
- import_log.write('W3C Mercurial changeset: ' + self.changeset + '\n') |
- import_log.write('------------------------------------------------------------------------\n') |
- import_log.write('Properties requiring vendor prefixes:\n') |
- if prop_list: |
- for prop in prop_list: |
- import_log.write(prop + '\n') |
- else: |
- import_log.write('None\n') |
- import_log.write('------------------------------------------------------------------------\n') |
- import_log.write('List of files:\n') |
- for item in file_list: |
- import_log.write(item + '\n') |
- |
- import_log.close() |