0
votes

I have remote server with Ubuntu 14.04, git repo and trac 1.0 installation. Trying to make post-receive hook communicate with trac env to attach commit messages with "refs #NNN" to NNN ticket on "git push".

  • I can add comments manually
  • Postgresql 9.3 used
  • Repo was added with trac-admin
  • Pushing works fine - I can see commits in remote repo
  • Post-receive hook probably works fine - it has exec permissions, it is called and all trac env belongs to corresponding user

    #!/bin/sh tracenv=/home/ash/trac/project_1 repos=project_1 while read oldrev newrev refname; do if [ "$oldrev" = 0000000000000000000000000000000000000000 ]; then
    git rev-list --reverse "$newrev" -- else git rev-list --reverse "$newrev" "^$oldrev" -- fi | xargs trac-admin "$tracenv" changeset added "$repos" done
    project_1=> select * from repository ; id | name | value ----+------+---------------------------------- 1 | name | project_1 1 | dir | /home/ash/projects/project_1.git 1 | type | git (3 rows)
    $ ll total 44 drwxrwxr-x 9 ash www-data 4096 авг. 27 11:02 ./ drwxrwxr-x 3 ash ash 4096 авг. 27 06:22 ../ drwxrwxr-x 2 ash www-data 4096 авг. 27 06:23 conf/ drwxrwxr-x 4 ash www-data 4096 авг. 27 06:30 deploy/ drwxrwxr-x 4 ash www-data 4096 авг. 27 12:00 .egg-cache/ drwxrwxr-x 2 ash www-data 4096 авг. 27 06:23 htdocs/ drwxrwxr-x 2 ash www-data 4096 авг. 27 06:23 log/ drwxrwxr-x 2 ash www-data 4096 авг. 27 06:23 plugins/ -rw-rw-r-- 1 ash www-data 98 авг. 27 06:23 README drwxrwxr-x 2 ash www-data 4096 авг. 27 06:23 templates/ -rw-rw-r-- 1 ash www-data 27 авг. 27 06:23 VERSION
  • Repository resync in trac.ini is set to empty

  • Git and commit updater enabled in [components], no need for close ticket by commit for now:

    [components] tracopt.versioncontrol.git.* = enabled 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 = false commit_ticket_update_notify = true
  • I enabled logging and saw no permission (or other) errors

    remote: 14:05:09 Trac[api] DEBUG: Event changeset_added on project_1 for changesets (u'5fa8f68ec0981f0ce17564eb93538c7778645afa',)
    remote: 14:05:09 Trac[git_fs] INFO: detected GIT version 1.9.1
    remote: 14:05:09 Trac[PyGIT] DEBUG: PyGIT.Storage instance 140213134527440 constructed
    remote: 14:05:09 Trac[PyGIT] DEBUG: requested weak PyGIT.Storage instance 140213134527440 for '/home/ash/projects/project_1.git'
    remote: 14:05:09 Trac[git_fs] DEBUG: disabled CachedRepository for '/home/ash/projects/project_1.git'
    remote: 14:05:09 Trac[PyGIT] DEBUG: triggered rebuild of commit tree db for 140213134527440
    remote: 14:05:09 Trac[PyGIT] DEBUG: rebuilt commit tree db for 140213134527440 with 11 entries (took 15.1 ms)
    remote: 14:05:09 Trac[api] DEBUG: Event changeset_added on project_1 for revision 5fa8f68ec0981f0ce17564eb93538c7778645afa
  • Tried to push different branches if it matters

  • Also TracAccountManager version 0.4.4 installed if it matters
  • I can see commits through Admin > Repositories

But commits do not attach, can you help me to find my mistake?

1

1 Answers

0
votes

With commit_ticket_update_envelope = [], you must wraps your reference in brackets: [refs #NNN]. If you don't want to wrap the phrase in brackets, delete commit_ticket_update_envelope = [] from trac.ini, or use commit_ticket_update_envelope =.