[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r31145 - trunk/subversion/bindings/swig/python/libsvn_swig_py

From: <epg_at_google.com>
Date: Fri, 16 May 2008 12:38:07 -0700

epg_at_google.com writes:

> I don't see where or how we could DECREF it. It seems to me that
> we need to Py_DECREF here and have applications pull the same
> stunt they have to pull with the auth baton foo, editor and
> edit_baton, and so on: the Python application code has to hold
> onto these things itself :(. Something like this (from our
> swig-py test suite):
>
> Index: ra.py
> ===================================================================
> --- ra.py (revision 31145)
> +++ ra.py (working copy)
> @@ -133,6 +133,7 @@
> (editor, edit_baton) = ra.get_commit_editor3(self.ra_ctx, revprops,
> commit_cb, None, False)
> try:
> + dir_batons = []
> def driver_cb(parent, path, pool):
> self.assert_(path in all_paths)
> dir_baton = file_baton = None
> @@ -160,9 +161,11 @@
> 'test_delta_driver_commit', 'foo', pool)
> if file_baton is not None:
> editor.close_file(file_baton, None, pool)
> + dir_batons.append(dir_baton)
> return dir_baton
> delta.path_driver(editor, edit_baton, -1, all_paths.keys(), driver_cb)
> editor.close_edit(edit_baton)
> + del dir_batons
> except:
> try:
> editor.abort_edit(edit_baton)

Actually, since these are dir_batons, we only need to keep them
open as long as children of that directory are open. A stack
like this ought to work (from gvn, which is indeed not
segfaulting now with this patch, and with the DECREF intact).

Index: commit.py
===================================================================
--- commit.py (revision 918)
+++ commit.py (working copy)
@@ -175,8 +175,17 @@
                                                    False, # keep_locks
                                                    pool)
   try:
+ dir_batons = []
     def driver_cb(parent, path, pool):
- return action_cb(path, pool)(parent, path, editor, pool)
+ dir_baton = action_cb(path, pool)(parent, path, editor, pool)
+ try:
+ (last_path, last_baton) = dir_batons[-1]
+ except IndexError:
+ last_path = None
+ if last_path is not None and not gvn.util.IsChild(path, last_path):
+ dir_batons.pop(-1)
+ dir_batons.append((path, dir_baton))
+ return dir_baton
     svn.delta.path_driver(editor, edit_baton, revision, paths,
                           driver_cb, pool)
     if callable(postfix_txdelta_cb):

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-16 21:38:49 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.