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

Function Repository_walk

src/repository.c:816–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

814 " >>>\n");
815
816PyObject *
817Repository_walk(Repository *self, PyObject *args)
818{
819 PyObject *value;
820 unsigned int sort = GIT_SORT_NONE;
821 int err;
822 git_oid oid;
823 git_revwalk *walk;
824 Walker *py_walker;
825
826 if (!PyArg_ParseTuple(args, "O|I", &value, &sort))
827 return NULL;
828
829 err = git_revwalk_new(&walk, self->repo);
830 if (err < 0)
831 return Error_set(err);
832
833 /* Sort */
834 git_revwalk_sorting(walk, sort);
835
836 /* Push */
837 if (value != Py_None) {
838 err = py_oid_to_git_oid_expand(self->repo, value, &oid);
839 if (err < 0)
840 goto error;
841
842 err = git_revwalk_push(walk, &oid);
843 if (err < 0) {
844 Error_set(err);
845 goto error;
846 }
847 }
848
849 py_walker = PyObject_New(Walker, &WalkerType);
850 if (py_walker) {
851 Py_INCREF(self);
852 py_walker->repo = self;
853 py_walker->walk = walk;
854 return (PyObject*)py_walker;
855 }
856
857error:
858 git_revwalk_free(walk);
859 return NULL;
860}
861
862
863PyDoc_STRVAR(Repository_create_blob__doc__,

Callers

nothing calls this directly

Calls 2

Error_setFunction · 0.85
py_oid_to_git_oid_expandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…