(barerepo: Repository)
| 309 | |
| 310 | |
| 311 | def test_diff_merge(barerepo: Repository) -> None: |
| 312 | commit_a = barerepo[COMMIT_SHA1_1] |
| 313 | commit_b = barerepo[COMMIT_SHA1_2] |
| 314 | commit_c = barerepo[COMMIT_SHA1_3] |
| 315 | |
| 316 | diff_b = commit_a.tree.diff_to_tree(commit_b.tree) |
| 317 | assert diff_b is not None |
| 318 | |
| 319 | diff_c = commit_b.tree.diff_to_tree(commit_c.tree) |
| 320 | assert diff_c is not None |
| 321 | assert 'b' not in [patch.delta.new_file.path for patch in diff_safeiter(diff_b)] |
| 322 | assert 'b' in [patch.delta.new_file.path for patch in diff_safeiter(diff_c)] |
| 323 | |
| 324 | diff_b.merge(diff_c) |
| 325 | assert 'b' in [patch.delta.new_file.path for patch in diff_safeiter(diff_b)] |
| 326 | |
| 327 | patch = diff_b[0] |
| 328 | assert patch is not None |
| 329 | hunk = patch.hunks[0] |
| 330 | assert hunk.old_start == 1 |
| 331 | assert hunk.old_lines == 1 |
| 332 | assert hunk.new_start == 1 |
| 333 | assert hunk.new_lines == 1 |
| 334 | |
| 335 | assert patch.delta.old_file.path == 'a' |
| 336 | assert patch.delta.new_file.path == 'a' |
| 337 | |
| 338 | |
| 339 | def test_diff_patch(barerepo: Repository) -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…