Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

runrig (3385)

runrig
  dougwNO@SPAMcpan.org

Just another perl hacker somewhere near Disneyland

I have this homenode [perlmonks.org] of little consequence on Perl Monks [perlmonks.org] that you probably have no interest in whatsoever.

I also have some modules [cpan.org] on CPAN [cpan.org] some of which are marginally [cpan.org] more [cpan.org] useful [cpan.org] than others.

Journal of runrig (3385)

Tuesday January 17, 2006
01:49 PM

Perling in svn

[ #28391 ]
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...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.