I tried to use Trac with Git.
- I've configured Git plugin - it shows repository and changesets in "Browse Source" tab correctly.
- Turned on CommitTicketUpdater plugin, configured it: turned off authentication, set not to use any brackets, left keywords to default.
- Added some tickets.
- Done commit开发者_StackOverflow社区s with message containing "close #5".
Trac sees ticket number (in changesets it is marked red and linked to ticket) but doesn't close ticket no 5. What might be wrong?
TIA
If I follow the documentation, you should try with closes #5
. If it still doesn't work, try to detect if the post-commit-hook is correctly configured.
The #XXX
is a standard Trac/Wiki syntax to reference the XXX ticket, on the other hand, the [YYYY]
will reference the YYYY commit, it will always work even if no post-commit-hook are defined.
Be sure to activate the post-commit-hook by following this link
I gave up Trac, switched to Redmine. It's now a little bit better - commits with given ticket's Id reference to tickets, but again - "fixes #1" doesn't close ticket number 1... Afaik Redmine doesn't need hooks..
how are you using the trac repository? Usually you have trac running on a server where you push to. The post-commit hook does not get run after a push.
You need a post-receive hook in this case. I made a a few changes to the post-receive hook in the git-plugin package, since it had some bugs. (f.ex. you can only make one change/second to a ticket in trac, so I had to add a sleep(1), since when you push all your commits would get processed in the same seccond. And you can also supply a number of worked hours)
This post-receive hook can be found on my github: https://github.com/JensTimmerman/TRAC-SVN-to-GIT-migration/blob/master/hooks/trac-post-receive-hook.py
you have to install this to /path/to/your/.git/hooks/post-receive and make sure it's executable (chmod +x /path/to/your/.git/hooks/post-receive in linux) and change the "TRAC_ENV = '/home/jens/tractest/'" to point to your trac environment.
edit:
If you're not hosting your git repository on the same server as you're running trac on you can do a pull to a temporary git repo and push again to the one trac uses with a cron job or so. This will then again trigger the post-receive hook on your real repository and update your trac.
I have this in place:
a64609@chaos:~/git$ ls
gitcron.log realrepo syncgit.sh tmprepo
where tmprepo is just a location where i pull and push to and realrepo has my post-receive hook. with syncgit.sh:
cd /home/username/git/tmprepo;
git pull;
git push real;
and the remote 'real' of tmprepo set to
a64609@chaos:~/git/tmprepo$ git remote -v show
origin https://JensTimmerman@github.com/hpcugent/easybuild.git
real ../realrepo/
and everything get's synced by a crontab entry (put this in crontab -e)
*/3 * * * * /hhome/username/git/syncgit.sh >> /home/username/git/gitcron.log 2>&1
I had the same problem. The git CommitTicketUpdater plugin seems to expect square brackets around the term by default, like [closes #5] See also the trac.init for commit_ticket_update_envelope
in this blog entry
If it helps, I filled my trac ini with the following:
[ticket] commit_ticket_update_commands.close = close
The official documentation claims that if you leave 'commit_ticket_update_commands.close =' empty, commiter update will use some default keywords in order to decide if it must close the ticket, but that doesn't work for me. The only thing that works is to explicitly set some keyword in that field, e.g (commit_ticket_update_commands.close = close)
精彩评论