#2789 closed enhancement (wontfix)
Post commit hook for Windows with multiple project support
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | general | Version: | 0.9.4 |
Severity: | normal | Keywords: | hook windows |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
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
- Project1
- SubCategory
- Category2
- Project2
- branches
- tags
- trunk
- Project2
- Category1
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:
- Reads the command line to get REPOS and TXN
- Execute the same svnlook commands as the hooks from #897 and #1602
- Execute svnlook changed command and parse for SVN project names
- Optionally parse svnlook changed output for a tagged RELEASE*
- 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
- trac-post-commit-hook
- post-commit.exe
- 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).
Attachments (3)
Change History (6)
by , 19 years ago
Attachment: | post-commit.nsi added |
---|
by , 19 years ago
Attachment: | Post-Commit.ini added |
---|
by , 19 years ago
Attachment: | post-commit.exe added |
---|
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Even feature is nice, I still think that you should have posted this to trac-hacks as a hack rather than here. I doubt that this will ever be in mainstream release of Trac.
comment:3 by , 18 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
The attachment Post-Commit.2.ini was a mistake, ignore or remove if possible