Bug 866424 - Part c: Use git instead of hg-git to clone upstream test suites; r=jhammel
authorMs2ger <ms2ger@gmail.com>
Fri, 10 May 2013 09:11:35 +0200
changeset 142312 63a7302983a189f143921fda3b2e38d0219d0d5c
parent 142311 4f1bc514ea8b1e193b2eb1f308b82041df6cba84
child 142313 8e0e481f674639c07e44c5cf640f2ca0538bf5a7
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhammel
bugs866424
milestone23.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 866424 - Part c: Use git instead of hg-git to clone upstream test suites; r=jhammel
dom/imptests/editing.txt
dom/imptests/html.txt
dom/imptests/importTestsuite.py
dom/imptests/webapps.txt
--- a/dom/imptests/editing.txt
+++ b/dom/imptests/editing.txt
@@ -1,2 +1,2 @@
-https://dvcs.w3.org/hg/editing|editing
+hg|https://dvcs.w3.org/hg/editing|editing
 
--- a/dom/imptests/html.txt
+++ b/dom/imptests/html.txt
@@ -1,9 +1,9 @@
-git+ssh://git@github.com:w3c/web-platform-tests.git|html
+git|git://github.com/w3c/web-platform-tests.git|html
 domxpath
 html/browsers/browsing-the-web/read-media
 html/browsers/the-window-object
 html/dom/documents/dom-tree-accessors
 html/dom/elements/global-attributes
 html/editing/the-hidden-attribute
 html/obsolete/requirements-for-implementations/other-elements-attributes-and-apis
 html/semantics/document-metadata/the-title-element
--- a/dom/imptests/importTestsuite.py
+++ b/dom/imptests/importTestsuite.py
@@ -23,36 +23,35 @@ import writeBuildFiles
 HEADERS_SUFFIX = "^headers^"
 
 def parseManifestFile(dest, dir):
     subdirs, mochitests, _, __, supportfiles = parseManifest.parseManifestFile("hg-%s/%s/MANIFEST" % (dest, dir))
     return subdirs, mochitests, supportfiles
 
 def getData(confFile):
     """This function parses a file of the form
-    URL of remote repository|Name of the destination directory
+    (hg or git)|URL of remote repository|identifier for the local directory
     First directory of tests
     ...
     Last directory of tests"""
-    repo = ""
-    dest = ""
+    vcs = ""
+    url = ""
+    iden = ""
     directories = []
     try:
         with open(confFile, 'r') as fp:
             first = True
             for line in fp:
                 if first:
-                    idx = line.index("|")
-                    repo = line[:idx].strip()
-                    dest = line[idx + 1:].strip()
+                    vcs, url, iden = line.strip().split("|")
                     first = False
                 else:
                     directories.append(line.strip())
     finally:
-        return repo, dest, directories
+        return vcs, url, iden, directories
 
 def makePath(a, b):
     if not b:
         # Empty directory, i.e., the repository root.
         return a
     return "%s/%s" % (a, b)
 
 def copyTest(source, dest):
@@ -129,27 +128,37 @@ def hgadd(dest, directories):
     print("hg addremoving...")
     for d in directories:
         subprocess.check_call(["hg", "addremove", "%s/%s" % (dest, d)])
 
 def importDirs(thissrcdir, dest, directories):
     copy(thissrcdir, dest, directories)
     printBuildFiles(thissrcdir, dest, directories)
 
+def removeAndCloneRepo(vcs, url, dest):
+    """Replaces the repo at dest by a fresh clone from url using vcs"""
+    assert vcs in ('hg', 'git')
+
+    print("Removing %s..." % dest)
+    subprocess.check_call(["rm", "-rf", dest])
+
+    print("Cloning %s to %s with %s..." % (url, dest, vcs))
+    subprocess.check_call([vcs, "clone", url, dest])
+
 def importRepo(confFile, thissrcdir):
     try:
-        repo, dest, directories = getData(confFile)
-        hgdest = "hg-%s" % (dest, )
-        print("Going to clone %s to %s..." % (repo, hgdest))
+        vcs, url, iden, directories = getData(confFile)
+        dest = iden
+        hgdest = "hg-%s" % iden
+
         print("Removing %s..." % dest)
         subprocess.check_call(["rm", "-rf", dest])
-        print("Removing %s..." % hgdest)
-        subprocess.check_call(["rm", "-rf", hgdest])
-        print("Cloning %s to %s..." % (repo, hgdest))
-        subprocess.check_call(["hg", "clone", repo, hgdest])
+
+        removeAndCloneRepo(vcs, url, hgdest)
+
         print("Going to import %s..." % directories)
         importDirs(thissrcdir, dest, directories)
         printMozbuildFile(dest, directories)
         hgadd(dest, directories)
         print("Removing %s again..." % hgdest)
         subprocess.check_call(["rm", "-rf", hgdest])
     except subprocess.CalledProcessError as e:
         print(e.returncode)
--- a/dom/imptests/webapps.txt
+++ b/dom/imptests/webapps.txt
@@ -1,6 +1,6 @@
-https://dvcs.w3.org/hg/webapps|webapps
+hg|https://dvcs.w3.org/hg/webapps|webapps
 DOMCore/tests/approved
 DOMCore/tests/submissions/Ms2ger
 DOMCore/tests/submissions/Opera
 WebStorage/tests/submissions
 XMLHttpRequest/tests/submissions/Ms2ger