Trac dev and post commit hooks

101 views
Skip to first unread message

Sam Halliday

unread,
Sep 1, 2012, 7:32:49 AM9/1/12
to trac-...@googlegroups.com
Hi all,

I upgraded from 0.11 to 1.0 (dev) and I noticed that the post-commit hook for SVN changed quite a bit. I've upgraded my repositories and commits are communicating with Trac ok.

However, the old script I was using was able to close tickets if I did things like "fixes #34".

How can I get the "fixes #34" behaviour back again?

Regards, Sam

RjOllos

unread,
Sep 1, 2012, 2:14:30 PM9/1/12
to trac-...@googlegroups.com
You'll need to enable: tracopt.ticket.commit_updater.* 

Sam Halliday

unread,
Sep 1, 2012, 2:26:22 PM9/1/12
to trac-...@googlegroups.com

Thanks RjOllos, I had

  tracopt.ticket.commit_updater.committicketupdater = enabled

so maybe that missed the functionality (contrary to the admin plugin docs).

Will respond later when I use this to let you know if it doesn't work.

Samuel Halliday

unread,
Sep 1, 2012, 3:30:49 PM9/1/12
to trac-...@googlegroups.com
Just tried this with a comment "fixes #11" and although it showed up (as a clickable link) in the Trac History, the issue was still OPEN. I had to manually close it.

I have today's pull of Trac dev with post-commit-hook and "tracopt.ticket.commit_updater.* = enabled"

Any other ideas before I - perhaps incorrectly - file this as a bug?

--
Sam
> --
> You received this message because you are subscribed to the Google Groups "Trac Users" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/trac-users/-/k8mjMt7_ozEJ.
> To post to this group, send email to trac-...@googlegroups.com.
> To unsubscribe from this group, send email to trac-users+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

RjOllos

unread,
Sep 1, 2012, 11:31:46 PM9/1/12
to trac-...@googlegroups.com

On Saturday, September 1, 2012 12:31:01 PM UTC-7, Sam Halliday wrote:
Just tried this with a comment "fixes #11" and although it showed up (as a clickable link) in the Trac History, the issue was still OPEN. I had to manually close it.

I have today's pull of Trac dev with post-commit-hook and "tracopt.ticket.commit_updater.* = enabled"

Any other ideas before I - perhaps incorrectly - file this as a bug?

It seems like this issue has been reported a number of times on the mailing list, but I can't recall any specific resolutions at the moment. I'm not sure how this could matter, but one user said that changing the configuration fixed the issue:
[components]  
tracopt.ticket.commit_updater.* = enabled

->

[components] 
tracopt.ticket.commit_updater.committicketreferencemacro = enabled 
tracopt.ticket.commit_updater.committicketupdater = enabled

Are you using trac-svn-hook, and have you configured it?:

What are your settings for?:
[ticket]
commit_ticket_update_check_perms
commit_ticket_update_commands.close
commit_ticket_update_commands.refs

Samuel Halliday

unread,
Sep 2, 2012, 6:10:57 AM9/2/12
to trac-...@googlegroups.com
On 2 Sep 2012, at 04:31, RjOllos wrote:
> [components]
> tracopt.ticket.commit_updater.committicketreferencemacro = enabled
> tracopt.ticket.commit_updater.committicketupdater = enabled


OK, done this.


> Are you using trac-svn-hook, and have you configured it?:
> http://trac.edgewall.org/browser/trunk/contrib/trac-svn-hook?marks=52-54#L48

Yeah, it's all linked up. When I push a commit, it is showing up in the "Timeline".


> What are your settings for?:
> [ticket]
> commit_ticket_update_check_perms
> commit_ticket_update_commands.close
> commit_ticket_update_commands.refs

I don't have those settings so I presume I'm falling back to the defaults from http://trac.edgewall.org/wiki/CommitTicketUpdater


Cooke, Mark

unread,
Sep 3, 2012, 3:01:45 AM9/3/12
to trac-...@googlegroups.com
Looking at that page appears to confirm my suspicion that you need to set the `envelope` option. Try doing a commit using the log message `[fixes #34]` (using the apparently default `[]` envelope. If that works, just define the envelope option to be empty and you should be back where you want to be...

~ mark c

Samuel Halliday

unread,
Sep 3, 2012, 3:36:59 PM9/3/12
to trac-...@googlegroups.com
I added the envelope setting, and tried a "[refs #30]" commit message (also without the square brackets). Again, shows up as a clickable link in timeline but no mention in the ticket itself.

Cooke, Mark

unread,
Sep 4, 2012, 3:09:12 AM9/4/12
to trac-...@googlegroups.com
> On 3 Sep 2012, at 08:01, "Cooke, Mark" wrote:
> >> the defaults from http://trac.edgewall.org/wiki/CommitTicketUpdater
> >
> > Looking at that page appears to confirm my suspicion that
> you need to set the `envelope` option. Try doing a commit
> using the log message `[fixes #34]` (using the apparently
> default `[]` envelope. If that works, just define the
> envelope option to be empty and you should be back where you
> want to be...
>
> -----Original Message-----
> From: trac-...@googlegroups.com On Behalf Of Samuel Halliday
> Sent: 03 September 2012 20:37
> To: trac-...@googlegroups.com
> Subject: Re: [Trac] Trac dev and post commit hooks
>
> I added the envelope setting, and tried a "[refs #30]" commit
> message (also without the square brackets). Again, shows up
> as a clickable link in timeline but no mention in the ticket itself.
>
...you removed most of the historical context to this email? I use email and don't store old messages, so I don't have the old info on your config so far.

I think I would suggest that you (a) set _all_ the options referenced in the www help page (link above) rather than rely on the defaults, (b) restart your server to make sure they're used, (c) try it again and (d) if it still doesn't work, show us the config and commit message you used and say what did and didn't happen.

For your ref, here are my settings (but note that I don't use `close` from commit as we have a separate testing phase in our workflow):-

[components]
tracopt.ticket.commit_updater.* = enabled

[ticket]
commit_ticket_update_envelope =
#commit_ticket_update_commands.close =
commit_ticket_update_commands.refs = <ALL>
commit_ticket_update_check_perms = true
commit_ticket_update_notify = true

....this should add a ref for any `#<number>` bit of text to ticket <number>, checking that the commiter has rights to update the ticket (do your svn and trac usernames match?).

~ mark c

Samuel Halliday

unread,
Sep 5, 2012, 3:21:40 PM9/5/12
to trac-...@googlegroups.com
Added all settings, still not updating the ticket :-(

--
Sam
> --
> You received this message because you are subscribed to the Google Groups "Trac Users" group.

Cooke, Mark

unread,
Sep 6, 2012, 3:18:52 AM9/6/12
to trac-...@googlegroups.com
[Note: please post in-line or at the bottom...]
> -----Original Message-----
> From: trac-...@googlegroups.com
> [mailto:trac-...@googlegroups.com] On Behalf Of Samuel Halliday
> Sent: 05 September 2012 20:22
> To: trac-...@googlegroups.com
> Subject: Re: [Trac] Trac dev and post commit hooks
>
> Added all settings, still not updating the ticket :-(
>
> --
> Sam

Do you have TRAC_ADMIN permission for your trac? If so, go to the `About Trac` link (under the search button) and make sure that the settings displayed there match what you are expecting them to be (especially the [components], [ticket] and [trac] repository_ settings). Paste them in a reply if you can, along with the exact log message(s) you have tried that did not work.

If you are not TRAC_ADMIN and you have `commit_ticket_update_check_perms = true` are you sure you can edit the ticket comments OK?

Are your trac and svn usernames identical?

Please also post your svn post-commit hook script ~ how have you tested that it works for whichever user the apache daemon runs as? The svn commit still succeedes even if the post-commit hook fails (as it runs by definition after the commit completes) so that might explain why svn works but the trac bit doesn't. On *nix this is usually a permissions issue, can also be on Windows depending on how you are setup (it helps if you tell us what platform you are on and exactly which versions ~ if you did earlier you removed that info from the text).

In your trac instance, set the Admin > Logging configuration to DEBUG level then try again and see if any errors are reported.

~ mark c

Samuel Halliday

unread,
Sep 6, 2012, 10:37:03 AM9/6/12
to trac-...@googlegroups.com
(content appears at bottom)
Thanks Mark! It was a permission problem, I had forgotten to change the owner of the post-commit hook.

Now all works fine. The thing that was confusing me the most was that the history was showing up, so I have now learnt that the timeline doesn't depend on the hook running successfully.

Cooke, Mark

unread,
Sep 6, 2012, 11:17:49 AM9/6/12
to trac-...@googlegroups.com
> -----Original Message-----
> From: trac-...@googlegroups.com On Behalf Of Samuel Halliday
> Sent: 06 September 2012 15:37
> To: trac-...@googlegroups.com
> Subject: Re: [Trac] Trac dev and post commit hooks
>
> (content appears at bottom)

Thanks!
Glad to have got you sorted.

> Now all works fine. The thing that was confusing me the most
> was that the history was showing up, so I have now learnt
> that the timeline doesn't depend on the hook running successfully.

Well, that may depend if you are using the "old" or "new" repo synchronisation mechanism:-

http://trac.edgewall.org/wiki/TracRepositoryAdmin#ExplicitSync

...as that page states, if the old per-request sync is used (as I suspect yours is): "Note that in this case, the changeset listener extension point is not called, and therefore plugins using it will not work correctly."

As you are using the post-commit hook, you want to set `repository_sync_per_request` to False.

~ mark c
Reply all
Reply to author
Forward
0 new messages