michael@0: #!/usr/bin/env python michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: # You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: from __future__ import unicode_literals michael@0: michael@0: import subprocess michael@0: michael@0: repo = "https://github.com/w3c/testharness.js" michael@0: dest = "resources-upstream" michael@0: files = [{"f":"testharness.js"}, michael@0: {"f":"testharness.css"}, michael@0: {"f":"idlharness.js"}, michael@0: {"d":"webidl2/lib/webidl2.js", "f":"WebIDLParser.js"}] michael@0: michael@0: subprocess.check_call(["git", "clone", repo, dest]) michael@0: subprocess.check_call(["git", "submodule", "init"], cwd=dest) michael@0: subprocess.check_call(["git", "submodule", "update"], cwd=dest) michael@0: for f in files: michael@0: path = f["d"] if "d" in f else f["f"] michael@0: subprocess.check_call(["cp", "%s/%s" % (dest, path), f["f"]]) michael@0: subprocess.check_call(["hg", "add", f["f"]]) michael@0: subprocess.check_call(["rm", "-rf", dest]) michael@0: