You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by John <js...@ecclescollege.ac.uk> on 2005/06/04 14:57:10 UTC

Perl binding - no pool?

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