Minor styling
This commit is contained in:
@@ -2,7 +2,11 @@
|
|||||||
Remotes
|
Remotes
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
.. autoattribute:: pygit2.Repository.remotes
|
.. py:attribute:: Repository.remotes
|
||||||
|
|
||||||
|
The collection of configured remotes, an instance of
|
||||||
|
:py:class:`pygit2.remote.RemoteCollection`
|
||||||
|
|
||||||
.. automethod:: pygit2.Repository.create_remote
|
.. automethod:: pygit2.Repository.create_remote
|
||||||
|
|
||||||
The remote collection
|
The remote collection
|
||||||
|
@@ -48,7 +48,7 @@ from .config import Config
|
|||||||
from .errors import check_error
|
from .errors import check_error
|
||||||
from .ffi import ffi, C
|
from .ffi import ffi, C
|
||||||
from .index import Index
|
from .index import Index
|
||||||
from .remote import Remote, RemoteCollection
|
from .remote import RemoteCollection
|
||||||
from .blame import Blame
|
from .blame import Blame
|
||||||
from .utils import to_bytes, is_string
|
from .utils import to_bytes, is_string
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class Repository(_Repository):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Repository, self).__init__(*args, **kwargs)
|
super(Repository, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
self._remotes = RemoteCollection(self)
|
self.remotes = RemoteCollection(self)
|
||||||
|
|
||||||
# Get the pointer as the contents of a buffer and store it for
|
# Get the pointer as the contents of a buffer and store it for
|
||||||
# later access
|
# later access
|
||||||
@@ -98,12 +98,6 @@ class Repository(_Repository):
|
|||||||
|
|
||||||
return self.remotes.create(name, url)
|
return self.remotes.create(name, url)
|
||||||
|
|
||||||
@property
|
|
||||||
def remotes(self):
|
|
||||||
"""The collection of configured remotes"""
|
|
||||||
|
|
||||||
return self._remotes
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configuration
|
# Configuration
|
||||||
#
|
#
|
||||||
|
22
src/diff.c
22
src/diff.c
@@ -53,7 +53,7 @@ wrap_diff(git_diff *diff, Repository *repo)
|
|||||||
if (py_diff) {
|
if (py_diff) {
|
||||||
Py_INCREF(repo);
|
Py_INCREF(repo);
|
||||||
py_diff->repo = repo;
|
py_diff->repo = repo;
|
||||||
py_diff->list = diff;
|
py_diff->diff = diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (PyObject*) py_diff;
|
return (PyObject*) py_diff;
|
||||||
@@ -235,7 +235,7 @@ PyObject *
|
|||||||
DiffIter_iternext(DiffIter *self)
|
DiffIter_iternext(DiffIter *self)
|
||||||
{
|
{
|
||||||
if (self->i < self->n)
|
if (self->i < self->n)
|
||||||
return diff_get_patch_byindex(self->diff->list, self->i++);
|
return diff_get_patch_byindex(self->diff->diff, self->i++);
|
||||||
|
|
||||||
PyErr_SetNone(PyExc_StopIteration);
|
PyErr_SetNone(PyExc_StopIteration);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -284,8 +284,8 @@ PyTypeObject DiffIterType = {
|
|||||||
Py_ssize_t
|
Py_ssize_t
|
||||||
Diff_len(Diff *self)
|
Diff_len(Diff *self)
|
||||||
{
|
{
|
||||||
assert(self->list);
|
assert(self->diff);
|
||||||
return (Py_ssize_t)git_diff_num_deltas(self->list);
|
return (Py_ssize_t)git_diff_num_deltas(self->diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(Diff_patch__doc__, "Patch diff string.");
|
PyDoc_STRVAR(Diff_patch__doc__, "Patch diff string.");
|
||||||
@@ -299,12 +299,12 @@ Diff_patch__get__(Diff *self)
|
|||||||
size_t i, len, num;
|
size_t i, len, num;
|
||||||
PyObject *py_patch = NULL;
|
PyObject *py_patch = NULL;
|
||||||
|
|
||||||
num = git_diff_num_deltas(self->list);
|
num = git_diff_num_deltas(self->diff);
|
||||||
if (num == 0)
|
if (num == 0)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
for (i = 0, len = 1; i < num ; ++i) {
|
for (i = 0, len = 1; i < num ; ++i) {
|
||||||
err = git_patch_from_diff(&patch, self->list, i);
|
err = git_patch_from_diff(&patch, self->diff, i);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ Diff_merge(Diff *self, PyObject *args)
|
|||||||
if (py_diff->repo->repo != self->repo->repo)
|
if (py_diff->repo->repo != self->repo->repo)
|
||||||
return Error_set(GIT_ERROR);
|
return Error_set(GIT_ERROR);
|
||||||
|
|
||||||
err = git_diff_merge(self->list, py_diff->list);
|
err = git_diff_merge(self->diff, py_diff->diff);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return Error_set(err);
|
return Error_set(err);
|
||||||
|
|
||||||
@@ -455,7 +455,7 @@ Diff_find_similar(Diff *self, PyObject *args, PyObject *kwds)
|
|||||||
&opts.flags, &opts.rename_threshold, &opts.copy_threshold, &opts.rename_from_rewrite_threshold, &opts.break_rewrite_threshold, &opts.rename_limit))
|
&opts.flags, &opts.rename_threshold, &opts.copy_threshold, &opts.rename_from_rewrite_threshold, &opts.break_rewrite_threshold, &opts.rename_limit))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
err = git_diff_find_similar(self->list, &opts);
|
err = git_diff_find_similar(self->diff, &opts);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return Error_set(err);
|
return Error_set(err);
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ Diff_iter(Diff *self)
|
|||||||
Py_INCREF(self);
|
Py_INCREF(self);
|
||||||
iter->diff = self;
|
iter->diff = self;
|
||||||
iter->i = 0;
|
iter->i = 0;
|
||||||
iter->n = git_diff_num_deltas(self->list);
|
iter->n = git_diff_num_deltas(self->diff);
|
||||||
}
|
}
|
||||||
return (PyObject*)iter;
|
return (PyObject*)iter;
|
||||||
}
|
}
|
||||||
@@ -487,14 +487,14 @@ Diff_getitem(Diff *self, PyObject *value)
|
|||||||
|
|
||||||
i = PyLong_AsUnsignedLong(value);
|
i = PyLong_AsUnsignedLong(value);
|
||||||
|
|
||||||
return diff_get_patch_byindex(self->list, i);
|
return diff_get_patch_byindex(self->diff, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Diff_dealloc(Diff *self)
|
Diff_dealloc(Diff *self)
|
||||||
{
|
{
|
||||||
git_diff_free(self->list);
|
git_diff_free(self->diff);
|
||||||
Py_CLEAR(self->repo);
|
Py_CLEAR(self->repo);
|
||||||
PyObject_Del(self);
|
PyObject_Del(self);
|
||||||
}
|
}
|
||||||
|
@@ -91,7 +91,7 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
/* git_diff */
|
/* git_diff */
|
||||||
SIMPLE_TYPE(Diff, git_diff, list)
|
SIMPLE_TYPE(Diff, git_diff, diff)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PyObject_HEAD
|
PyObject_HEAD
|
||||||
|
Reference in New Issue
Block a user