[Trac] SVN Pre-Commit Hook to ensure Trac ID in Comment

124 views
Skip to first unread message

Marjory L. Mackes

unread,
Apr 27, 2010, 11:16:35 AM4/27/10
to trac-...@googlegroups.com
 Hi Trac/SVN Users!
 
I am using Trac 0.11.0 and our group recently added a couple of new projects. 
 
Right now we have one Subversion with directories for each project
Project
     branches
     tags
     trunk
 
We have 3 Trac (I want to say instances) that are sharing the authentication file
 
My question revolves around the /apps/trac/var/svn/hooks/pre-commit.pl hook which requires
the user to enter the Trac ID number to check in the source to associate the change set with the ticket.
 
Originally when it was just one project, one trac this worked fine, but now I need to customize this to be sure I point to the correct repository ($repos).  It is just not clear to me what that value is that is passed in from trac so that I can create the if construct to handle it.   I already figured out the part that points to SQLDB
 
If $repos = Project A then use the path to Project A Trac
  elseif Project B then use the path to Project B Trac
  elseif Project C then use the path to Project C Trac.
 
I do understand that version 0.12.0 is in beta test and is supposed to handle multiple projects.
 
The workflow works with the exception of this check in.
 
Right now it lets me get around it for all projects by using either CM,comment or Maint,comment for the check in comment since that is generic
 
Thanks!
        

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-...@googlegroups.com.
To unsubscribe from this group, send email to trac-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

Chris Heller

unread,
May 1, 2010, 3:11:23 PM5/1/10
to trac-...@googlegroups.com
One thing that you can do is use 'svn look' to look at the paths being committed.  You can use that to figure out which Trac project is the relevant one.  

Depending on your requirements,  you could either return a list of which Trac projects are being used to commit against,  or if each commit needs to be tied to just one Trac project,  then you can block commits that try to update files that belong to different Trac projects.  You'd get the Trac project from the first path in the commit,  then raise an error if any additional paths did not belong to the same project. 
Reply all
Reply to author
Forward
0 new messages