1

I have the Bitnami Trac Version installed: Trac 1.0.10 Webserver: Apache 2

It is hostet on a Virtual Machine. Git is also installed there.

My Repository is a "Server" Repository on another Server, so TortoiseGit can't do a push/fetch/pull there. I created a local Repository on my Virtual Machine where I cloned my "Server" Repository.

I make a change in my source code and commit it to my local machine. Then I push it to the "Server" Repository and fetch the new information on the Virtual Machine Repository where Trac is installed.

On Trac I enabled the "tracopt.ticket.commit_updater.*" and added these lines in the "trac.ini" file:

commit_ticket_update_envelope = 
commit_ticket_update_commands.close = close closed closes fix fixed fixes
commit_ticket_update_commands.refs = <ALL>
commit_ticket_update_check_perms = true
commit_ticket_update_notify = true

I also created a "post-receive.sample" hook with the following entries:

REV=$(git rev-parse HEAD) 
trac-admin e:\bitnami trac stack projects\Prj changeset added "(Standard)" $REV

After I did these things i tried to commit a change with the comment like this: close #8. (Ticket 8 does exists and is not closed.)

Now to the problem: After i Commit, Push and Fetch the changes it doesn't closes the ticket. I hope you can help me

Evosoul
  • 197
  • 1
  • 12

1 Answers1

0

A file name post-receive.sample would not work as a hook: you need a file named post-receive (no extension), and it needs to be executable.
See "TracGit Setting up post-receive hooks as an example.

Only then the post-receive hook would actually run.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I use the "trac-post-receive-hook-0.12-new-commits-from-all-branches.py" as example and changed it Variablefolders to: TRAC_ENV = 'E:\Bitnami Trac Stack projects\Prj' GIT_PATH = 'C:\BitNami\trac-1.0.10-2\git' TRAC_ADMIN = 'C:\BitNami\trac-1.0.10-2\apps\trac\Scripts/trac-admin' REPO_NAME = '(default)' When I run it, the console runs and runs and runs, without a lifesign. Did i do something wrong? – Evosoul Sep 05 '16 at 07:20
  • @Evosoul Did you renamed that file as `post-receive`? – VonC Sep 05 '16 at 07:22
  • @Evosoul Please use Unix path: `/E/Bitnami Trac Stack projects/Prj`: that script will run with the Git bash shell (even on Windows). Make sure to use the latest one (Git 2.10: https://github.com/git-for-windows/git/releases). – VonC Sep 05 '16 at 07:24
  • For the console testing no. For testing with Trac yes – Evosoul Sep 05 '16 at 07:24
  • @Evosoul console testing: run a git bash first, and launch it within that bash session. – VonC Sep 05 '16 at 07:25
  • I try to run the hook (nothing happens here in the Git Bash) and the .py file (opens the python.exe). Am I still doing something wrong? I am new to Trac and Console working so please be patient with me – Evosoul Sep 05 '16 at 07:43
  • @Evosoul try with a simpler script (still starting with `#!/usr/bin/env python`), but with a simple echo in python, just to see if that works, both in the shell, and as a post-receive hook. – VonC Sep 05 '16 at 07:53
  • If I run it inside the normal console than this works: #! /usr/bin/python print "Hello" Inside the Git Bash it says that the permission is denied. But I run the shell with the admin account – Evosoul Sep 05 '16 at 08:03
  • @Evosoul Try `chmod 755 ` and run again to see if that works better. – VonC Sep 05 '16 at 08:11
  • With chmod 755 post-receive there is no Error but i don't see an output or something else. – Evosoul Sep 05 '16 at 08:21