MCPcopy
hub / github.com/aiming-lab/AutoResearchClaw / _resolve_content

Function _resolve_content

researchclaw/overleaf/conflict.py:87–107  ·  view source on GitHub ↗

Replace conflict markers with the chosen side.

(content: str, strategy: str)

Source from the content-addressed store, hash-verified

85
86
87def _resolve_content(content: str, strategy: str) -> str:
88 """Replace conflict markers with the chosen side."""
89 lines = content.splitlines(keepends=True)
90 result: list[str] = []
91 state = "normal" # normal | ours | theirs
92
93 for line in lines:
94 if line.startswith("<<<<<<<"):
95 state = "ours"
96 elif line.startswith("=======") and state == "ours":
97 state = "theirs"
98 elif line.startswith(">>>>>>>") and state == "theirs":
99 state = "normal"
100 else:
101 if state == "normal":
102 result.append(line)
103 elif state == "ours" and strategy == "ours":
104 result.append(line)
105 elif state == "theirs" and strategy == "theirs":
106 result.append(line)
107 return "".join(result)

Callers 3

resolveMethod · 0.85

Calls 1

appendMethod · 0.45

Tested by 2