Edgewall Software
Modify

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#2789 closed enhancement (wontfix)

Post commit hook for Windows with multiple project support

Reported by: brian175@… Owned by: jonas
Priority: low Milestone:
Component: general Version: 0.9.4
Severity: normal Keywords: hook windows
Cc:
Release Notes:
API 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
    • 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

[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. 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@… 9 years ago.
Post-Commit.ini (354 bytes) - added by brian175@… 9 years ago.
post-commit.exe (35.3 KB) - added by brian175@… 9 years ago.

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by brian175@…

Changed 9 years ago by brian175@…

Changed 9 years ago by brian175@…

comment:1 Changed 9 years ago by brian175@…

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

comment:2 Changed 9 years ago by jtiai

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 Changed 8 years ago by mgood

  • Resolution set to wontfix
  • Status changed from new to closed

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
Action
as closed The owner will remain jonas.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from jonas 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.