You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@bloodhound.apache.org by Tim Tisdall <ti...@gmail.com> on 2013/05/31 17:12:10 UTC
Adding a git repository
I'm new to both Bloodhound and Trac so am having a little bit of difficulty
fully understanding how things work. I've had to try to piece things
together from a combination of the documentation but I'm a little confused.
I've added "tracopt.versioncontrol.git.* = enabled" to [components]to be
able to add a git repository. I then added a repo through the menus Apps >
Admin > Repositories. I'm given a message that I should run 'trac-admin
$ENV repository resync "access_point"' (which I did), but this seems to be
done automatically whether I run that command or not. I'm also told 'You
should also set up a post-commit hook on the repository to call trac-admin
$ENV changeset added "access_point" $REV for each committed changeset.'.
Here's where I'm having the problem...
My understanding is that Trac used to ping the repo on each page load to
see if a change occurred but that was changed to use a hook to reduce all
the unnecessary calls. (makes sense) However, I tried committing a change
to the repo and it seems to have been reflected in the web interface
automatically. So, is the default in Bloodhound to automatically ping the
repo on each page load because I haven't incorporated the hook yet?
As for adding the hook... I have no idea what the $REV part of the hook
should be. Is that actually an environment variable set by git? Also, the
Bloodhound message said to add a hook to post-commit, but the TracGit
documentation mentions adding a post-receive hook. I'm not really sure how
they differ with respect to Trac/Bloodhound's functionality.
-Tim
Re: Adding a git repository
Posted by Ryan Ollos <ry...@wandisco.com>.
On Fri, May 31, 2013 at 11:13 AM, Tim Tisdall <ti...@gmail.com> wrote:
> Can you tell me what kind of value is stored in the $REV variable? I
> guess in SVN it's the revision number and for git it would be the revision
> hash?
>
It looks like the post-receive hook is being passed via stdin a list of
references to be updated, and for each of those references the hash of the
old and new rev is provided. So you need to iterate over all of the
references, for each of the references get the list of revisions that are
being pushed, and then call `trac-admin $TRACENV changeset added $REPOS
rev1 rev2 ....`
Since Trac hasn't provided a post-receive hook yet (1), it looks like the
easiest option might be to use see if the hook (2) on the older GitPlugin
page (which was integrated into Trac for v1.0) still works.
(1) http://trac.edgewall.org/ticket/10730
(2)
http://trac-hacks.org/attachment/wiki/GitPlugin/trac-post-receive-hook-0.12-new-commits-from-all-branches.py
Re: Adding a git repository
Posted by Tim Tisdall <ti...@gmail.com>.
Can you tell me what kind of value is stored in the $REV variable? I guess
in SVN it's the revision number and for git it would be the revision hash?
On Fri, May 31, 2013 at 1:52 PM, Ryan Ollos <ry...@wandisco.com> wrote:
> On Fri, May 31, 2013 at 8:12 AM, Tim Tisdall <ti...@gmail.com> wrote:
>
>> I'm new to both Bloodhound and Trac so am having a little bit of
>> difficulty fully understanding how things work. I've had to try to piece
>> things together from a combination of the documentation but I'm a little
>> confused.
>>
>> I've added "tracopt.versioncontrol.git.* = enabled" to [components]to be
>> able to add a git repository. I then added a repo through the menus Apps >
>> Admin > Repositories. I'm given a message that I should run 'trac-admin
>> $ENV repository resync "access_point"' (which I did), but this seems to
>> be done automatically whether I run that command or not.
>>
>
> I get the same result as you. Running the sync command is necessary for
> SVN, so I'll have to dig into whether or not that message is just an
> misleading artifact of the SVN support that isn't needed for Git.
>
>
>> I'm also told 'You should also set up a post-commit hook on the
>> repository to call trac-admin $ENV changeset added "access_point" $REV for
>> each committed changeset.'. Here's where I'm having the problem...
>>
>> My understanding is that Trac used to ping the repo on each page load to
>> see if a change occurred but that was changed to use a hook to reduce all
>> the unnecessary calls. (makes sense) However, I tried committing a change
>> to the repo and it seems to have been reflected in the web interface
>> automatically. So, is the default in Bloodhound to automatically ping the
>> repo on each page load because I haven't incorporated the hook yet?
>>
>
> Yes, I believe so. It appears that you need to set
> `repository_sync_per_request = ` (i.e. set the parameter to an empty list)
> to disable the "pinging".
>
> https://issues.apache.org/bloodhound/wiki/TracIni#trac-section
>
>
>> As for adding the hook... I have no idea what the $REV part of the
>> hook should be. Is that actually an environment variable set by git?
>> Also, the Bloodhound message said to add a hook to post-commit, but the
>> TracGit documentation mentions adding a post-receive hook. I'm not really
>> sure how they differ with respect to Trac/Bloodhound's functionality.
>>
>
> The SVN post-commit hook gets passed $REV, but I'm not sure about Git.
> There doesn't appear to be any documentation on how to do this. I'll do
> some investigation and get back to you in a few hours.
>
>
Re: Adding a git repository
Posted by Ryan Ollos <ry...@wandisco.com>.
On Fri, May 31, 2013 at 8:12 AM, Tim Tisdall <ti...@gmail.com> wrote:
> I'm new to both Bloodhound and Trac so am having a little bit of
> difficulty fully understanding how things work. I've had to try to piece
> things together from a combination of the documentation but I'm a little
> confused.
>
> I've added "tracopt.versioncontrol.git.* = enabled" to [components]to be
> able to add a git repository. I then added a repo through the menus Apps >
> Admin > Repositories. I'm given a message that I should run 'trac-admin
> $ENV repository resync "access_point"' (which I did), but this seems to
> be done automatically whether I run that command or not.
>
I get the same result as you. Running the sync command is necessary for
SVN, so I'll have to dig into whether or not that message is just an
misleading artifact of the SVN support that isn't needed for Git.
> I'm also told 'You should also set up a post-commit hook on the repository
> to call trac-admin $ENV changeset added "access_point" $REV for each
> committed changeset.'. Here's where I'm having the problem...
>
> My understanding is that Trac used to ping the repo on each page load to
> see if a change occurred but that was changed to use a hook to reduce all
> the unnecessary calls. (makes sense) However, I tried committing a change
> to the repo and it seems to have been reflected in the web interface
> automatically. So, is the default in Bloodhound to automatically ping the
> repo on each page load because I haven't incorporated the hook yet?
>
Yes, I believe so. It appears that you need to set
`repository_sync_per_request = ` (i.e. set the parameter to an empty list)
to disable the "pinging".
https://issues.apache.org/bloodhound/wiki/TracIni#trac-section
> As for adding the hook... I have no idea what the $REV part of the hook
> should be. Is that actually an environment variable set by git? Also, the
> Bloodhound message said to add a hook to post-commit, but the TracGit
> documentation mentions adding a post-receive hook. I'm not really sure how
> they differ with respect to Trac/Bloodhound's functionality.
>
The SVN post-commit hook gets passed $REV, but I'm not sure about Git.
There doesn't appear to be any documentation on how to do this. I'll do
some investigation and get back to you in a few hours.