diff --git a/README.rst b/README.rst index e2537cf..c706403 100644 --- a/README.rst +++ b/README.rst @@ -25,6 +25,52 @@ How to install Changelog ============== +0.23.2 (2015-1X-XX) +------------------------- + +- Unify callbacks system for remotes and clone + `#568 `_ + +- New ``TreeEntry._name`` + `#570 `_ + +- Fix segfault in ``Tag._message`` + `#572 `_ + +- Documentation improvements + `#569 `_ + `#574 `_ + +API changes to clone:: + + # Before + clone_repository(..., credentials, certificate) + + # Now + callbacks = RemoteCallbacks(credentials, certificate) + clone_repository(..., callbacks) + +API changes to remote:: + + # Before + def transfer_progress(stats): + ... + + remote.credentials = credentials + remote.transfer_progress = transfer_progress + remote.fetch() + remote.push(specs) + + # Now + class MyCallbacks(RemoteCallbacks): + def transfer_progress(self, stats): + ... + + callbacks = MyCallbacks(credentials) + remote.fetch(callbacks=callbacks) + remote.push(specs, callbacks=callbacks) + + 0.23.1 (2015-09-26) ------------------------- diff --git a/docs/install.rst b/docs/install.rst index f1e6e22..d428b08 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -16,9 +16,11 @@ Requirements - Python 2.7, 3.2+ or PyPy 2.6+ (including the development headers) - Libgit2 v0.23.x - cffi 1.0+ -- OpenSSL development headers, optional, used for HTTPS network operations. -- Libssh2, optional, used for SSH network operations. -- pkg-config, optional, used for SSH network operations. + +Optional libgit2 dependecies to support ssh and https: + +- https: WinHTTP (Windows), SecureTransport (OS X) or OpenSSL. +- ssh: libssh2, pkg-config It should work with older versions of cffi and PyPy, but using cffi 1.0+ (and PyPy 2.6+) is strongly encouraged. diff --git a/pygit2/remote.py b/pygit2/remote.py index 8cc9e35..49af59e 100644 --- a/pygit2/remote.py +++ b/pygit2/remote.py @@ -355,7 +355,7 @@ class Remote(object): err = C.git_remote_save(self._remote) check_error(err) - def fetch(self, refspecs=None, callbacks=None, message=None): + def fetch(self, refspecs=None, message=None, callbacks=None): """Perform a fetch against this remote. Returns a object. """ diff --git a/test/test_credentials.py b/test/test_credentials.py index 461fe5e..5fddfe2 100644 --- a/test/test_credentials.py +++ b/test/test_credentials.py @@ -71,32 +71,36 @@ class CredentialCreateTest(utils.NoRepoTestCase): class CredentialCallback(utils.RepoTestCase): def test_callback(self): class MyCallbacks(pygit2.RemoteCallbacks): + @staticmethod def credentials(url, username, allowed): self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT) raise Exception("I don't know the password") - remote = self.repo.create_remote("github", "https://github.com/github/github") + url = "https://github.com/github/github" + remote = self.repo.create_remote("github", url) self.assertRaises(Exception, lambda: remote.fetch(callbacks=MyCallbacks())) def test_bad_cred_type(self): class MyCallbacks(pygit2.RemoteCallbacks): + @staticmethod def credentials(url, username, allowed): self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT) return Keypair("git", "foo.pub", "foo", "sekkrit") - remote = self.repo.create_remote("github", "https://github.com/github/github") + url = "https://github.com/github/github" + remote = self.repo.create_remote("github", url) self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks())) class CallableCredentialTest(utils.RepoTestCase): def test_user_pass(self): - class MyCallbacks(pygit2.RemoteCallbacks): - def __init__(self): - self.credentials = UserPass("libgit2", "libgit2") + credentials = UserPass("libgit2", "libgit2") + callbacks = pygit2.RemoteCallbacks(credentials=credentials) - remote = self.repo.create_remote("bb", "https://bitbucket.org/libgit2/testgitrepository.git") - remote.fetch(callbacks=MyCallbacks()) + url = "https://bitbucket.org/libgit2/testgitrepository.git" + remote = self.repo.create_remote("bb", url) + remote.fetch(callbacks=callbacks) if __name__ == '__main__': unittest.main() diff --git a/test/test_remote.py b/test/test_remote.py index b39312a..cecabf0 100644 --- a/test/test_remote.py +++ b/test/test_remote.py @@ -212,7 +212,6 @@ class EmptyRepositoryTest(utils.EmptyRepoTestCase): self.assertEqual(stats.received_objects, REMOTE_REPO_OBJECTS) def test_transfer_progress(self): - self.tp = None class MyCallbacks(pygit2.RemoteCallbacks): def transfer_progress(self, stats): self.tp = stats