Bug 1258916 part 3 - Skip rather than throw when replacing a file with an identical one. r=dbaron
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 24 Mar 2016 09:48:05 +0800
changeset 331107 98af3ab721a2f3837ad891b672803a5c60dfcf4b
parent 331106 869d07eddd3a61085eb2c7f2c7bf426061ad2c77
child 331108 62f3627f60235bafaa7d9425a058c8af5ecd2a39
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1258916
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1258916 part 3 - Skip rather than throw when replacing a file with an identical one. r=dbaron MozReview-Commit-ID: DJi5NzYlTQw
layout/reftests/w3c-css/import-tests.py
--- 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")