(
origin: Repository, clone: Repository, remote: Remote
)
| 556 | |
| 557 | |
| 558 | def test_push_negotiation( |
| 559 | origin: Repository, clone: Repository, remote: Remote |
| 560 | ) -> None: |
| 561 | old_tip = clone[clone.head.target] |
| 562 | new_tip_id = clone.create_commit( |
| 563 | 'refs/heads/master', |
| 564 | old_tip.author, |
| 565 | old_tip.author, |
| 566 | 'empty commit', |
| 567 | old_tip.tree.id, |
| 568 | [old_tip.id], |
| 569 | ) |
| 570 | |
| 571 | the_updates: list[PushUpdate] = [] |
| 572 | |
| 573 | class MyCallbacks(pygit2.RemoteCallbacks): |
| 574 | def push_negotiation(self, updates: list[PushUpdate]) -> None: |
| 575 | the_updates.extend(updates) |
| 576 | |
| 577 | assert origin.branches['master'].target == old_tip.id |
| 578 | assert 'new_branch' not in origin.branches |
| 579 | |
| 580 | callbacks = MyCallbacks() |
| 581 | remote.push(['refs/heads/master'], callbacks=callbacks) |
| 582 | |
| 583 | assert len(the_updates) == 1 |
| 584 | assert the_updates[0].src_refname == 'refs/heads/master' |
| 585 | assert the_updates[0].dst_refname == 'refs/heads/master' |
| 586 | assert the_updates[0].src == old_tip.id |
| 587 | assert the_updates[0].dst == new_tip_id |
| 588 | |
| 589 | assert origin.branches['master'].target == new_tip_id |
nothing calls this directly
no test coverage detected
searching dependent graphs…