tags:

views:

121

answers:

4

My experience is in Perl, but willing to consider other scripting languages. Is there popular stable svn scripting library module for Perl, Python or Ruby that we should be considering:

Goal: write simple svn wrapper script for branching or tagging in Perl, Python or Ruby

my requirements:

Write a simple command-line script probably under 100 lines
that supports these actions:

  - create a specified svn branch
  - create a specified svn tag.  (Possibly deducing tag location
    by swapping "trunk" with "tags".)

support svn 1.6 repository or later

Script to be invoked on the svn server for speed and per current
"in house" policy.

I have been asked to use a library approach, instead of directly
calling (for ex) 'svn copy', because of the value that may added
by the library method, and because the script may be easier to
maintain and extend.

Is there a popular stable svn scripting library module for perl, python or ruby that we should be considering?

--
thanks,
Tom

--
Here are the cpan modules I'm looking at: http://www.connotea.org/user/zfyarpe/tag/tmp-9fz

Here is a the larger list I first considered: swap "tmp-9fz" with "svn-cpan" in last link

+3  A: 

SVN::Client is the official perl interface to the subversion client functionality. The other modules you list don't seem appropriate to your task (and just use the svn binary under the hood, which you seem to want to avoid?).

The script shouldn't need to be invoked on the server to be speedy; it just needs to use repository urls instead of local working directories.

100 lines seems excessive - presumably your script will parse and validate command line parameters and execute a single svn command, which shouldn't be that complicated.

I too question the need for using a module rather than just running svn.

(SVN::Client should come with subversion; the cpan Alien-SVN distribution that includes it is just for convenience - it builds subversion to generate the module.)

ysth
Appreciate all the help and comments from everyone.How would I quickly validate that SVN::Client is already installed?I did not see an svn subdir below the perl installation tree.
perl -we'use SVN::Client' and see if it gets an error. What OS/distribution are you using?
ysth
+1  A: 

The best code is no code at all.

Use the command line.

Michael Hackner
In terms of enforcing things like acting on the server, not the client, and standardizing branch/tag names, a wrapper makes perfect sense.
ysth
A: 

Take a look at the svncopy Perl script noted in this defect. It's a good start at what you need.

D.Shawley
Interesting script, thx (part of SVN::Client). This is a problem though:http://subversion.tigris.org/issues/show_bug.cgi?id=1258
+1  A: 

I agree with the other replies -- unless you have something very specific that you need to enforce (e.g. a particular naming scheme, or a complicated process that you are using to merge), just use the command-line. When I was new to svn I wrote up a few bash scripts to perform some of my common actions (creating a new branch, merging trunk into my branch, committing my branch back to trunk) but it quickly became clear that it was more straight-forward (and just as easy to execute) if I just used the svn commands themselves. Obfuscating the underlying actions being performed on the repository doesn't do any good -- users of svn need to understand what is happening to their branches so they know what actions are appropriate (e.g. merge down, copy up).

tl;dr version: what in particular are you trying to achieve?

Ether