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

Re: Issue creating large # of nodes in a transaction. (SWIG perl bindings)

From: Dan Mercer <dmercer_at_8kb.net>
Date: 2006-03-11 01:53:29 CET

Garrett Rooney wrote:
> On 3/10/06, Dan Mercer <dmercer@8kb.net> wrote:
>> I'm not sure what I'm doing wrong here, but any pointers would be
>> helpful, even if you can just verify that this code behaves the same in
>> your environment.
>
> You're probably running out of memory. For a nontrivial use of the
> bindings you're going to have to do some pool management, see the docs
> in SVN::Core.pm for more details.
Thanks for the reminder. I've gotten spoiled not having to worry about
pool allocation under the python bindings thanks to the improvements
made by David James and others.

The following code works a treat:

#!/usr/local/bin/perl -w

use strict;

use SVN::Core;
use SVN::Fs;
use SVN::Repos;

$|=1;

my $repos_path = shift;
my $count = shift;

my $pool = SVN::Pool->new_default;

my $svn = SVN::Repos::open($repos_path);
my $youngest = $svn->fs->youngest_rev();
my $rev_root = $svn->fs->revision_root($youngest);
my $txn = $svn->fs_begin_txn_for_commit($youngest, 'nobody', '');
my $txn_root = SVN::Fs::txn_root($txn);

my $nc = 0;
while ($nc < $count) {
    my $pool = SVN::Pool->new_default_sub;
    my $path = "/".$nc."_node";
    my $path_type = SVN::Fs::check_path($rev_root, $path, $pool);
    if ($path_type == $SVN::Node::none) {
# SVN::Fs::make_dir($txn_root, $path);
        SVN::Fs::make_file($txn_root, $path, $pool);
        print "$nc,",
    }
    $nc++;
}
my $revnum = $svn->fs_commit_txn($txn);
print "New revision -> $revnum\n";

I'll make the change in my tool and we'll be on our way.

Thanks,

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Mar 11 01:52:48 2006

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

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