Bug 1450839 - Centralize record_cherry_picks for reuse. - r=kvark
MozReview-Commit-ID: EdRewMsNCnG
new file mode 100644
--- /dev/null
+++ b/dom/canvas/test/webgl-conf/cherry_picks.txt
@@ -0,0 +1,10 @@
+
+Cherries picked
+================================================================================
+Merge base
+
+commit e899c531173da8ba956df8de6dd74fb7d9b1fa9c
+Author: Patrick To <patrto@microsoft.com>
+Date: Fri Mar 30 13:18:38 2018 -0700
+
+ Add unpack flip y test for depth textures (#2609)
--- a/dom/canvas/test/webgl-conf/import.py
+++ b/dom/canvas/test/webgl-conf/import.py
@@ -5,31 +5,33 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
assert __name__ == '__main__'
from pathlib import *
import subprocess
import sys
+REL_PATH = '/dom/canvas/test/webgl-conf'
REPO_DIR = Path.cwd()
DIR_IN_GECKO = Path(__file__).parent
-assert not REPO_DIR.samefile(DIR_IN_GECKO), 'Run from the KhronosGroup/WebGL checkout.'
-assert DIR_IN_GECKO.as_posix().endswith('dom/canvas/test/webgl-conf')
+assert not REPO_DIR.samefile(DIR_IN_GECKO), 'Run this script from the source git checkout.'
+assert DIR_IN_GECKO.as_posix().endswith(REL_PATH) # Be paranoid with rm -rf.
-def print_now(*args):
- print(*args)
- sys.stdout.flush()
-
+gecko_base_dir = DIR_IN_GECKO.as_posix()[:-len(REL_PATH)]
+angle_dir = Path(gecko_base_dir, 'gfx/angle').as_posix()
+sys.path.append(angle_dir)
+from vendor_from_git import *
-def run_checked(*args, **kwargs):
- print_now(' ', args)
- return subprocess.run(args, check=True, shell=True, **kwargs)
+# --
+merge_base_from = sys.argv[1]
+record_cherry_picks(DIR_IN_GECKO, merge_base_from)
+
+# --
src_dir = Path(REPO_DIR, 'sdk/tests').as_posix()
dest_dir = Path(DIR_IN_GECKO, 'checkout').as_posix()
-assert dest_dir.endswith('dom/canvas/test/webgl-conf/checkout') # Be paranoid with rm -rf.
-run_checked("rm -rf '{}'".format(dest_dir))
-run_checked("mkdir '{}'".format(dest_dir));
-run_checked("cp -rT '{}' '{}'".format(src_dir, dest_dir));
+run_checked("rm -rI '{}'".format(dest_dir), shell=True)
+run_checked("mkdir '{}'".format(dest_dir), shell=True);
+run_checked("cp -rT '{}' '{}'".format(src_dir, dest_dir), shell=True);
print_now('Done!')
new file mode 100644
--- /dev/null
+++ b/gfx/angle/vendor_from_git.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python3
+assert __name__ != '__main__'
+
+'''
+Any time we vendor[1] from an external git repo, we want to keep a record of the csets
+we're pulling from.
+
+This script leaves a record of the merge-base reference tip and cherry-picks that we pull
+into Gecko. (such as gfx/angle/cherry_picks.txt)
+'''
+
+from pathlib import *
+import subprocess
+import sys
+
+# --
+
+def print_now(*args):
+ print(*args)
+ sys.stdout.flush()
+
+
+def run_checked(*args, **kwargs):
+ print_now(' ', args)
+ return subprocess.run(args, check=True, **kwargs)
+
+# --
+
+def record_cherry_picks(dir_in_gecko, merge_base_from):
+ assert '/' in merge_base_from, 'Please specify a reference tip from a remote.'
+ log_path = Path(dir_in_gecko, 'cherry_picks.txt')
+ print_now('Logging cherry picks to {}.'.format(log_path))
+
+ print('cwd:', Path.cwd())
+ merge_base = run_checked('git', 'merge-base', 'HEAD', merge_base_from,
+ stdout=subprocess.PIPE).stdout.decode().strip()
+
+ mb_info = run_checked('git', 'log', '{}~1..{}'.format(merge_base, merge_base),
+ stdout=subprocess.PIPE).stdout
+ cherries = run_checked('git', 'log', merge_base + '..', stdout=subprocess.PIPE).stdout
+
+ with open(log_path, 'wb') as f:
+ f.write(cherries)
+ f.write(b'\nCherries picked')
+ f.write(b'\n' + (b'=' * 80))
+ f.write(b'\nMerge base')
+ f.write(b'\n\n')
+ f.write(mb_info)