Well I admit that I'm a bit relieved by your response because I was afraid it was a trivial issue.

My plan wasn't to refactor the post-commit script but I really want to add this functionality. Our web server has very bad performances in loading pages so I think our developers should enjoy it for closing tickets.

That's funny because SVN is one of the things in our server that are not too outdated (1.8.8) so I will probably try your second solution.
I'll give you a feedback.


Regards,
Nicolas


On 13/10/2017 22:44, RjOllos wrote:


On Friday, October 13, 2017 at 12:04:41 PM UTC-7, Nicolas MARTIN wrote:

    Hello Trac users,


    I'd like to add the commit ticket updater feature to our project so I
    followed the instructions from
    https://trac.edgewall.org/wiki/CommitTicketUpdater
    <https://trac.edgewall.org/wiki/CommitTicketUpdater> and then
    https://trac.edgewall.org/wiki/1.0/TracRepositoryAdmin
    <https://trac.edgewall.org/wiki/1.0/TracRepositoryAdmin> in order to
    enable explicit repository synchronisation.

    Under svn directory, I appended a existing Perl script used for
    emailing
    commit notification with the next lines:

    ## Explicit repository synchronization for updating ticket based
    on commit log message ('Commit Ticket Updater')
    my @cmd = ('/usr/bin/trac-admin');
    push @cmd, '/path/to/project/trac';
    push @cmd, "changeset added $ARGV[0] $ARGV[1]";
    system(@cmd) == 0 or die "Python 'post-commit' script returned
    error $?";

    When pushing a commit, a developer get the error message:

    Warning: post-commit hook failed (exit code 2) with output:

    Error: TimeoutError: Unable to get database connection within 0
    seconds. (TracError: Database "/path/to/project/trac/db/trac.db"
    not found.)

    When I made some tests under project user, I had no issue because
    trac-admin knows that we are on a PostgreSQL DB with database
    option in
    trac.ini. I even made an utter test with a void environment (seems no
    user environment variable) :

    $ env - /usr/bin/perl ./post-commit /path/to/project/svn $rev

    Does somebody have a clue how I can get this post-commit hook
    working ?



That error is puzzling if your [trac] database string points to a PostgreSQL database. I haven't seen that one before.

I would use trac-svn-hook. I added documentation for it in Trac 1.2, but the documentation should be applicable to Trac 1.0 as well:
https://trac.edgewall.org/wiki/TracRepositoryAdmin#Subversion

If you are on SVN 1.8 or later you can use hooks-env variables configuration, using documentation for the forthcoming Trac 1.4 and trac-svn-hook from the trunk. It should also be backward compatible with Trac 1.0.
https://trac.edgewall.org/browser/trunk/contrib/trac-svn-hook
https://trac.edgewall.org/wiki/1.3/TracRepositoryAdmin#Subversion
https://trac.edgewall.org/ticket/12771

- Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to