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

Function test_find_similar

test/test_diff.py:378–393  ·  view source on GitHub ↗
(barerepo: Repository)

Source from the content-addressed store, hash-verified

376
377
378def test_find_similar(barerepo: Repository) -> None:
379 commit_a = barerepo[COMMIT_SHA1_6]
380 commit_b = barerepo[COMMIT_SHA1_7]
381
382 # ~ Must pass INCLUDE_UNMODIFIED if you expect to emulate
383 # ~ --find-copies-harder during rename transformion...
384 diff = commit_a.tree.diff_to_tree(commit_b.tree, DiffOption.INCLUDE_UNMODIFIED)
385 assert all(
386 patch.delta.status != DeltaStatus.RENAMED for patch in diff_safeiter(diff)
387 )
388 assert all(patch.delta.status_char() != 'R' for patch in diff_safeiter(diff))
389 diff.find_similar()
390 assert any(
391 patch.delta.status == DeltaStatus.RENAMED for patch in diff_safeiter(diff)
392 )
393 assert any(patch.delta.status_char() == 'R' for patch in diff_safeiter(diff))
394
395
396def test_diff_stats(barerepo: Repository) -> None:

Callers

nothing calls this directly

Calls 2

diff_safeiterFunction · 0.85
diff_to_treeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…