Merge apply_patches() and reverse_patches() into patch_action().