INNER CODE UNIT · Python
show
sameerasw/essentials · scripts/resolve_strings_conflict.py:9
def show(stage, path):
return subprocess.run(["git", "show", f":{stage}:{path}"], capture_output=True, text=True, check=True).stdout
def entries(text):
return {m.group(4): m.group(2) for m in ENTRY.finditer(text)}
def resolve(path):
base_text = show(3, path)
incoming = entries(show(2, path))
seen = set()
def sub(m):
name = m.group(4)
seen.add(name)
return m.group(1) + incoming.get(name, m.group(2))