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

Perl binding - no pool?

From: John <jsparrow_at_ecclescollege.ac.uk>
Date: 2005-06-04 16:57:10 CEST

I'm trying to query lock ownership using Perl bindings (from a hook), without
shelling to svnlook.

The code below seems to work, but is it safe to use when $pool is unassigned??

I guess the process that executes the hook (on win32) is short lived, so even if
this does leak, nothing to worry about?

Thanks,

John

======================

...

my $paramrepo = "c:\\myrepos";
my $parampath = "/project1/trunk/a.txt";
my $paramuser = "John";

my $repo = SVN::Repos::open($paramrepo);
my $fs = $repo->fs;
my $pool;
my $lock = SVN::_Fs::svn_fs_get_lock($fs,$parampath,$pool);

if ($lock)
{
        my $owner = SVN::_Core::svn_lock_t_owner_get($lock);
        if ($owner eq $paramuser)
        {
                # You own it anyway
                exit 0;
        } else
        {
                # Not allowed
                print STDERR "You cannot break a lock owned by '$owner'";
                exit 1;
        }
}

# no lock, so allow it
exit 0;

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Jun 4 17:04:44 2005

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.