You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by we...@tigris.org on 2009/03/05 19:07:17 UTC

Making sure the tag name matches the version in a POM

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.  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?

Thanks a lot.
-Stuart

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

Posted by we...@tigris.org.
I tried that, but the call to "svnlook -t" only returns the path to the tag directory that I am creating.  I am using Tortoise SVN to create the tag by performing right-clicking on a folder in the "branches" folder, dragging and dropping it to the "tags" folder and selecting the "Copy and rename item to here" option.

Thanks.
-Stuart

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

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

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

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 5, 2009, at 13:07, webpost@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@subversion.tigris.org].