tool has something in common with update-patches shell script, but has more features and is more intelligent. See README.patchtool or source code for details.