(emptyrepo: Repository)
| 308 | |
| 309 | |
| 310 | def test_update_tips(emptyrepo: Repository) -> None: |
| 311 | remote = emptyrepo.remotes[0] |
| 312 | tips = [ |
| 313 | ( |
| 314 | 'refs/remotes/origin/master', |
| 315 | pygit2.Oid(hex='0' * 40), |
| 316 | pygit2.Oid(hex='784855caf26449a1914d2cf62d12b9374d76ae78'), |
| 317 | ), |
| 318 | ( |
| 319 | 'refs/tags/root', |
| 320 | pygit2.Oid(hex='0' * 40), |
| 321 | pygit2.Oid(hex='3d2962987c695a29f1f80b6c3aa4ec046ef44369'), |
| 322 | ), |
| 323 | ] |
| 324 | |
| 325 | class MyCallbacks(pygit2.RemoteCallbacks): |
| 326 | tips: list[tuple[str, pygit2.Oid, pygit2.Oid]] |
| 327 | |
| 328 | def __init__(self, tips: list[tuple[str, pygit2.Oid, pygit2.Oid]]) -> None: |
| 329 | self.tips = tips |
| 330 | self.i = 0 |
| 331 | |
| 332 | def update_tips(self, name: str, old: pygit2.Oid, new: pygit2.Oid) -> None: |
| 333 | assert self.tips[self.i] == (name, old, new) |
| 334 | self.i += 1 |
| 335 | |
| 336 | callbacks = MyCallbacks(tips) |
| 337 | remote.fetch(callbacks=callbacks) |
| 338 | assert callbacks.i > 0 |
| 339 | |
| 340 | |
| 341 | @utils.requires_network |
nothing calls this directly
no test coverage detected
searching dependent graphs…