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

Function Odb_backends__get__

src/odb.c:361–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359 "Return an iterable of backends for this object database.");
360
361PyObject *
362Odb_backends__get__(Odb *self)
363{
364 int err;
365 git_odb_backend *backend;
366 PyObject *ret = NULL;
367 PyObject *py_backend;
368
369 PyObject *accum = PyList_New(0);
370 if (accum == NULL)
371 return NULL;
372
373 size_t nbackends = git_odb_num_backends(self->odb);
374 for (size_t i = 0; i < nbackends; ++i) {
375 err = git_odb_get_backend(&backend, self->odb, i);
376 if (err != 0) {
377 ret = Error_set(err);
378 goto exit;
379 }
380
381 // XXX This won't return the correct class for custom backends (add a
382 // test and fix)
383 py_backend = wrap_odb_backend(backend);
384 if (py_backend == NULL)
385 goto exit;
386
387 err = PyList_Append(accum, py_backend);
388 if (err != 0)
389 goto exit;
390 }
391
392 ret = PyObject_GetIter(accum);
393
394exit:
395 Py_DECREF(accum);
396 return ret;
397}
398
399
400PyGetSetDef Odb_getseters[] = {

Callers

nothing calls this directly

Calls 2

Error_setFunction · 0.85
wrap_odb_backendFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…