1#! /usr/bin/env python3
2#
3# This Source Code Form is subject to the terms of the Mozilla Public
4# License, v. 2.0. If a copy of the MPL was not distributed with this
5# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7assert __name__ == "__main__"
8
9from pathlib import Path
10import shutil
11import sys
12
13REL_PATH = "/dom/canvas/test/webgl-conf"
14REPO_DIR = Path.cwd()
15DIR_IN_GECKO = Path(__file__).parent
16assert not REPO_DIR.samefile(
17    DIR_IN_GECKO
18), "Run this script from the source git checkout."
19assert DIR_IN_GECKO.as_posix().endswith(REL_PATH)  # Be paranoid with rm -rf.
20
21gecko_base_dir = DIR_IN_GECKO.as_posix()[: -len(REL_PATH)]
22angle_dir = Path(gecko_base_dir, "gfx/angle").as_posix()
23sys.path.append(angle_dir)
24from vendor_from_git import print_now, record_cherry_picks
25
26# --
27
28(MERGE_BASE_ORIGIN,) = sys.argv[1:]  # Not always 'origin'!
29record_cherry_picks(DIR_IN_GECKO, MERGE_BASE_ORIGIN)
30
31# --
32
33src_dir = Path(REPO_DIR, "sdk/tests")
34dest_dir = Path(DIR_IN_GECKO, "checkout")
35print_now("Nuking old checkout...")
36shutil.rmtree(dest_dir, True)
37print_now("Writing new checkout...")
38shutil.copytree(src_dir, dest_dir, copy_function=shutil.copy)
39
40print_now("Done!")
41