Refactor: tools: separate patch application and generation code in crm_diff
Make crm_diff code easier to follow