MCPcopy Create free account
hub / github.com/libgit2/pygit2 / get_context_for_lines

Function get_context_for_lines

test/test_diff.py:273–276  ·  view source on GitHub ↗
(diff: Diff)

Source from the content-addressed store, hash-verified

271 diff = commit_a.tree.diff_to_tree()
272
273 def get_context_for_lines(diff: Diff) -> Iterator[str]:
274 hunks = chain.from_iterable(map(lambda x: x.hunks, diff_safeiter(diff)))
275 lines = chain.from_iterable(map(lambda x: x.lines, hunks))
276 return map(lambda x: x.origin, lines)
277
278 entries = [p.delta.new_file.path for p in diff_safeiter(diff)]
279 assert all(commit_a.tree[x] for x in entries)

Callers 1

test_diff_empty_treeFunction · 0.85

Calls 1

diff_safeiterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…