[svk-devel] Re: a few locking-related issues

Bernhard Weisshuhn bkw at weisshuhn.de
Mon Oct 16 19:19:59 EDT 2006

Hi *,

Using current svk trunk, I ran into several problems, one of which
seems related to the new locking code. (I'll post the others in
sperarate mails later).

If a program issues more than one SVK::Command (unlike the svk binary,
which only fires one at a time), the statefile seems not to be updated
correctly at all times. Or I'm just stupid and doing something very
wrong. Whatever the case, I'd love to hear any comments you have on the
tiny attached script illustrating the problem. Sample output is also

It is basically like this:


But after that, the statefile does not contain the new checked out

To me the problem seems to be the merging of checkout paths at line
271-273 of SVK/XD.pm, but I must admit that I don't quite understand
the rationale there, so I'm reluctant to try to supply a fix, sorry.

Any comments deeply appreciated,
-------------- next part --------------
#!/usr/bin/env perl

use strict;
use warnings;

use SVK;
use SVK::XD;
use SVN::Core;
use autouse 'SVK::Util' => qw(catfile);

# adjust these for testing: 
my $svkroot = '/var/tmp/svktest'; # any empty directory
my $svnrepo = 'file:///var/tmp/somerepo'; # existing repo

my $projectname = 'locktest';

-d $svkroot or die "Please create directory $svkroot.\n";

my $copath = catfile($svkroot,'checkout');

# more or less from the svk binary:
my $xd = SVK::XD->new (
  giantlock => catfile($svkroot,'lock'),
  statefile => catfile($svkroot,'config'),
  svkpath   => $svkroot,
  floating  => undef
SVN::Core::config_ensure (undef);
$xd->{svnconfig} = SVN::Core::config_get_config (undef);

my $svk = SVK->new ( xd => $xd );

# create mirror if it doesn't exist:
if ($svk->ls("//$projectname")) {
  $svk->mirror($svnrepo,"//$projectname") && die "Could not mirror $svnrepo";

# if checkout doesn't exist, create it. Otherwise switch:
if ($svk->info($copath)) {
  $svk->checkout("//$projectname/",$copath,'--quiet') && die;
else {
  # never reached
  $svk->switch("//$projectname/",$copath) && die;

$svk->update($copath,'--quiet') && die;

print "Project checked out ok.\n";
-------------- next part --------------
% mkdir /var/tmp/svktest
% perl svk-locktest.pl
Repository /var/tmp/svktest/local does not exist, create? (y/n)y
Path /locktest is not a versioned directory
Committed revision 1.
Syncing file:///var/tmp/somerepo
Retrieving log information from 1 to 1
Committed revision 2 from revision 1.
path /var/tmp/svktest/checkout is not a checkout path.
Syncing //locktest(/locktest) in /var/tmp/svktest/checkout to 2.
Syncing //locktest(/locktest) in /var/tmp/svktest/checkout to 2.
Project checked out ok.
% perl svk-locktest.pl
Syncing file:///var/tmp/somerepo
path /var/tmp/svktest/checkout is not a checkout path.
Checkout path /var/tmp/svktest/checkout already exists.
Died at svk-locktest.pl line 44.

More information about the svk-devel mailing list