[Trac-tickets] [The Trac Project] #2789: Post commit hook for Windows with multiple project support

The Trac Project noreply at edgewall.com
Wed Feb 22 20:03:24 CST 2006


#2789: Post commit hook for Windows with multiple project support
--------------------------------+-------------------------------------------
 Reporter:  brian175 at gmail.com  |       Owner:  jonas       
     Type:  enhancement         |      Status:  new         
 Priority:  low                 |   Milestone:              
Component:  general             |     Version:  0.9.4       
 Severity:  normal              |    Keywords:  hook windows
--------------------------------+-------------------------------------------
 I have been using Subversion for a while now, but just started using Trac.
 Way back when, I choose the single repository model and haven't thought
 twice about it until I discovered Trac.  Here's an idea of my layout:
  * REPO
    * Category1
      * !SubCategory
        * Project1
          * branches
          * tags
          * trunk
    * Category2
      * Project2
        * branches
        * tags
        * trunk
 After investigating the available options, I decided to keep the single
 repository (dump/load is just too much work) but create multiple trac
 environments for the projects or in some cases the Category or
 !SubCategory level.  The problem with this is now the post-commit hooks
 from Tickets #897 and #1602 won't work since only one trac env can be used
 (this is mentioned in #897 but no solution was posted).

 My solution is to use the svnlook changed command and look for project
 names in the path and map to my new trac environments.  I haven't tried
 python yet, but am familar with NSIS so I built a "silent" installer that:
  1. Reads the command line to get REPOS and TXN
  1. Execute the same svnlook commands as the hooks from #897 and #1602
  1. Execute svnlook changed command and parse for SVN project names
  1. Optionally parse svnlook changed output for a tagged RELEASE*
  1. Create new version using trac-admin for the RELEASE*

 The parameters are configurable through the ''post-commit.ini'' file

 {{{
 [path]
 SVN=C:\Program Files\Subversion
 Python=C:\Python23
 Trac_Env=D:\trac
 SVNREP=D:\SVN_REPOS\MyProjects
 TRAC_ADMIN=C:\Python23\Scripts

 [ProjectMap]
 SVN0=Category1/SubCategory/Project1/
 trac0=Project1
 SVN1=Category2/Project2/
 trac1=Project2
   .
   .
   .
 SVNn=...
 tracn=...

 [CreateVersion]
 CheckForRelease=true
 ReleaseString=/tags/RELEASE_

 [Debug]
 WriteReturn=false
 }}}
 '''Important Notes'''
  * The string match function is not very smart (no regex in NSIS) so make
 the SNV project string as explicit as possible (the example above could
 even include the trunk such as SVN0=Category1/SubCategory/Project1/trunk/)
 to avoid false matches
  * The !ProjectMap section must contain SNVn/tracn pairs where n starts at
 0 and increments by 1.
  * The debug option is not meant to be left on
  * The mapping feature allows trac projects (envoronments) to be named
 different than the corresponding SVN projects.
  * There is minimal error checking at this point
  * There are three files required for this to work
     1. [http://projects.edgewall.com/trac/browser/tags/trac-0.9.4/contrib
 /trac-post-commit-hook trac-post-commit-hook]
     1. ''post-commit.exe''
     1. ''post-commit.ini''
  * The ''post-commit.nsi'' is included incase anyone wants to modify it

 *I got the idea for the "new version" from tagged release from [http
 ://trac-hacks.org/wiki/SvnPostCommitCreateVersionScript] which also solves
 the multiple project issue (but only if every project in the REPOS has a
 corresponding trac project).

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2789>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list