Minor styling

This commit is contained in:
J. David Ibáñez
2014-11-12 10:18:21 +01:00
parent 93be1f1910
commit beff871923
6 changed files with 26 additions and 28 deletions

View File

@@ -2,7 +2,11 @@
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
The remote collection

View File

@@ -48,7 +48,7 @@ from .config import Config
from .errors import check_error
from .ffi import ffi, C
from .index import Index
from .remote import Remote, RemoteCollection
from .remote import RemoteCollection
from .blame import Blame
from .utils import to_bytes, is_string
@@ -58,7 +58,7 @@ class Repository(_Repository):
def __init__(self, *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
# later access
@@ -98,12 +98,6 @@ class Repository(_Repository):
return self.remotes.create(name, url)
@property
def remotes(self):
"""The collection of configured remotes"""
return self._remotes
#
# Configuration
#

View File

@@ -44,7 +44,7 @@ extern PyTypeObject RepositoryType;
PyTypeObject PatchType;
PyObject*
PyObject *
wrap_diff(git_diff *diff, Repository *repo)
{
Diff *py_diff;
@@ -53,7 +53,7 @@ wrap_diff(git_diff *diff, Repository *repo)
if (py_diff) {
Py_INCREF(repo);
py_diff->repo = repo;
py_diff->list = diff;
py_diff->diff = diff;
}
return (PyObject*) py_diff;
@@ -134,7 +134,7 @@ wrap_patch(git_patch *patch)
return (PyObject*) py_patch;
}
PyObject*
PyObject *
diff_get_patch_byindex(git_diff *diff, size_t idx)
{
git_patch *patch = NULL;
@@ -235,7 +235,7 @@ PyObject *
DiffIter_iternext(DiffIter *self)
{
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);
return NULL;
@@ -284,8 +284,8 @@ PyTypeObject DiffIterType = {
Py_ssize_t
Diff_len(Diff *self)
{
assert(self->list);
return (Py_ssize_t)git_diff_num_deltas(self->list);
assert(self->diff);
return (Py_ssize_t)git_diff_num_deltas(self->diff);
}
PyDoc_STRVAR(Diff_patch__doc__, "Patch diff string.");
@@ -299,12 +299,12 @@ Diff_patch__get__(Diff *self)
size_t i, len, num;
PyObject *py_patch = NULL;
num = git_diff_num_deltas(self->list);
num = git_diff_num_deltas(self->diff);
if (num == 0)
Py_RETURN_NONE;
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)
goto cleanup;
@@ -430,7 +430,7 @@ Diff_merge(Diff *self, PyObject *args)
if (py_diff->repo->repo != self->repo->repo)
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)
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))
return NULL;
err = git_diff_find_similar(self->list, &opts);
err = git_diff_find_similar(self->diff, &opts);
if (err < 0)
return Error_set(err);
@@ -472,7 +472,7 @@ Diff_iter(Diff *self)
Py_INCREF(self);
iter->diff = self;
iter->i = 0;
iter->n = git_diff_num_deltas(self->list);
iter->n = git_diff_num_deltas(self->diff);
}
return (PyObject*)iter;
}
@@ -487,14 +487,14 @@ Diff_getitem(Diff *self, PyObject *value)
i = PyLong_AsUnsignedLong(value);
return diff_get_patch_byindex(self->list, i);
return diff_get_patch_byindex(self->diff, i);
}
static void
Diff_dealloc(Diff *self)
{
git_diff_free(self->list);
git_diff_free(self->diff);
Py_CLEAR(self->repo);
PyObject_Del(self);
}

View File

@@ -39,7 +39,7 @@ extern PyTypeObject SignatureType;
PyDoc_STRVAR(Note_remove__doc__,
"Removes a note for an annotated object");
PyObject*
PyObject *
Note_remove(Note *self, PyObject* args)
{
char *ref = "refs/notes/commits";
@@ -208,7 +208,7 @@ PyTypeObject NoteIterType = {
};
PyObject*
PyObject *
wrap_note(Repository* repo, git_oid* annotated_id, const char* ref)
{
Note* py_note = NULL;

View File

@@ -149,7 +149,7 @@ PyMethodDef module_methods[] = {
{NULL}
};
PyObject*
PyObject *
moduleinit(PyObject* m)
{
if (m == NULL)

View File

@@ -90,12 +90,12 @@ typedef struct {
} NoteIter;
/* git _diff */
SIMPLE_TYPE(Diff, git_diff, list)
/* git_diff */
SIMPLE_TYPE(Diff, git_diff, diff)
typedef struct {
PyObject_HEAD
Diff* diff;
Diff *diff;
size_t i;
size_t n;
} DiffIter;