[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Making sure the tag name matches the version in a POM

From: Ryan Schmidt <subversion-2009a_at_ryandesign.com>
Date: Fri, 6 Mar 2009 04:14:52 -0600

On Mar 5, 2009, at 13:07, webpost_at_tigris.org wrote:

> I am using Maven to management my builds and I would like to create
> unique tags in by SVN repo that match each of my formal releases
> (version 1.0 is in /tags/1.0, etc.). Rather than trust myself to
> always be correct, I would like SVN to help me follow this rule.
> My original thought was to create a pre-commit trigger that parses
> the pom.xml to get the version and compare it to the changed
> directory name, but I can't find a command that will let me get to
> the pom.xml before it is committed.

Yes, that's the way I'd do it. Begin your pre-commit hook with

REPO="$1"
TXN="$2"

Then use

svnlook changed -t $TXN $REPO

to see the list of files that have changed. Continue with the
following checks only if the tags directory is being changed.

Since you require the pom.xml file, you could check that the pom.xml
file is one of the files being added, and exit with an error message
otherwise.

Now use

svnlook cat -t $TXN $REPO tags/tagname/pom.xml > /tmp/pom.xml

to get the contents of the pom.xml file into a temporary file.
Extract the version number from that file using whatever xml
processing tools you have and compare it to the tag name and exit if
they don't match.

> I could probably create a post-commit trigger that finds the
> pom.xml based on the revision and deletes the tag if the tag name
> is not correct, but that sounds like a bad idea. Does anyone have
> any suggestions?

Yes, that sounds bad to me too. :) Go with the pre-commit.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=1276402

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_subversion.tigris.org].
Received on 2009-03-06 11:15:53 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.