Skip to content

Commit

Permalink
Minor styling
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavid committed Nov 12, 2014
1 parent 93be1f1 commit beff871
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 28 deletions.
6 changes: 5 additions & 1 deletion docs/remotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions pygit2/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
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

Expand All @@ -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
Expand Down Expand Up @@ -98,12 +98,6 @@ def create_remote(self, name, url):

return self.remotes.create(name, url)

@property
def remotes(self):
"""The collection of configured remotes"""

return self._remotes

#
# Configuration
#
Expand Down
26 changes: 13 additions & 13 deletions src/diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern PyTypeObject RepositoryType;

PyTypeObject PatchType;

PyObject*
PyObject *
wrap_diff(git_diff *diff, Repository *repo)
{
Diff *py_diff;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.");
Expand All @@ -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;

Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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;
}
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/note.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -208,7 +208,7 @@ PyTypeObject NoteIterType = {
};


PyObject*
PyObject *
wrap_note(Repository* repo, git_oid* annotated_id, const char* ref)
{
Note* py_note = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/pygit2.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ PyMethodDef module_methods[] = {
{NULL}
};

PyObject*
PyObject *
moduleinit(PyObject* m)
{
if (m == NULL)
Expand Down
6 changes: 3 additions & 3 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit beff871

Please sign in to comment.