Preparing for release

This commit is contained in:
J. David Ibáñez
2014-02-02 14:05:43 +01:00
parent b9bf1175e2
commit 977c315c21
8 changed files with 90 additions and 121 deletions

View File

@@ -79,6 +79,43 @@ Authors
Changelog
==============
0.20.2 (2014-02-XX)
-------------------
- New ``Blob.diff(...)`` and ``Blob.diff_to_buffer(...)``
`#307 <https://github.com/libgit2/pygit2/pull/307>`_
- New ``Repository.default_signature``
`#310 <https://github.com/libgit2/pygit2/pull/310>`_
- New ``Commit.tree_id`` and ``Commit.parent_ids``
`#730 <https://github.com/libgit2/pygit2/issues/73>`_
- New rich comparison between tree entries
- New ``Config`` iterator replaces ``Config.foreach``
- New type ``Refspec``
- New ``Remote.push_url``
- New ``Remote.add_push`` and ``Remote.add_fetch``
- New ``Remote.fetch_refspecs`` replaces ``Remote.get_fetch_refspecs()`` and
``Remote.set_fetch_refspecs(...)``
- New ``Remote.push_refspecs`` replaces ``Remote.get_push_refspecs()`` and
``Remote.set_push_refspecs(...)``
- Now *path* in ``Tree`` works
- New ``str(Oid)`` deprecates ``Oid.hex``
- New ``Object.id`` deprecates ``Object.oid``
- New ``TreeEntry.id`` deprecates ``TreeEntry.oid``
- New ``Remote.progress``, ``Remote.transfer_progress`` and
``Remote.update_tips``
- New type ``TransferProgress``
- Now possible to create ``IndexEntry(...)``
- Now ``IndexEntry.path``, ``IndexEntry.oid`` and ``IndexEntry.mode`` are
writable
- Now ``Index.add(...)`` accepts an ``IndexEntry`` too
- Now ``Index.write_tree(...)`` is able to write to a different repository
- Support pypy
0.20.1 (2013-12-24)
-------------------
@@ -117,18 +154,10 @@ Changelog
- Upgrade to libgit2 v0.20.0:
`#288 <https://github.com/libgit2/pygit2/pull/288>`_
Rename ``Repository.head_is_orphaned`` to ``Repository.head_is_unborn``
- New ``Repository.head_is_unborn`` replaces ``Repository.head_is_orphaned``
Prototype of ``pygit2.clone_repository(...)`` changed::
# Before
pygit2.clone_repository(url, path, bare=False, remote_name='origin',
push_url=None, fetch_spec=None, push_spec=None,
checkout_branch=None)
# Now
pygit2.clone_repository(url, path, bare=False, ignore_cert_errors=False,
remote_name='origin', checkout_branch=None)
- Changed ``pygit2.clone_repository(...)``. Drop ``push_url``, ``fetch_spec``
and ``push_spec`` parameters. Add ``ignore_cert_errors``.
- New ``Patch.additions`` and ``Patch.deletions``:
`#275 <https://github.com/libgit2/pygit2/pull/275>`_

View File

@@ -14,13 +14,12 @@ The Config type
.. automethod:: pygit2.Config.get_multivar
.. automethod:: pygit2.Config.set_multivar
.. method:: for (name, value) in Config
The :class:`Config` class has an iterator which can be used to loop
through all the entries in the configuration. Each element is a tuple
containing the name and the value of each configuration variable. Be
aware that this may return multiple versions of each entry if they are
set multiple times in the configuration files.
The :class:`Config` Mapping interface.
Iterator
=========
The :class:`Config` class has an iterator which can be used to loop
through all the entries in the configuration. Each element is a tuple
containing the name and the value of each configuration variable. Be
aware that this may return multiple versions of each entry if they are
set multiple times in the configuration files.

View File

@@ -79,8 +79,6 @@ New objects are created using an specific API we will see later.
This is the common interface for all Git objects:
.. autoattribute:: pygit2.Object.id
.. autoattribute:: pygit2.Object.oid
.. autoattribute:: pygit2.Object.hex
.. autoattribute:: pygit2.Object.type
.. automethod:: pygit2.Object.read_raw
@@ -112,6 +110,9 @@ This is their API:
.. autoattribute:: pygit2.Blob.is_binary
.. automethod:: pygit2.Blob.diff
.. automethod:: pygit2.Blob.diff_to_buffer
Creating blobs
--------------
@@ -172,11 +173,12 @@ Tree entries
.. autoattribute:: pygit2.TreeEntry.name
.. autoattribute:: pygit2.TreeEntry.id
.. autoattribute:: pygit2.TreeEntry.oid
.. autoattribute:: pygit2.TreeEntry.hex
.. autoattribute:: pygit2.TreeEntry.filemode
:class:`TreeEntry` supports comparison against other tree entries.
.. method:: cmp(TreeEntry, TreeEntry)
Rich comparison between tree entries.
Example::

View File

@@ -65,7 +65,7 @@ And the other way around, from an Oid object we can get the hexadecimal and raw
forms. You can use the built-in `str()` (or `unicode()` in python 2) to get the
hexadecimal representation of the Oid.
.. autoattribute:: pygit2.Oid.hex
.. automethod:: str(pygit2.Oid)
.. autoattribute:: pygit2.Oid.raw
The Oid type supports:

View File

@@ -19,14 +19,12 @@ The Remote type
.. autoattribute:: pygit2.Remote.progress
.. autoattribute:: pygit2.Remote.transfer_progress
.. autoattribute:: pygit2.Remote.update_tips
.. automethod:: pygit2.Remote.get_push_refspecs
.. automethod:: pygit2.Remote.get_fetch_refspecs
.. automethod:: pygit2.Remote.set_push_refspecs
.. automethod:: pygit2.Remote.set_fetch_refspecs
.. automethod:: pygit2.Remote.get_refspec
.. automethod:: pygit2.Remote.fetch
.. automethod:: pygit2.Remote.push
.. automethod:: pygit2.Remote.save
.. automethod:: pygit2.Remote.add_push
.. automethod:: pygit2.Remote.add_fetch
The TransferProgress type
===========================

View File

@@ -43,9 +43,9 @@ extern PyTypeObject TransferProgressType;
Refspec *
wrap_refspec(const Remote *owner, const git_refspec *refspec)
{
Refspec *spec;
Refspec *spec;
spec = PyObject_New(Refspec, &RefspecType);
spec = PyObject_New(Refspec, &RefspecType);
if (!spec)
return NULL;
@@ -258,7 +258,7 @@ PyDoc_STRVAR(Refspec__doc__, "Refspec object.");
PyTypeObject RefspecType = {
PyVarObject_HEAD_INIT(NULL, 0)
"_pygit2.Refspec", /* tp_name */
sizeof(Refspec), /* tp_basicsize */
sizeof(Refspec), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)Refspec_dealloc, /* tp_dealloc */
0, /* tp_print */
@@ -331,7 +331,7 @@ PyMemberDef TransferProgress_members[] = {
RMEMBER(TransferProgress, indexed_deltas, T_UINT, "Deltas which have been indexed"),
/* FIXME: technically this is unsigned, but there's no value for size_t here. */
RMEMBER(TransferProgress, received_bytes, T_PYSSIZET, "Number of bytes received up to now"),
{NULL},
{NULL},
};
PyDoc_STRVAR(TransferProgress__doc__, "Progress downloading and indexing data during a fetch");
@@ -639,59 +639,6 @@ Remote_push_refspecs__set__(Remote *self, PyObject *py_list)
return 0;
}
PyDoc_STRVAR(Remote_get_fetch_refspecs__doc__,
"Fetch refspecs.\n"
"This function is deprecated, please use the fetch_refspecs attribute"
"\n");
PyObject *
Remote_get_fetch_refspecs(Remote *self)
{
return Remote_fetch_refspecs__get__(self);
}
PyDoc_STRVAR(Remote_get_push_refspecs__doc__, "Push refspecs");
PyObject *
Remote_get_push_refspecs(Remote *self)
{
return Remote_push_refspecs__get__(self);
}
PyDoc_STRVAR(Remote_set_fetch_refspecs__doc__,
"set_fetch_refspecs([str])\n"
"This function is deprecated, please use the push_refspecs attribute"
"\n");
PyObject *
Remote_set_fetch_refspecs(Remote *self, PyObject *args)
{
if (Remote_fetch_refspecs__set__(self, args) < 0)
return NULL;
Py_RETURN_NONE;
}
PyDoc_STRVAR(Remote_set_push_refspecs__doc__,
"set_push_refspecs([str])\n"
"This function is deprecated, please use the push_refspecs attribute"
"\n");
PyObject *
Remote_set_push_refspecs(Remote *self, PyObject *args)
{
if (Remote_push_refspecs__set__(self, args) < 0)
return NULL;
Py_RETURN_NONE;
}
PyDoc_STRVAR(Remote_url__doc__, "Url of the remote");
@@ -699,7 +646,7 @@ PyDoc_STRVAR(Remote_url__doc__, "Url of the remote");
PyObject *
Remote_url__get__(Remote *self)
{
const char *url;
const char *url;
url = git_remote_url(self->remote);
if (!url)
@@ -735,7 +682,7 @@ PyDoc_STRVAR(Remote_push_url__doc__, "Push url of the remote");
PyObject *
Remote_push_url__get__(Remote *self)
{
const char *url;
const char *url;
url = git_remote_pushurl(self->remote);
if (!url)
@@ -976,10 +923,6 @@ PyMethodDef Remote_methods[] = {
METHOD(Remote, push, METH_VARARGS),
METHOD(Remote, add_push, METH_VARARGS),
METHOD(Remote, add_fetch, METH_VARARGS),
METHOD(Remote, get_fetch_refspecs, METH_NOARGS),
METHOD(Remote, set_fetch_refspecs, METH_O),
METHOD(Remote, get_push_refspecs, METH_NOARGS),
METHOD(Remote, set_push_refspecs, METH_O),
{NULL}
};

View File

@@ -201,9 +201,11 @@ Tree_len(Tree *self)
int
Tree_contains(Tree *self, PyObject *py_name)
{
int err;
int err;
git_tree_entry *entry;
char *name = py_path_to_c_str(py_name);
char *name;
name = py_path_to_c_str(py_name);
if (name == NULL)
return -1;

View File

@@ -92,53 +92,49 @@ class RepositoryTest(utils.RepoTestCase):
self.assertEqual(True, refspec.force)
self.assertEqual(ORIGIN_REFSPEC, refspec.string)
self.assertEqual(list, type(remote.get_fetch_refspecs()))
self.assertEqual(1, len(remote.get_fetch_refspecs()))
self.assertEqual(ORIGIN_REFSPEC, remote.get_fetch_refspecs()[0])
self.assertEqual(list, type(remote.fetch_refspecs))
self.assertEqual(1, len(remote.fetch_refspecs))
self.assertEqual(ORIGIN_REFSPEC, remote.fetch_refspecs[0])
self.assertTrue(refspec.src_matches('refs/heads/master'))
self.assertTrue(refspec.dst_matches('refs/remotes/origin/master'))
self.assertEqual('refs/remotes/origin/master', refspec.transform('refs/heads/master'))
self.assertEqual('refs/heads/master', refspec.rtransform('refs/remotes/origin/master'))
self.assertEqual(list, type(remote.get_push_refspecs()))
self.assertEqual(0, len(remote.get_push_refspecs()))
self.assertEqual(list, type(remote.push_refspecs))
self.assertEqual(0, len(remote.push_refspecs))
push_specs = remote.push_refspecs
self.assertEqual(list, type(push_specs))
self.assertEqual(0, len(push_specs))
remote.set_fetch_refspecs(['+refs/*:refs/remotes/*'])
self.assertEqual('+refs/*:refs/remotes/*',
remote.get_fetch_refspecs()[0])
remote.fetch_refspecs = ['+refs/*:refs/remotes/*']
self.assertEqual('+refs/*:refs/remotes/*', remote.fetch_refspecs[0])
fetch_specs = remote.fetch_refspecs
self.assertEqual(list, type(fetch_specs))
self.assertEqual(1, len(fetch_specs))
self.assertEqual('+refs/*:refs/remotes/*', fetch_specs[0])
remote.set_fetch_refspecs([
'+refs/*:refs/remotes/*',
'+refs/test/*:refs/test/remotes/*'
])
self.assertEqual('+refs/*:refs/remotes/*',
remote.get_fetch_refspecs()[0])
remote.fetch_refspecs = ['+refs/*:refs/remotes/*',
'+refs/test/*:refs/test/remotes/*']
self.assertEqual('+refs/*:refs/remotes/*', remote.fetch_refspecs[0])
self.assertEqual('+refs/test/*:refs/test/remotes/*',
remote.get_fetch_refspecs()[1])
remote.fetch_refspecs[1])
remote.set_push_refspecs([
'+refs/*:refs/remotes/*',
'+refs/test/*:refs/test/remotes/*'
])
remote.push_refspecs = ['+refs/*:refs/remotes/*',
'+refs/test/*:refs/test/remotes/*']
self.assertRaises(TypeError, setattr, remote, 'push_refspecs', '+refs/*:refs/*')
self.assertRaises(TypeError, setattr, remote, 'fetch_refspecs', '+refs/*:refs/*')
self.assertRaises(TypeError, setattr, remote, 'fetch_refspecs', ['+refs/*:refs/*', 5])
self.assertRaises(TypeError, setattr, remote, 'push_refspecs',
'+refs/*:refs/*')
self.assertRaises(TypeError, setattr, remote, 'fetch_refspecs',
'+refs/*:refs/*')
self.assertRaises(TypeError, setattr, remote, 'fetch_refspecs',
['+refs/*:refs/*', 5])
self.assertEqual('+refs/*:refs/remotes/*',
remote.get_push_refspecs()[0])
self.assertEqual('+refs/*:refs/remotes/*', remote.push_refspecs[0])
self.assertEqual('+refs/test/*:refs/test/remotes/*',
remote.get_push_refspecs()[1])
remote.push_refspecs[1])
def test_remote_list(self):
@@ -169,10 +165,10 @@ class RepositoryTest(utils.RepoTestCase):
remote = self.repo.create_remote('test_add_refspec', REMOTE_URL)
remote.add_push('refs/heads/*:refs/heads/test_refspec/*')
self.assertEqual('refs/heads/*:refs/heads/test_refspec/*',
remote.get_push_refspecs()[0])
remote.push_refspecs[0])
remote.add_fetch('+refs/heads/*:refs/remotes/test_refspec/*')
self.assertEqual('+refs/heads/*:refs/remotes/test_refspec/*',
remote.get_fetch_refspecs()[1])
remote.fetch_refspecs[1])
def test_remote_callback_typecheck(self):
remote = self.repo.remotes[0]