Resolve all conflicts in .tex files using the given strategy. strategy: "ours" keeps the local (AI) version, "theirs" keeps the remote (human) version
(self, repo_dir: Path, strategy: str = "ours")
| 40 | return conflicts |
| 41 | |
| 42 | def resolve(self, repo_dir: Path, strategy: str = "ours") -> list[str]: |
| 43 | """Resolve all conflicts in .tex files using the given strategy. |
| 44 | |
| 45 | strategy: "ours" keeps the local (AI) version, |
| 46 | "theirs" keeps the remote (human) version |
| 47 | """ |
| 48 | resolved_files: list[str] = [] |
| 49 | for tex in repo_dir.glob("**/*.tex"): |
| 50 | content = tex.read_text(encoding="utf-8", errors="replace") |
| 51 | if not _CONFLICT_MARKER.search(content): |
| 52 | continue |
| 53 | resolved = _resolve_content(content, strategy) |
| 54 | tex.write_text(resolved, encoding="utf-8") |
| 55 | resolved_files.append(str(tex.relative_to(repo_dir))) |
| 56 | logger.info("Resolved conflicts in %s (strategy=%s)", tex.name, strategy) |
| 57 | return resolved_files |
| 58 | |
| 59 | |
| 60 | def _extract_conflicts(content: str) -> list[dict[str, str]]: |