Function
patch_diff
(testrepo: Repository, new_content: str)
Source from the content-addressed store, hash-verified
| 53 | |
| 54 | @pytest.fixture |
| 55 | def 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
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…