For larger-scale content production and maintenance, it is advisable to maintain local copies of selected MathHub archives and keep them synchronized with MathHub.info. As there are literally hundreds of inter-dependent archives that need to be kept up to date, tool support is important for this. We present the current state of the art.
The MMT/lmh tool
The MMT system, which underlies MathHub.info provides the lmh tool that allows to clone (and maintain). Cloning a the AI-1/2 course and all the archives it depends on is a easy as mmt lmh install courses/FAU/AI/course
(it takes a while though).
git all
trick
Frederik's very useful If you add the following to the [alias]
section of the .gitconfig
file in your home directory
[alias]
all = "!f() { find . -name ".git" | xargs -I {} -P10 git -C {}/.. \"$@\"; }; f"
alls = "!f() { find . -name \".git\" | xargs -I % sh -c \"echo -------------------------- && grealpath -s --relative-to=. %/.. && git -C %/.. $@\"; }; f"
allps = "!f() { find . -name \".git\" | xargs -P10 -I % sh -c \"git -C %/.. $@ || (printf \\\"FAILURE IN REPOSITORY: \\\" && grealpath -s --relative-to=. %/..)\"; }; fetch"
sync = "!f() { git commit -am \"$1\"; git pull; git push; }; f"
syncu = "!f() { git commit -am \"$1\"; git pull; if (git remote get-url upstream > /dev/null 2> /dev/null); then git fetch upstream; git merge upstream/main; fi; git push; }; f"
then you can upgrade any git command to act on all the git repositories (recursively) in the current directory. For instance git all pull
pulls all of them (in parallel 10x) and git all commit -am'various fixes'
commits all.
As these are in parallel, the output may become difficult to map to the respective directory, therefore git alls ...
provides a sequential version and git allps ...
tries to do a better parallel version (your mileage may vary).
The git sync
alias allows to got the typical trilogy git commit -am'<something>'; git pull; git git push
in one go. This is especially convenient in connection with git all
since that way the find
is only done once (instead of three times). git syncu
also updates all forks from their upstreams; "publishing" the forks is just a git push upstream main
away.
gitsetup
script.
Michael's tbd
Frederik's pythyon tools
In https://gl.mathhub.info/smglom/meta-inf/-/tree/main/bin we have over time developed a couple of useful scripts. They automate replacements, moves, translations, dependencies annotation etc. across archive borders.