Rev 1311: Add trivial cache for repos root. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4
Jelmer Vernooij
jelmer at samba.org
Mon Jun 23 05:47:57 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.4
------------------------------------------------------------
revno: 1311
revision-id: jelmer at samba.org-20080623044756-8vv3t8vuz63cjkx3
parent: jelmer at samba.org-20080623035902-7p0sxm1myp2v9p7d
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 06:47:56 +0200
message:
Add trivial cache for repos root.
modified:
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
=== modified file 'ra.c'
--- a/ra.c 2008-06-22 22:44:31 +0000
+++ b/ra.c 2008-06-23 04:47:56 +0000
@@ -470,6 +470,7 @@
bool busy;
PyObject *client_string_func;
PyObject *open_tmp_file_func;
+ char *root;
} RemoteAccessObject;
static void ra_done_handler(void *_ra)
@@ -617,6 +618,7 @@
auth_baton = ret->auth->auth_baton;
}
+ ret->root = NULL;
ret->pool = Pool(NULL);
if (ret->pool == NULL)
return NULL;
@@ -818,17 +820,21 @@
RemoteAccessObject *ra = (RemoteAccessObject *)self;
const char *root;
apr_pool_t *temp_pool;
-
- if (ra_check_busy(ra))
- return NULL;
-
- temp_pool = Pool(NULL);
- if (temp_pool == NULL)
- return NULL;
- RUN_RA_WITH_POOL(temp_pool, ra,
- svn_ra_get_repos_root(ra->ra, &root, temp_pool));
- apr_pool_destroy(temp_pool);
- return PyString_FromString(root);
+
+ if (ra->root == NULL) {
+ if (ra_check_busy(ra))
+ return NULL;
+
+ temp_pool = Pool(NULL);
+ if (temp_pool == NULL)
+ return NULL;
+ RUN_RA_WITH_POOL(temp_pool, ra,
+ svn_ra_get_repos_root(ra->ra, &root, temp_pool));
+ ra->root = apr_pstrdup(ra->pool, root);
+ apr_pool_destroy(temp_pool);
+ }
+
+ return PyString_FromString(ra->root);
}
static PyObject *ra_do_update(PyObject *self, PyObject *args)
More information about the bazaar-commits
mailing list