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

Method list_heads

pygit2/remotes.py:249–282  ·  view source on GitHub ↗

Get the list of references with which the server responds to a new connection. Parameters: callbacks : Passed to connect() proxy : Passed to connect() connect : Whether to connect to the remote first. You can pass False if the remote has a

(
        self,
        callbacks: RemoteCallbacks | None = None,
        proxy: str | None | bool = None,
        connect: bool = True,
    )

Source from the content-addressed store, hash-verified

247 return TransferProgress(C.git_remote_stats(self._remote))
248
249 def list_heads(
250 self,
251 callbacks: RemoteCallbacks | None = None,
252 proxy: str | None | bool = None,
253 connect: bool = True,
254 ) -> list[RemoteHead]:
255 """
256 Get the list of references with which the server responds to a new
257 connection.
258
259 Parameters:
260
261 callbacks : Passed to connect()
262
263 proxy : Passed to connect()
264
265 connect : Whether to connect to the remote first. You can pass False
266 if the remote has already connected. The list remains available after
267 disconnecting as long as a new connection is not initiated.
268 """
269
270 if connect:
271 self.connect(callbacks=callbacks, proxy=proxy)
272
273 refs_ptr = ffi.new('git_remote_head ***')
274 size_ptr = ffi.new('size_t *')
275
276 err = C.git_remote_ls(refs_ptr, size_ptr, self._remote)
277 check_error(err)
278
279 num_refs = int(size_ptr[0])
280 results = [RemoteHead(refs_ptr[0][i]) for i in range(num_refs)]
281
282 return results
283
284 def ls_remotes(
285 self,

Callers 5

ls_remotesMethod · 0.95
test_list_headsFunction · 0.80

Calls 3

connectMethod · 0.95
check_errorFunction · 0.85
RemoteHeadClass · 0.85