Edgewall Software

Changes between Version 17 and Version 18 of TracRepositoryAdmin


Ignore:
Timestamp:
Jun 21, 2011, 12:07:34 AM (13 years ago)
Author:
Remy Blank
Comment:

Changed instructions about hooks on Mercurial to take #10225 into account.

Legend:

Unmodified
Added
Removed
Modified
  • TracRepositoryAdmin

    v17 v18  
    123123}}}
    124124
    125 Git hooks can be used in the same way for explicit syncing of git repositories.  Try in `.git/hooks/post-commit`
     125The Unix variants above assume that the user running the Subversion commit has write access to the Trac environment, which is the case in the standard configuration where both the repository and Trac are served by the web server. If you access the repository through another means, for example `svn+ssh://`, you may have to run `trac-admin` with different privileges, for example by using `sudo`.
     126
     127Note that calling `trac-admin` in your Subversion hooks can slow down the commit and log editing operations on the client side. You might want to use the [trac:source:trunk/contrib/trac-svn-hook contrib/trac-svn-hook] script which starts `trac-admin` in an asynchronous way. The script also comes with a number of safety checks and usage advices which should make it easier to set up and test your hooks. There's no equivalent `trac-svn-hook.bat` for Windows yet, but the script can be run by Cygwin's bash.
     128
     129See the [http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks section about hooks] in the Subversion book for more information. Other repository types will require different hook setups.
     130
     131Git hooks can be used in the same way for explicit syncing of git repositories. Add the following to `.git/hooks/post-commit`:
    126132{{{
    127133REV=$(git rev-parse HEAD)
     
    129135}}}
    130136
    131 For Mercurial, add the following entries to the `.hgrc` file of each repository accessed by Trac (replacing `<my-repository>` with the name of the repository in Trac):
    132 {{{
     137For Mercurial, add the following entries to the `.hgrc` file of each repository accessed by Trac (if [trac:TracMercurial] is installed in a Trac plugins directory, download [source:plugins/0.13/mercurial-plugin/tracext/hg/hooks.py hooks.py] and place it somewhere accessible):
     138{{{#!ini
    133139[hooks]
    134 commit = trac-admin /path/to/env changeset added <my-repository> $HG_NODE
    135 changegroup = hg log -r $HG_NODE: --template "{node} " | xargs trac-admin /path/to/env changeset added <my-repository>
     140; If mercurial-plugin is installed globally
     141commit = python:tracext.hg.hooks:add_changesets
     142changegroup = python:tracext.hg.hooks:add_changesets
     143
     144; If mercurial-plugin is installed in a Trac plugins directory
     145commit = python:/path/to/hooks.py:add_changesets
     146changegroup = python:/path/to/hooks.py:add_changesets
     147
     148[trac]
     149env = /path/to/env
     150trac-admin = /path/to/trac-admin
    136151}}}
    137 
    138 The Unix variants above assume that the user running the Subversion commit has write access to the Trac environment, which is the case in the standard configuration where both the repository and Trac are served by the web server. If you access the repository through another means, for example `svn+ssh://`, you may have to run `trac-admin` with different privileges, for example by using `sudo`.
    139 
    140 Note that calling `trac-admin` in your Subversion hooks can slow down the commit and log editing operations on the client side. You might want to use the [trac:source:trunk/contrib/trac-svn-hook contrib/trac-svn-hook] script which starts `trac-admin` in an asynchronous way. The script also comes with a number of safety checks and usage advices which should make it easier to set up and test your hooks. There's no equivalent `trac-svn-hook.bat` for Windows yet, but the script can be run by Cygwin's bash.
    141 
    142 See the [http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks section about hooks] in the Subversion book for more information. Other repository types will require different hook setups. Please see the plugin documentation for specific instructions.
    143152
    144153=== Per-request synchronization === #PerRequestSync