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

Function DiffStats_format

src/diff.c:883–908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

881 " The width of the output. The output will be scaled to fit.");
882
883PyObject *
884DiffStats_format(DiffStats *self, PyObject *args, PyObject *kwds)
885{
886 int err, format;
887 git_buf buf = { 0 };
888 Py_ssize_t width;
889 PyObject *str;
890 char *keywords[] = {"format", "width", NULL};
891
892 if (!PyArg_ParseTupleAndKeywords(args, kwds, "in", keywords, &format, &width))
893 return NULL;
894
895 if (width <= 0) {
896 PyErr_SetString(PyExc_ValueError, "width must be positive");
897 return NULL;
898 }
899
900 err = git_diff_stats_to_buf(&buf, self->stats, format, width);
901 if (err < 0)
902 return Error_set(err);
903
904 str = to_unicode_n(buf.ptr, buf.size, NULL, NULL);
905 git_buf_dispose(&buf);
906
907 return str;
908}
909
910static void
911DiffStats_dealloc(DiffStats *self)

Callers

nothing calls this directly

Calls 2

Error_setFunction · 0.85
to_unicode_nFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…