A console tool to compare two KPHP outputs (folders with .cpp/.h files generated from PHP code).
It is useful for KPHP development — to make sure your refactoring doesn't affect codegeneration.
Imagine that you have your KPHP compiled site and at the same time you are KPHP developer. You have a compiled stable version of your site and start refactoring KPHP or implementing new features. Afterwards, you want to ensure that your changes haven't affected codegeneration — or if had, they are expected.
The easiest way to do it is just to compare previous (stable) codegenerated folder against a new one.
This tool performs fast comparing (fast even for 100k files), outputs brief diff info and detailed diff log files.
This is much faster than just diff -r.
Also, this tool knows about KPHP codegeneration specifics and deals with situations when there is no logical diff even if file contents actually differ.
This is a Node.JS script without any dependencies, so you even don't need npm/yarn — just copy/clone the sources, and installation is done.
- Compile your site with stable KPHP version, backup output like
cp -r /path/to/compiled kphp_master - Change KPHP sources or switch branches
- Compile your site with new KPHP version
- Create empty
mkdir difffolder; orrm -r diff/*if it existed - Run this tool:
node kphp-diff-comparator/ --master kphp_master --cmp /path/to/compiled --diff diff
- Examine the output. Also, for every diff file system
diffis invoked, and its result is placed to--difffolder.
--skip-comments— do not pay attention to files which differ only in PHP comments