Bug 1258916 part 3 - Skip rather than throw when replacing a file with an identical one. r=dbaron
MozReview-Commit-ID: DJi5NzYlTQw
--- a/layout/reftests/w3c-css/import-tests.py
+++ b/layout/reftests/w3c-css/import-tests.py
@@ -2,16 +2,17 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
from optparse import OptionParser
from subprocess import Popen, PIPE
import xml.dom.minidom
import html5lib
+import filecmp
import shutil
import sys
import re
# FIXME:
# * Import more tests rather than just the very limited set currently
# chosen.
# * Read in a (checked-in) input file with a list of test assertions
@@ -130,16 +131,19 @@ def copy_file(test, srcfile, destname, i
logname = srcfile[len(gSrcPath):]
gLog.write("Importing " + to_unix_path_sep(logname) +
" to " + to_unix_path_sep(destname) + "\n")
destfile = os.path.join(gDestPath, destname)
destdir = os.path.dirname(destfile)
if not os.path.exists(destdir):
os.makedirs(destdir)
if os.path.exists(destfile):
+ if filecmp.cmp(srcfile, destfile):
+ print "Warning: duplicate file {}".format(destname)
+ return
raise StandardError("file " + destfile + " already exists")
copy_and_prefix(test, srcfile, destfile, gPrefixedProperties, isSupportFile)
def copy_support_files(test, dirname, spec):
if dirname in support_dirs_mapped:
return
support_dirs_mapped.add(dirname)
support_dir = os.path.join(dirname, "support")