Trac ticket does not get updated via SVN hooks - Windows Env

231 views
Skip to first unread message

Sowmya Dass

unread,
Aug 16, 2013, 12:00:03 AM8/16/13
to trac-...@googlegroups.com
 

I have a Trac and SVN setup done on my server. I have integrated SVN-Trac using post commit hook and post-revprop-change hook. itsWhen I perform a commit, I can see the timeline on trac getting updated but the corresponding ticket does not get updated with any comments or change state. I have tried looking around on google as well as stackoverflow for such issues but then almost all of them had permission issues at directory level on linux/unix environments which most likely is not my case. Apparently I do not have any permission issues in my windows environment as I am running trac and svn using my login.

Please find the setup details mentioned below:

Server OS : Windows 2008 R2

- Wandisco SVN server installed using :WANdiscoSubversion_1.7.8-2.exe

- Python 2.7.5 (32 bit)

- Trac 1.0.1

I need to have SVN-Trac integrated so that the SVN commits update trac ticket status and comments with the traclink.

To achieve this, I have setup post commit hooks in SVN as mentioned in the Trac documentation at :http://trac.edgewall.org/wiki/TracRepositoryAdmin#ExplicitSync and http://trac.edgewall.org/wiki/CommitTicketUpdater.

I have done the following changes :

  1. Enabled the commit ticket updater via the trac web interface -> admin -> plugins.

  2. As per the documentation for CommitTicketUpdater on trac as mentioned above, I've added the following lines additionally in trac.ini present under trac_env/conf/trac.ini at the [components] section tracopt.ticket.commit_updater.committicketreferencemacro = enabled tracopt.ticket.commit_updater.committicketupdater = enabled

  3. Configured commit updater plugin by adding the following to the [ticket] section of the trac.ini file

    [ticket] commit_ticket_update_envelope = []

    commit_ticket_update_commands.close = close closed closes fix fixed fixes

    commit_ticket_update_commands.refs = addresses re references refs see

    commit_ticket_update_check_perms = true

    commit_ticket_update_notify = true

  4.  

I have also created post-commit.bat and post-revprop-change.bat and added it to the hooks folder in my svn repository. Please find the script code below :

post-commit.bat

@echo off
::
:: Trac-SVN post commit hook for explicit synchronisation
::

setlocal

set REPOS=%1
set REV=%2

C:\Python27\Scripts\trac-admin.exe C:\apps\new changeset added "%REPOS%" "%REV%"

post-revprop-change.bat

@echo off
::
:: Trac-SVN post revprop change hook
::

setlocal

set REPOS=%1
set REV=%2

C:\Python27\Scripts\trac-admin.exe C:\apps\new changeset modified "%REPOS%" "%REV%"

I have also tried checking trac.log (set at Debug level) but there is nothing relevant logged in there.

I have also printed the values from the post commit hook and they seem to be fine.

Can anyone please help me fix the above mentioned issue ?

Thanks !

Regards

Sowmya Dass

RjOllos

unread,
Aug 19, 2013, 7:57:12 PM8/19/13
to trac-...@googlegroups.com
You've said you setup explicit synchronization, but could you confirm that you've set:
[trac]
repository_sync_per_request =

It could be that your post-commit hook is not even being called, and you see the events on the timeline due to the implicit synchronization.

You could also try running "changeset added" and "changeset modified" from the command line.

If those suggestions fail to yield a solution, we need to know if changeset_added and changeset_modified are being called. Perhaps some logging could be added to those methods.

Is this a single or multirepository setup?

Other suggestions:

You could try manually inserting the macro call to a ticket, just to be sure it is really enabled. It needs to be of the form (with variables substituted by you):
In [changeset:"%s"]:
{{{
#!CommitTicketReference repository="%s" revision="%s"
%s
}}}

Try setting
[ticket]
commit_ticket_update_check_perms = false

What does the body of your commit message look like? commit_ticket_update_envelope = [] means that it needs to be of the form: [refs #1]

RjOllos

unread,
Aug 19, 2013, 9:59:25 PM8/19/13
to trac-...@googlegroups.com
I see from your StackOverflow post (1) that your workaround was to give TICKET_ADMIN to anonymous. Some comments on that:
 * The user should only need TICKET_APPEND, so if you are fine giving that permission to anonymous, the solution should be good enough.
 * If you don't want to give any of these permissions to anonymous and you have `commit_ticket_update_check_perms = true`, your SVN user committing the change will need to be granted at least TICKET_APPEND (2). This means you have to explicitly grant permissions in Trac for each SVN authname, or at least add the user to a group that has the permission.
 * If updating the ticket failed due to lack of permissions, you should see an error in the logs (3). Could you please check again?

Reply all
Reply to author
Forward
0 new messages