Rev 958: Add latest_revnum test. in file:///data/jelmer/bzr-svn/pyrex/

Jelmer Vernooij jelmer at samba.org
Thu Mar 13 15:21:10 GMT 2008


At file:///data/jelmer/bzr-svn/pyrex/

------------------------------------------------------------
revno: 958
revision-id:jelmer at samba.org-20080313152109-yqh2owipkxr8zd84
parent: jelmer at samba.org-20080313151315-h299qawxzu1fiv4n
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: pyrex
timestamp: Thu 2008-03-13 16:21:09 +0100
message:
  Add latest_revnum test.
modified:
  ra.pyx                         ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
  tests/test_ra.py               test_ra.py-20080313141743-uzsm7ejitrlqone5-1
=== modified file 'ra.pyx'
--- a/ra.pyx	2008-03-13 15:13:15 +0000
+++ b/ra.pyx	2008-03-13 15:21:09 +0000
@@ -27,6 +27,11 @@
 cdef extern from "apr_errno.h":
     ctypedef int apr_status_t
 
+cdef extern from "apr_general.h":
+    apr_status_t apr_initialize()
+
+apr_initialize()
+
 cdef extern from "apr_pools.h":
     ctypedef struct apr_pool_t
     void apr_pool_destroy(apr_pool_t *)
@@ -94,8 +99,6 @@
                                       long *latest_revnum,
                                       apr_pool_t *pool)
 
-
-
 def version():
     """Get libsvn_ra version information.
 
@@ -112,7 +115,8 @@
 cdef class RemoteAccess:
     cdef svn_ra_session_t *ra
     cdef apr_pool_t *pool
-    def __init__(self, url, callbacks, config={}):
+    cdef char *url
+    def __init__(self, url, callbacks=object(), config={}):
         """Connect to a remote Subversion repository. 
 
         :param url: URL of the repository
@@ -122,6 +126,7 @@
         cdef svn_error_t *error
         cdef svn_ra_callbacks2_t *callbacks2
         cdef apr_hash_t *config_hash
+        self.url = url
         self.pool = Pool(NULL)
         assert self.pool != NULL
         _check_error(svn_ra_create_callbacks(&callbacks2, self.pool))
@@ -146,3 +151,6 @@
     def __dealloc__(self):
         if self.pool != NULL:
             apr_pool_destroy(self.pool)
+
+    def __repr__(self):
+        return "%s(%r)" % (self.__class__.__name__, self.url)

=== modified file 'tests/test_ra.py'
--- a/tests/test_ra.py	2008-03-13 14:17:54 +0000
+++ b/tests/test_ra.py	2008-03-13 15:21:09 +0000
@@ -17,8 +17,17 @@
 
 from bzrlib.tests import TestCase
 import ra
+from tests import TestCaseWithSubversionRepository
 
 class VersionTest(TestCase):
     def test_version_length(self):
         self.assertEquals(4, len(ra.version()))
 
+class TestRemoteAccess(TestCaseWithSubversionRepository):
+    def setUp(self):
+        super(TestRemoteAccess, self).setUp()
+        repos_url = self.make_client("d", "dc")
+        self.ra = ra.RemoteAccess(repos_url)
+
+    def test_latest_revnum(self):
+        self.assertEquals(0, self.ra.get_latest_revnum())




More information about the bazaar-commits mailing list