MCPcopy Create free account
hub / github.com/danvk/webdiff / parse_raw_diff_line

Function parse_raw_diff_line

webdiff/unified_diff.py:170–191  ·  view source on GitHub ↗
(parts: list[str])

Source from the content-addressed store, hash-verified

168
169
170def parse_raw_diff_line(parts: list[str]) -> RawDiffLine:
171 meta = parts[0]
172 path = parts[1]
173 dst_path = parts[2] if len(parts) > 2 else None
174
175 m = meta[1:].split(' ')
176 src_mode, dst_mode, src_sha, dst_sha, status = m
177 score = None
178 if len(status) > 1:
179 score = int(status[1:])
180 status = status[0]
181
182 return RawDiffLine(
183 src_mode=src_mode,
184 dst_mode=dst_mode,
185 src_sha=src_sha,
186 dst_sha=dst_sha,
187 status=status,
188 path=path,
189 score=score,
190 dst_path=dst_path,
191 )
192
193
194def parse_raw_diff(diff: str) -> List[RawDiffLine]:

Callers 1

parse_raw_diffFunction · 0.85

Calls 1

RawDiffLineClass · 0.85

Tested by

no test coverage detected