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

Function test_update_tips

test/test_remote.py:310–338  ·  view source on GitHub ↗
(emptyrepo: Repository)

Source from the content-addressed store, hash-verified

308
309
310def 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

Callers

nothing calls this directly

Calls 2

fetchMethod · 0.80
MyCallbacksClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…