Git rerere (reuse recorded resolution) implementation.
This module implements Git's rerere functionality, which records and reuses manual conflict resolutions. When a merge conflict occurs, rerere records the conflict and the resolution. If the same conflict happens again, rerere can automatically apply the recorded resolution.
| Class | |
Manages the rerere cache in .git/rr-cache/. |
| Function | is |
Check if rerere.autoupdate is enabled in the config. |
| Function | is |
Check if rerere is enabled in the config. |
| Function | rerere |
Automatically record conflicts and apply known resolutions. |
| Function | _compute |
Compute a unique ID for a conflict based on its preimage. |
| Function | _extract |
Extract conflict regions from file content. |
| Function | _has |
Check if content contains conflict markers. |
| Function | _normalize |
Normalize conflict markers to a canonical form. |
| Function | _remove |
Remove all conflict markers from resolved content. |
Check if rerere.autoupdate is enabled in the config.
| Parameters | |
config:StackedConfig | Git configuration |
| Returns | |
bool | True if rerere.autoupdate is enabled |
Check if rerere is enabled in the config.
| Parameters | |
config:StackedConfig | Git configuration |
| Returns | |
bool | True if rerere is enabled |
Repo, working_tree_path: bytes | str, conflicts: list[ bytes]) -> tuple[ list[ tuple[ bytes, str]], list[ bytes]]:
¶
Automatically record conflicts and apply known resolutions.
This is the main entry point for rerere integration with merge operations. It should be called after a merge that resulted in conflicts.
| Parameters | |
repo:Repo | Repository object |
workingbytes | str | Path to the working tree |
conflicts:list[ | List of conflicted file paths |
| Returns | |
Tuple of |
|
Normalize conflict markers to a canonical form.
This removes the side names (ours/theirs) from conflict markers to create a preimage that only depends on the structure of the conflict.
| Parameters | |
content:bytes | File content with conflict markers |
| Returns | |
bytes | Normalized content with generic conflict markers |