Perling in svn

runrig on 2006-01-17T18:49:08

I have a basic Tk utility to do my branching and tagging so that I don't have to manually enter branch and tag url's and make inevitable typos. Using SVN::Client the branching for some particular enhancement (project/defect) goes like this:

# Create project branch
$ctx->copy( $trunk, 'HEAD', $project_url );
# Switch working directory to project
$ctx->switch( $wrk_dir, $project_url, 'HEAD', 1 );
# Tag this revision as revision zero
my $rev = "$tags/${project}R0";
$ctx->copy( $project_url, 'HEAD', $rev );
I know tagging every revision may be overkill, but it makes me more comfortable. One part I wasn't too sure of was how to tell if a $project_url already existed, I searched but could not find a definitive answer. At first I did a $ctx->ls(...) but that's not very efficient if a URL has lots of files (which these directories do), so I settled on:
    my $exists = eval { $ctx->proplist( $project_url, 'HEAD', 0 ) };
If anyone has a better answer, I'm all ears :-) Another problem was getting a URL from a working directory. There's an easy way:
  my $url = eval { $ctx->url_from_path( $wrk_dir ) };
The above code works fine, except on Windows, where the program blows up (even with the eval) if the working directory is, e.g. (by mistake), "C:/" (a top-level directory) with:
Assertion failed: is_canonical (base, blen), file C:\Home\brane\src\svn\releases
\subversion-1.2.3\subversion\libsvn_subr\path.c, line 114

This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.
...which is seems to be a subversion library error? I don't see this particular problem reported anywhere yet...