| 391 | } |
| 392 | |
| 393 | int |
| 394 | RefdbBackend_init(RefdbBackend *self, PyObject *args, PyObject *kwds) |
| 395 | { |
| 396 | if (args && PyTuple_Size(args) > 0) { |
| 397 | PyErr_SetString(PyExc_TypeError, "RefdbBackend takes no arguments"); |
| 398 | return -1; |
| 399 | } |
| 400 | |
| 401 | if (kwds && PyDict_Size(kwds) > 0) { |
| 402 | PyErr_SetString(PyExc_TypeError, "RefdbBackend takes no keyword arguments"); |
| 403 | return -1; |
| 404 | } |
| 405 | |
| 406 | struct pygit2_refdb_backend *be = calloc(1, sizeof(struct pygit2_refdb_backend)); |
| 407 | if (be == NULL) { |
| 408 | PyErr_NoMemory(); |
| 409 | return -1; |
| 410 | } |
| 411 | git_refdb_init_backend(&be->backend, GIT_REFDB_BACKEND_VERSION); |
| 412 | be->RefdbBackend = (PyObject *)self; |
| 413 | |
| 414 | if (PyIter_Check((PyObject *)self)) { |
| 415 | be->backend.iterator = pygit2_refdb_backend_iterator; |
| 416 | } |
| 417 | |
| 418 | if (PyObject_HasAttrString((PyObject *)self, "exists")) { |
| 419 | be->exists = PyObject_GetAttrString((PyObject *)self, "exists"); |
| 420 | be->backend.exists = pygit2_refdb_backend_exists; |
| 421 | } |
| 422 | |
| 423 | if (PyObject_HasAttrString((PyObject *)self, "lookup")) { |
| 424 | be->lookup = PyObject_GetAttrString((PyObject *)self, "lookup"); |
| 425 | be->backend.lookup = pygit2_refdb_backend_lookup; |
| 426 | } |
| 427 | |
| 428 | if (PyObject_HasAttrString((PyObject *)self, "write")) { |
| 429 | be->write = PyObject_GetAttrString((PyObject *)self, "write"); |
| 430 | be->backend.write = pygit2_refdb_backend_write; |
| 431 | } |
| 432 | |
| 433 | if (PyObject_HasAttrString((PyObject *)self, "rename")) { |
| 434 | be->rename = PyObject_GetAttrString((PyObject *)self, "rename"); |
| 435 | be->backend.rename = pygit2_refdb_backend_rename; |
| 436 | } |
| 437 | |
| 438 | if (PyObject_HasAttrString((PyObject *)self, "delete")) { |
| 439 | be->delete = PyObject_GetAttrString((PyObject *)self, "delete"); |
| 440 | be->backend.del = pygit2_refdb_backend_del; |
| 441 | } |
| 442 | |
| 443 | if (PyObject_HasAttrString((PyObject *)self, "compress")) { |
| 444 | be->compress = PyObject_GetAttrString((PyObject *)self, "compress"); |
| 445 | be->backend.compress = pygit2_refdb_backend_compress; |
| 446 | } |
| 447 | |
| 448 | if (PyObject_HasAttrString((PyObject *)self, "has_log")) { |
| 449 | be->has_log = PyObject_GetAttrString((PyObject *)self, "has_log"); |
| 450 | be->backend.has_log = pygit2_refdb_backend_has_log; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…