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

Function patch_diff

test/test_apply_diff.py:55–67  ·  view source on GitHub ↗
(testrepo: Repository, new_content: str)

Source from the content-addressed store, hash-verified

53
54@pytest.fixture
55def patch_diff(testrepo: Repository, new_content: str) -> Diff:
56 # Create the patch
57 with (Path(testrepo.workdir) / 'hello.txt').open('wb') as f:
58 f.write(new_content.encode('utf-8'))
59
60 patch = testrepo.diff().patch
61 assert patch is not None
62
63 # Rollback all changes
64 testrepo.checkout('HEAD', strategy=CheckoutStrategy.FORCE)
65
66 # Return the diff
67 return pygit2.Diff.parse_diff(patch)
68
69
70@pytest.fixture

Callers

nothing calls this directly

Calls 4

openMethod · 0.80
diffMethod · 0.80
checkoutMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…