wiring fix, mapmerge update

This commit is contained in:
Killian
2020-04-04 16:23:19 +01:00
parent 6f21e7f371
commit 89bf195956
12 changed files with 6404 additions and 125921 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,12 @@
@echo off @echo off
cd ../../maps/ cd ../maps/yw
for /R %%f in (*.dmm) do copy "%%f" "%%f.backup" for /R %%f in (*.dmm) do copy "%%f" "%%f.backup"
cls cls
echo All dmm files in _maps directories have been backed up echo All dmm files in cryogaia directories have been backed up
echo Now you can make your changes... echo Now you can make your changes...
echo --- echo ---
echo Remember to run mapmerge.bat just before you commit your changes! echo Remember to run mapmerge.bat just before you commit your changes!
echo --- echo ---
pause pause

View File

@@ -1,5 +1,5 @@
@echo off @echo off
set MAPROOT=../../maps/ set MAPROOT=../maps/yw
set TGM=1 set TGM=1
python mapmerge.py python mapmerge.py
pause pause

View File

@@ -1,7 +0,0 @@
If you're making a PR to Github, or are a new mapper and have been told to "mapmerge":
Run dmm2tgm.bat, find the map you edited, and type it in. For instance, as of this date/writing, Tether Surface 2 is 163.
If Tether Surface 2 is still 163, type in 163 and hit enter, it will run mapmerge. This reduces the filediff for easier Git merging.
NOTE that this is not "merging" two maps together. ALL YOU ARE DOING IS REDUCING FILEDIFF. IF YOU NEED TO MAPMERGE PROPERLY, @ A DEVELOPER OR SOMEONE WITH MAPPING EXPERIENCE.

View File

@@ -1,52 +1,52 @@
# Map Merge 2 # Map Merge 2
**Map Merge 2** is an improvement over previous map merging scripts, with **Map Merge 2** is an improvement over previous map merging scripts, with
better merge-conflict prevention, multi-Z support, and automatic handling of better merge-conflict prevention, multi-Z support, and automatic handling of
key overflow. For up-to-date tips and tricks, also visit the [Map Merger] wiki article. key overflow. For up-to-date tips and tricks, also visit the [Map Merger] wiki article.
## What Map Merging Is ## What Map Merging Is
The "map merge" operation describes the process of rewriting a map file written The "map merge" operation describes the process of rewriting a map file written
by the DreamMaker map editor to A) use a format more amenable to Git's conflict by the DreamMaker map editor to A) use a format more amenable to Git's conflict
resolution and B) differ in the least amount textually from the previous resolution and B) differ in the least amount textually from the previous
version of the map while maintaining all the actual changes. It requires an old version of the map while maintaining all the actual changes. It requires an old
version of the map to use as a reference and a new version of the map which version of the map to use as a reference and a new version of the map which
contains the desired changes. contains the desired changes.
## Installation ## Installation
To install Python dependencies, run `requirements-install.bat`, or run To install Python dependencies, run `requirements-install.bat`, or run
`python -m pip install -r requirements.txt` directly. See the [Git hooks] `python -m pip install -r requirements.txt` directly. See the [Git hooks]
documentation to install the Git pre-commit hook which runs the map merger documentation to install the Git pre-commit hook which runs the map merger
automatically, or use `tools/mapmerge/Prepare Maps.bat` to save backups before automatically, or use `tools/mapmerge/Prepare Maps.bat` to save backups before
running `mapmerge.bat`. running `mapmerge.bat`.
For up-to-date installation and detailed troubleshooting instructions, visit For up-to-date installation and detailed troubleshooting instructions, visit
the [Map Merger] wiki article. the [Map Merger] wiki article.
## Code Structure ## Code Structure
Frontend scripts are meant to be run directly. They obey the environment Frontend scripts are meant to be run directly. They obey the environment
variables `TGM` to set whether files are saved in TGM (1) or DMM (0) format, variables `TGM` to set whether files are saved in TGM (1) or DMM (0) format,
and `MAPROOT` to determine where maps are kept. By default, TGM is used and and `MAPROOT` to determine where maps are kept. By default, TGM is used and
the map root is autodetected. Each script may either prompt for the desired map the map root is autodetected. Each script may either prompt for the desired map
or be run with command-line parameters indicating which maps to act on. The or be run with command-line parameters indicating which maps to act on. The
scripts include: scripts include:
* `convert.py` for converting maps to and from the TGM format. Used by * `convert.py` for converting maps to and from the TGM format. Used by
`tgm2dmm.bat` and `dmm2tgm.bat`. `tgm2dmm.bat` and `dmm2tgm.bat`.
* `mapmerge.py` for running the map merge on map backups saved by * `mapmerge.py` for running the map merge on map backups saved by
`Prepare Maps.bat`. Used by `mapmerge.bat` `Prepare Maps.bat`. Used by `mapmerge.bat`
Implementation modules: Implementation modules:
* `dmm.py` includes the map reader and writer. * `dmm.py` includes the map reader and writer.
* `mapmerge.py` includes the implementation of the map merge operation. * `mapmerge.py` includes the implementation of the map merge operation.
* `frontend.py` includes the common code for the frontend scripts. * `frontend.py` includes the common code for the frontend scripts.
`precommit.py` is run by the [Git hooks] if installed, and merges the new `precommit.py` is run by the [Git hooks] if installed, and merges the new
version of any map saved in the index (`git add`ed) with the old version stored version of any map saved in the index (`git add`ed) with the old version stored
in Git when run. in Git when run.
[Map Merger]: https://tgstation13.org/wiki/Map_Merger [Map Merger]: https://tgstation13.org/wiki/Map_Merger
[Git hooks]: ../hooks/README.md [Git hooks]: ../hooks/README.md

View File

@@ -0,0 +1,36 @@
# Git Integration Hooks
This folder contains installable scripts for [Git hooks] and [merge drivers].
Use of these hooks and drivers is optional and they must be installed
explicitly before they take effect.
To install the current set of hooks, or update if new hooks are added, run
`install.bat` (Windows) or `install.sh` (Unix-like) as appropriate.
Hooks expect a Unix-like environment on the backend. Usually this is handled
automatically by GUI tools like TortoiseGit and GitHub for Windows, but
[Git for Windows] is an option if you prefer to use a CLI even on Windows.
## Current Hooks
* **Pre-commit**: Runs [mapmerge2] on changed maps, if any.
## Adding New Hooks
New [Git hooks] may be added by creating a file named `<hook-name>.hook` in
this directory. Git determines what hooks are available and what their names
are. The install script copies the `.hook` file into `.git/hooks`, so editing
the `.hook` file will require a reinstall.
New [merge drivers] may be added by adding a shell script named `<ext>.merge`
and updating `.gitattributes` in the root of the repository to include the line
`*.<ext> merge=<ext>`. The install script will set up the merge driver to point
to the `.merge` file directly, and editing it will not require a reinstall.
`tools/hooks/python.sh` may be used as a trampoline to ensure that the correct
version of Python is found.
[Git hooks]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
[merge drivers]: https://git-scm.com/docs/gitattributes#_performing_a_three_way_merge
[Git for Windows]: https://gitforwindows.org/
[mapmerge2]: ../mapmerge2/README.md

View File

@@ -0,0 +1,15 @@
@echo off
cd %~dp0
for %%f in (*.hook) do (
echo Installing hook: %%~nf
mkdir ..\..\..\.git\hooks
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

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/mapmerge2/hooks/$f %P %O %A %B %L"
done
echo "Done"

View File

@@ -0,0 +1,2 @@
#!/bin/bash
exec tools/mapmerge2/hooks/python.sh -m precommit

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 "$@"

52
tools/mapmerge2/readme.md Normal file
View File

@@ -0,0 +1,52 @@
# Map Merge 2
**Map Merge 2** is an improvement over previous map merging scripts, with
better merge-conflict prevention, multi-Z support, and automatic handling of
key overflow. For up-to-date tips and tricks, also visit the [Map Merger] wiki article.
## What Map Merging Is
The "map merge" operation describes the process of rewriting a map file written
by the DreamMaker map editor to A) use a format more amenable to Git's conflict
resolution and B) differ in the least amount textually from the previous
version of the map while maintaining all the actual changes. It requires an old
version of the map to use as a reference and a new version of the map which
contains the desired changes.
## Installation
To install Python dependencies, run `requirements-install.bat`, or run
`python -m pip install -r requirements.txt` directly. See the [Git hooks]
documentation to install the Git pre-commit hook which runs the map merger
automatically, or use `tools/mapmerge/Prepare Maps.bat` to save backups before
running `mapmerge.bat`.
For up-to-date installation and detailed troubleshooting instructions, visit
the [Map Merger] wiki article.
## Code Structure
Frontend scripts are meant to be run directly. They obey the environment
variables `TGM` to set whether files are saved in TGM (1) or DMM (0) format,
and `MAPROOT` to determine where maps are kept. By default, TGM is used and
the map root is autodetected. Each script may either prompt for the desired map
or be run with command-line parameters indicating which maps to act on. The
scripts include:
* `convert.py` for converting maps to and from the TGM format. Used by
`tgm2dmm.bat` and `dmm2tgm.bat`.
* `mapmerge.py` for running the map merge on map backups saved by
`Prepare Maps.bat`. Used by `mapmerge.bat`
Implementation modules:
* `dmm.py` includes the map reader and writer.
* `mapmerge.py` includes the implementation of the map merge operation.
* `frontend.py` includes the common code for the frontend scripts.
`precommit.py` is run by the [Git hooks] if installed, and merges the new
version of any map saved in the index (`git add`ed) with the old version stored
in Git when run.
[Map Merger]: https://tgstation13.org/wiki/Map_Merger
[Git hooks]: ../hooks/README.md

View File

@@ -1,3 +1,3 @@
pygit2 pygit2
bidict==0.13.1 bidict==0.13.1
Pillow==6.2.0 Pillow==5.1.0