D1121/rP21218 re-enabled the phalanx formation, but also introduced new templates:
template_unit_champion_infantry_spearman_hoplite.xml template_unit_hero_infantry_spearman_hoplite.xml template_unit_infantry_melee_spearman_hoplite.xml
The only difference between those and their parent is they add the phalanx formation.
Formations themselves are defined in the simulation/templates/special/formations/* files (the tooltips informing players which units can form a formation are here too, which is a bit unfortunate). Whether an unit can form a formation is defined under <Identity/Formations> in template_unit.xml and its descendants. However, only formations listed in the simulation/data/civs/* files are actually available.
Those new *_hoplite.xml templates are basically unnecessary file inflation: one could simply insert the phalanx formation in the *_spearmen.xml templates. This patch does that. E.g. gaul spearmen won't be able to form a phalanx, because it isn't listed in the gaul.json file. Likewise, the syntagma formation is just included in the *_pikeman.xml templates, not in a separate level.
While at it, this patch cleans up the occurrences of the testudo formation, limiting it to swordsmen only, which is more systematic than the current, messy situation. E.g. macemen don't really need it, only maur has such champions, and the testudo formation is rome only.
Further questions:
Should kush have the syntagma formation?
Should pers have the phalanx formation?
Should rome have the anti_cavalry formation?