Trac,post-接收挂钩,没有附加票据的提交消息
Trac, post-receive hook, no ticket attached commit messages
我有安装了 Ubuntu 14.04、git repo 和 trac 1.0 的远程服务器。
尝试使 post-receive 挂钩与 trac env 通信以将带有 "refs #NNN" 的提交消息附加到 "git push".
上的 NNN 票证
- 我可以手动添加评论
- Post使用 gresql 9.3
- 回购是用 trac-admin 添加的
- 推送工作正常 - 我可以在远程仓库中看到提交
Post-receive hook 可能工作正常 - 它具有 exec 权限,它被调用并且所有 trac env 都属于相应的用户
#!/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
trac.ini 中的存储库重新同步设置为空
Git 并在 [components] 中启用了提交更新程序,现在不需要通过提交关闭票证:
[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
我启用了日志记录但没有看到任何权限(或其他)错误
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
如果重要的话尝试推送不同的分支
- 如果需要,还安装了 TracAccountManager 版本 0.4.4
- 我可以通过 Admin > Repositories 查看提交
但是提交没有附加,你能帮我找出我的错误吗?
对于 commit_ticket_update_envelope = []
,您必须将引用括在方括号中:[refs #NNN]
。如果您不想将短语括在方括号中,请从 trac.ini 中删除 commit_ticket_update_envelope = []
,或使用 commit_ticket_update_envelope =
.
我有安装了 Ubuntu 14.04、git repo 和 trac 1.0 的远程服务器。 尝试使 post-receive 挂钩与 trac env 通信以将带有 "refs #NNN" 的提交消息附加到 "git push".
上的 NNN 票证- 我可以手动添加评论
- Post使用 gresql 9.3
- 回购是用 trac-admin 添加的
- 推送工作正常 - 我可以在远程仓库中看到提交
Post-receive hook 可能工作正常 - 它具有 exec 权限,它被调用并且所有 trac env 都属于相应的用户
#!/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" doneproject_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
trac.ini 中的存储库重新同步设置为空
Git 并在 [components] 中启用了提交更新程序,现在不需要通过提交关闭票证:
[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
我启用了日志记录但没有看到任何权限(或其他)错误
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
如果重要的话尝试推送不同的分支
- 如果需要,还安装了 TracAccountManager 版本 0.4.4
- 我可以通过 Admin > Repositories 查看提交
但是提交没有附加,你能帮我找出我的错误吗?
对于 commit_ticket_update_envelope = []
,您必须将引用括在方括号中:[refs #NNN]
。如果您不想将短语括在方括号中,请从 trac.ini 中删除 commit_ticket_update_envelope = []
,或使用 commit_ticket_update_envelope =
.