Add a new and improved mapmerge (#33869)

Key benefits of the new mapmerge include: multi-Z support, effective
reuse of deleted keys, automatic handling of key overflow, and utilizing
a git pre-commit hook to eliminate the need to run batch files manually.
This commit is contained in:
Tad Hardesty
2017-12-29 00:28:25 -06:00
committed by CitadelStationBot
parent 0d79434b72
commit 61f00cbfb0
14 changed files with 801 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
@echo off
cd %~dp0
for %%f in (*.hook) do (
echo Installing hook: %%~nf
copy %%f ..\..\.git\hooks\%%~nf >nul
)
for %%f in (*.merge) do (
echo Installing merge driver: %%~nf
echo [merge "%%~nf"]^
driver = tools/hooks/%%f %%P %%O %%A %%B %%L >> ..\..\.git\config
)
echo Done
pause
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
cd "$(dirname "$0")"
for f in *.hook; do
echo Installing hook: ${f%.hook}
cp $f ../../.git/hooks/${f%.hook}
done
for f in *.merge; do
echo Installing merge driver: ${f%.merge}
git config --replace-all merge.${f%.merge}.driver "tools/hooks/$f %P %O %A %B %L"
done
echo "Done"
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
exec tools/hooks/python.sh -m precommit
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -e
if command -v python3 >/dev/null 2>&1; then
PY=python3
else
PY=python
fi
PATHSEP=$($PY - <<'EOF'
import sys, os
if sys.version_info.major != 3 or sys.version_info.minor < 6:
sys.stderr.write("Python 3.6+ is required: " + sys.version + "\n")
exit(1)
print(os.pathsep)
EOF
)
export PYTHONPATH=tools/mapmerge2/${PATHSEP}${PYTHONPATH}
$PY "$@"