Edgewall Software

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2789 closed enhancement (wontfix)

Post commit hook for Windows with multiple project support

Reported by: brian175@… 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:


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
  2. Execute the same svnlook commands as the hooks from #897 and #1602
  3. Execute svnlook changed command and parse for SVN project names
  4. Optionally parse svnlook changed output for a tagged RELEASE*
  5. Create new version using trac-admin for the RELEASE*

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

SVN=C:\Program Files\Subversion




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. trac-post-commit-hook
    2. post-commit.exe
    3. 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)

post-commit.nsi (6.1 KB ) - added by brian175@… 18 years ago.
Post-Commit.ini (354 bytes ) - added by brian175@… 18 years ago.
post-commit.exe (35.3 KB ) - added by brian175@… 18 years ago.

Download all attachments as: .zip

Change History (6)

by brian175@…, 18 years ago

Attachment: post-commit.nsi added

by brian175@…, 18 years ago

Attachment: Post-Commit.ini added

by brian175@…, 18 years ago

Attachment: post-commit.exe added

comment:1 by brian175@…, 18 years ago

The attachment Post-Commit.2.ini was a mistake, ignore or remove if possible

comment:2 by jtiai, 18 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 Matthew Good, 18 years ago

Resolution: wontfix
Status: newclosed

Yes, #1602 should address the issues with the commit hooks on Windows.

The multi-project support is good, but the solution will need to be added to the current Python hook script for cross-platform support. I've opened ticket #3368 for this request.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.