Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA0D0950F for ; Fri, 10 Feb 2012 13:52:17 +0000 (UTC) Received: (qmail 99269 invoked by uid 500); 10 Feb 2012 13:52:17 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 99226 invoked by uid 500); 10 Feb 2012 13:52:17 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 99219 invoked by uid 99); 10 Feb 2012 13:52:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2012 13:52:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2012 13:52:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 52D4323888CD for ; Fri, 10 Feb 2012 13:51:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1242766 - /subversion/branches/fix-rdump-editor/subversion/svnrdump/dump_editor.c Date: Fri, 10 Feb 2012 13:51:53 -0000 To: commits@subversion.apache.org From: hwright@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120210135153.52D4323888CD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hwright Date: Fri Feb 10 13:51:52 2012 New Revision: 1242766 URL: http://svn.apache.org/viewvc?rev=1242766&view=rev Log: On the fix-rdump-editor branch: Improve pool handling and ensure the dir_prop hashes are lazily allocated. * subversion/svnrdump/dump_editor.c (make_dir_baton): Set the pool parameter. (open_root): Use the provided pool to make the dir baton. (add_directory, open_directory): Same. (close_directory): Dump the node here. (open_file): Properly set the output file baton. (change_dir_prop): Lazily allocate the property change hashes. Modified: subversion/branches/fix-rdump-editor/subversion/svnrdump/dump_editor.c Modified: subversion/branches/fix-rdump-editor/subversion/svnrdump/dump_editor.c URL: http://svn.apache.org/viewvc/subversion/branches/fix-rdump-editor/subversion/svnrdump/dump_editor.c?rev=1242766&r1=1242765&r2=1242766&view=diff ============================================================================== --- subversion/branches/fix-rdump-editor/subversion/svnrdump/dump_editor.c (original) +++ subversion/branches/fix-rdump-editor/subversion/svnrdump/dump_editor.c Fri Feb 10 13:51:52 2012 @@ -192,6 +192,7 @@ make_dir_baton(const char *path, new_db->added = added; new_db->written_out = FALSE; new_db->deleted_entries = apr_hash_make(pool); + new_db->pool = pool; return new_db; } @@ -450,7 +451,7 @@ open_root(void *edit_baton, eb->deleted_props = apr_hash_make(eb->pool);*/ *root_baton = make_dir_baton(NULL, NULL, SVN_INVALID_REVNUM, - edit_baton, NULL, FALSE, eb->pool); + edit_baton, NULL, FALSE, pool); LDR_DBG(("open_root %p\n", *root_baton)); return SVN_NO_ERROR; @@ -498,7 +499,7 @@ add_directory(const char *path, LDR_DBG(("add_directory %s\n", path)); new_db = make_dir_baton(path, copyfrom_path, copyfrom_rev, pb->eb, - pb, TRUE, pb->eb->pool); + pb, TRUE, pool); /* Some pending properties to dump? */ /*SVN_ERR(do_dump_props(&pb->eb->propstring, pb->eb->stream, @@ -566,7 +567,7 @@ open_directory(const char *path, } new_db = make_dir_baton(path, copyfrom_path, copyfrom_rev, pb->eb, pb, - FALSE, pb->eb->pool); + FALSE, pool); *child_baton = new_db; return SVN_NO_ERROR; } @@ -586,8 +587,9 @@ close_directory(void *dir_baton, eb->props, eb->deleted_props, &(eb->dump_props), TRUE, pool, pool));*/ - /* Some pending newlines to dump? */ - SVN_ERR(do_dump_newlines(eb, &(eb->dump_newlines), pool)); + SVN_ERR(dump_node(db->eb, db->abspath, svn_node_dir, + svn_node_action_change, FALSE, db->copyfrom_path, + db->copyfrom_rev, pool)); /* Dump the deleted directory entries */ for (hi = apr_hash_first(pool, db->deleted_entries); hi; @@ -672,6 +674,8 @@ open_file(const char *path, fb->copyfrom_rev = pb->copyfrom_rev; } + *file_baton = fb; + return SVN_NO_ERROR; } @@ -691,24 +695,20 @@ change_dir_prop(void *parent_baton, /* The fact that we're here means this node has information, it isn't just being opened for the sake of reading its children. */ if (value) - apr_hash_set(db->props, apr_pstrdup(db->eb->pool, name), - APR_HASH_KEY_STRING, svn_string_dup(value, db->eb->pool)); - else - apr_hash_set(db->deleted_props, apr_pstrdup(db->eb->pool, name), - APR_HASH_KEY_STRING, ""); + { + if (!db->props) + db->props = apr_hash_make(db->pool); - if (! db->written_out) + apr_hash_set(db->props, apr_pstrdup(db->pool, name), + APR_HASH_KEY_STRING, svn_string_dup(value, db->eb->pool)); + } + else { - /* If db->written_out is set, it means that the node information - corresponding to this directory has already been written: don't - do anything; do_dump_props() will take care of dumping the - props. If it not, dump the node itself before dumping the - props. */ - - SVN_ERR(dump_node(db->eb, db->abspath, svn_node_dir, - svn_node_action_change, FALSE, db->copyfrom_path, - db->copyfrom_rev, pool)); - db->written_out = TRUE; + if (!db->deleted_props) + db->deleted_props = apr_hash_make(db->pool); + + apr_hash_set(db->deleted_props, apr_pstrdup(db->pool, name), + APR_HASH_KEY_STRING, ""); } return SVN_NO_ERROR;