Rev 1632: Allow actually using custom revprops. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Sun Aug 24 15:50:51 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1632
revision-id: jelmer at samba.org-20080824145046-vhkl54eraxmpt88d
parent: jelmer at samba.org-20080824141419-1va03xgnayqzs1bd
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sun 2008-08-24 16:50:46 +0200
message:
  Allow actually using custom revprops.
modified:
  ra.c                           ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
  tests/test_ra.py               test_ra.py-20080313141743-uzsm7ejitrlqone5-1
=== modified file 'ra.c'
--- a/ra.c	2008-08-24 14:14:19 +0000
+++ b/ra.c	2008-08-24 14:50:46 +0000
@@ -1251,7 +1251,7 @@
 	const svn_delta_editor_t *editor;
 	void *edit_baton;
 	RemoteAccessObject *ra = (RemoteAccessObject *)self;
-	apr_hash_t *hash_lock_tokens;
+	apr_hash_t *hash_lock_tokens, *hash_revprops;
 	svn_error_t *err;
 
 	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOb", kwnames, &revprops, &commit_callback, &lock_tokens, &keep_locks))
@@ -1282,10 +1282,21 @@
 		return NULL;
 
 	Py_BEGIN_ALLOW_THREADS
+#if SVN_VER_MAJOR >= 1 && SVN_VER_MINOR >= 5
+	hash_revprops = prop_dict_to_hash(pool, revprops);
+	if (hash_revprops == NULL)
+		return NULL;
+	err = svn_ra_get_commit_editor3(ra->ra, &editor, 
+		&edit_baton, 
+		hash_revprops, py_commit_callback, 
+		commit_callback, hash_lock_tokens, keep_locks, pool);
+#else
+	/* FIXME: Check that revprops has only one member named SVN_PROP_REVISION_LOG */
 	err = svn_ra_get_commit_editor2(ra->ra, &editor, 
 		&edit_baton, 
 		PyString_AsString(PyDict_GetItemString(revprops, SVN_PROP_REVISION_LOG)), py_commit_callback, 
 		commit_callback, hash_lock_tokens, keep_locks, pool);
+#endif
 	Py_END_ALLOW_THREADS
 	
 	if (!check_error(err)) {

=== modified file 'tests/test_ra.py'
--- a/tests/test_ra.py	2008-08-02 16:56:12 +0000
+++ b/tests/test_ra.py	2008-08-24 14:50:46 +0000
@@ -128,6 +128,19 @@
         self.assertRaises(ra.BusyException, self.ra.get_commit_editor, {"svn:log": "foo"}, mycb)
         editor.abort()
 
+    def test_get_commit_editor_custom_revprops(self):
+        if ra.version()[:2] < (1,5):
+            return
+        def mycb(paths, rev, revprops):
+            pass
+        editor = self.ra.get_commit_editor({"svn:log": "foo", "bar:foo": "bla", "svn:custom:blie": "bloe"}, mycb)
+        root = editor.open_root()
+        root.add_directory("somedir").close()
+        root.close()
+        editor.close()
+
+        self.assertEquals(set(['bar:foo', 'svn:author', 'svn:custom:blie', 'svn:date', 'svn:log']), set(self.ra.rev_proplist(1).keys()))
+
     def test_get_commit_editor(self):
         def mycb(paths, rev, revprops):
             pass




More information about the bazaar-commits mailing list