evo-maven-patch-generation
Generates GNU-compatible unified diff patches for proposed code or POM fixes, writes them to numbered patch files, and applies them to the repository.
SKILL.mdtasks-evolved/fix-build-google-auto/environment/skills/evo-maven-patch-generation/SKILL.md
GitHubevo-maven-patch-generation
Generates and applies unified diff patches for Java Maven build fixes.
Key Functions
generate_unified_diff(original_text, modified_text, file_path)- Basic unified diffmake_strict_patch(original_text, modified_text, file_path)- Strict diff with EOF newline handlingwrite_patch_file(patch_content, patch_path)- Write patch to diskapply_patch_via_git(patch_path, project_dir)- Apply via git applyapply_patch_via_patch_command(patch_path, project_dir, strip)- Apply via patch commandapply_patch(patch_path, project_dir)- Try git apply, fallback to patchmodify_file_content(file_path, old_text, new_text)- Simple text replacementmodify_java_source(file_path, modifications)- Apply multiple replacements to Java filemodify_pom_xml(pom_path, property_changes)- Modify POM propertiescreate_travis_fix_patch(travis_path, old_text, new_text, patch_path)- Fix .travis.yml
Usage
import sys
sys.path.insert(0, '/app/environment/skills/evo-maven-patch-generation/scripts')
from utils import (
make_strict_patch, write_patch_file, apply_patch,
modify_file_content, create_travis_fix_patch
)
# Fix .travis.yml typo
create_travis_fix_patch('.travis.yml', 'build.pom.xml', 'build-pom.xml', 'patch_1.diff')
# Apply patch
apply_patch('patch_1.diff', '/path/to/project')
Important Notes
- Always use
make_strict_patchfor git-compatible patches (handles EOF newlines) - Patch files use standard unified diff format compatible with
git applyandpatch - File paths in diffs use
a/andb/prefixes