Rev 1674: Canonicalize more paths. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk
Jelmer Vernooij
jelmer at samba.org
Wed Aug 27 19:14:51 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/trunk
------------------------------------------------------------
revno: 1674
revision-id: jelmer at samba.org-20080827181449-bbyk5l7lo6gb35j3
parent: jelmer at samba.org-20080827173912-nn377l0t8yj0nfkq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2008-08-27 20:14:49 +0200
message:
Canonicalize more paths.
modified:
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
transport.py transport.py-20060406231150-b3472d06b3a0818d
util.c util.c-20080531154025-s8ef6ej9tytsnkkw-1
util.h util.h-20080531154025-s8ef6ej9tytsnkkw-2
=== modified file 'ra.c'
--- a/ra.c 2008-08-26 01:52:33 +0000
+++ b/ra.c 2008-08-27 18:14:49 +0000
@@ -874,7 +874,7 @@
* so tweak our own parameters a bit. */
apr_paths = apr_array_make(temp_pool, 1, sizeof(char *));
APR_ARRAY_PUSH(apr_paths, char *) = apr_pstrdup(temp_pool, "");
- } else if (!string_list_to_apr_array(temp_pool, paths, &apr_paths)) {
+ } else if (!path_list_to_apr_array(temp_pool, paths, &apr_paths)) {
apr_pool_destroy(temp_pool);
return NULL;
}
@@ -1763,7 +1763,7 @@
if (temp_pool == NULL)
return NULL;
- if (!string_list_to_apr_array(temp_pool, paths, &apr_paths)) {
+ if (!path_list_to_apr_array(temp_pool, paths, &apr_paths)) {
apr_pool_destroy(temp_pool);
return NULL;
}
=== modified file 'transport.py'
--- a/transport.py 2008-08-27 17:39:12 +0000
+++ b/transport.py 2008-08-27 18:14:49 +0000
@@ -304,7 +304,12 @@
self.pending.append(Exception("Some exception was not handled"))
self.semaphore.release()
- fetcher = logfetcher(self, paths=paths, start=from_revnum, end=to_revnum, limit=limit, discover_changed_paths=discover_changed_paths, strict_node_history=strict_node_history, include_merged_revisions=include_merged_revisions, revprops=revprops)
+ if paths is None:
+ newpaths = None
+ else:
+ newpaths = [p.rstrip("/") for p in paths]
+
+ fetcher = logfetcher(self, paths=newpaths, start=from_revnum, end=to_revnum, limit=limit, discover_changed_paths=discover_changed_paths, strict_node_history=strict_node_history, include_merged_revisions=include_merged_revisions, revprops=revprops)
fetcher.start()
return iter(fetcher.next, None)
@@ -322,9 +327,14 @@
self.mutter('svn log -r%d:%d %r' % (from_revnum, to_revnum, paths))
+ if paths is None:
+ newpaths = None
+ else:
+ newpaths = [p.rstrip("/") for p in paths]
+
conn = self.get_connection()
try:
- return conn.get_log(rcvr, paths,
+ return conn.get_log(rcvr, newpaths,
from_revnum, to_revnum,
limit, discover_changed_paths, strict_node_history,
include_merged_revisions,
=== modified file 'util.c'
--- a/util.c 2008-08-24 16:44:21 +0000
+++ b/util.c 2008-08-27 18:14:49 +0000
@@ -25,6 +25,7 @@
#include <svn_error_codes.h>
#include <svn_config.h>
#include <svn_version.h>
+#include <svn_path.h>
#include "util.h"
@@ -121,6 +122,32 @@
return true;
}
+bool path_list_to_apr_array(apr_pool_t *pool, PyObject *l, apr_array_header_t **ret)
+{
+ int i;
+ if (l == Py_None) {
+ *ret = NULL;
+ return true;
+ }
+ if (!PyList_Check(l)) {
+ PyErr_Format(PyExc_TypeError, "Expected list of strings, got: %s",
+ l->ob_type->tp_name);
+ return false;
+ }
+ *ret = apr_array_make(pool, PyList_Size(l), sizeof(char *));
+ for (i = 0; i < PyList_GET_SIZE(l); i++) {
+ PyObject *item = PyList_GET_ITEM(l, i);
+ if (!PyString_Check(item)) {
+ PyErr_Format(PyExc_TypeError, "Expected list of strings, item was %s", item->ob_type->tp_name);
+ return false;
+ }
+ APR_ARRAY_PUSH(*ret, char *) = svn_path_canonicalize(PyString_AsString(item), pool);
+ }
+ return true;
+}
+
+
+
PyObject *prop_hash_to_dict(apr_hash_t *props)
{
const char *key;
=== modified file 'util.h'
--- a/util.h 2008-08-24 14:51:43 +0000
+++ b/util.h 2008-08-27 18:14:49 +0000
@@ -30,6 +30,7 @@
__attribute__((warn_unused_result)) apr_pool_t *Pool(apr_pool_t *parent);
__attribute__((warn_unused_result)) bool check_error(svn_error_t *error);
bool string_list_to_apr_array(apr_pool_t *pool, PyObject *l, apr_array_header_t **);
+bool path_list_to_apr_array(apr_pool_t *pool, PyObject *l, apr_array_header_t **);
PyObject *prop_hash_to_dict(apr_hash_t *props);
apr_hash_t *prop_dict_to_hash(apr_pool_t *pool, PyObject *py_props);
svn_error_t *py_svn_log_wrapper(void *baton, apr_hash_t *changed_paths,
More information about the bazaar-commits
mailing list