Re: [Trac] Unable to get Trac Git working, all my Trac SVN work perfect...

372 views
Skip to first unread message

Ethan Jucovy

unread,
Jun 18, 2012, 12:59:49 PM6/18/12
to trac-...@googlegroups.com
Hi Bill,

I know this is not a complete solution to your problem, but I wanted to flag this line in your writeup: "t I found in the docs that after version 11 there was no need to install the plugin, and that there was git support built in"

This is not correct -- as far as I know, every Trac release so far requires the TracGit plugin from http://trac-hacks.org/wiki/GitPlugin.  The upcoming 1.0 release (formerly known as 0.13) will be the first to include the TracGit component in the core distribution, but it hasn't been released yet.

So, if you're running the latest Trac release (0.12.3) you'll want to install the TracGit plugin and revert your trac.ini configuration to the version that was pointing to that component (tracext.git.* = enabled etc) -- maybe there's just some problem with your installation of that plugin.

Hope this helps a bit,
Ethan

On Mon, Jun 18, 2012 at 11:29 AM, mbs400 <m...@mac-specialist.com> wrote:

I have several Trac SVN projects that I have been using for a long time with no problems (other than subversion glitches). I have been trying for the last couple of days to set up a small project using Trac Git. So far I have been unsuccessful. I would like to migrate the main projects over to Git providing I can get this initial project working correctly.

I have several screen captures that show the setup, trac.ini, the log info, the errors, etc.

Hopefully someone can provide some help. I have gone through everything I could find on the web, some of it several times, the Trac docs, etc.

http://www.journey-of-flight.com/bh_trac/osx_trac_svn_git_setup.php

I am running on OS X Lion

Thanks for any help,

Bill Hernandez
Plano, Texas

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/trac-users/-/E35xl1g5Dv4J.
To post to this group, send email to trac-...@googlegroups.com.
To unsubscribe from this group, send email to trac-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

mbs400

unread,
Jun 18, 2012, 6:08:54 PM6/18/12
to trac-...@googlegroups.com
Ethan,

Thanks for replying...

I tried :

-----------------------

For Trac 0.12
-----------------------

---> and it installed without any errors. 

Configuration

See also wiki:TracIni#git-section of your current Trac installation (if GitPlugin is enabled), for an up-to-date list of customizable [git] settings.


---> Warning: Can't synchronize with repository "(default)" 
---> (GIT backend not available). Look in the Trac log for more 
---> information.
---> Error: Not Found
---> No handler matched request to /wiki:TracIni
-----------------------


---> Warning: Can't synchronize with repository "(default)" 
---> (GIT backend not available). Look in the Trac log for more 
---> information.

tried : $ sudo trac-admin /DATA/bh_repository/bh_trac/git_net repository resync "*"
Password:
---> Done.


when I look at the log since the last restart the only error I see is:

Trac[git_fs] ERROR: GitError: Could not retrieve GIT version (tried to execute/parse '/usr/bin/git --version' but got ValueError('too many values to unpack',))


tried : $ which git
---> /usr/bin/git

tried : $ /usr/bin/git --version
---> git version 1.7.7.5 (Apple Git-26)

but as you can see the terminal gives me a valid version

Any ideas ?

Thanks again,

Bill Hernandez
Plano, Texas

Ethan Jucovy

unread,
Jun 18, 2012, 6:24:31 PM6/18/12
to trac-...@googlegroups.com
On Mon, Jun 18, 2012 at 6:08 PM, mbs400 <m...@mac-specialist.com> wrote:
when I look at the log since the last restart the only error I see is:

Trac[git_fs] ERROR: GitError: Could not retrieve GIT version (tried to execute/parse '/usr/bin/git --version' but got ValueError('too many values to unpack',))

Aha --  I googled for "trac git 'too many values to unpack'" and turned up this open bug report against the Trac Git Plugin:


There's a patch attached to that request which looks like it should fix this exact error you're seeing if you make the necessary change to your copy of the plugin's code and reload the web server.  Can you try that and see if it starts to work (or at least gets you farther)?

FWIW it looks like this bug hasn't yet been fixed in the version of the plugin bundled with Trac's development version, and also hasn't yet been reported in the Edgewall Trac.

Hope this helps,
Ethan

mbs400

unread,
Jun 18, 2012, 6:44:30 PM6/18/12
to trac-...@googlegroups.com
( 1 ) I am new to git, and github
 

There's a patch attached to that request which looks like it should fix this exact error you're seeing if you make the necessary change to your copy of the plugin's code and reload the web server.  Can you try that and see if it starts to work (or at least gets you farther)?

( 2 ) I have no clue how to patch, the install (can you point me in the right direction. I know it's a lot to ask but perhaps you might be so kind to list the steps ?. I wouldn't ask, but I've been working on this for days now..), which was :

and they basically were not interested in even looking at my problem...

( 4 ) Would you have better luck trying to get this fixed, especially for the new release 0.13 ?

mbs400

unread,
Jun 18, 2012, 6:50:02 PM6/18/12
to trac-...@googlegroups.com
I found 


This looks like it is going to take some time to figure out... 

Ethan Jucovy

unread,
Jun 18, 2012, 7:39:08 PM6/18/12
to trac-...@googlegroups.com
On Mon, Jun 18, 2012 at 6:44 PM, mbs400 <m...@mac-specialist.com> wrote:
There's a patch attached to that request which looks like it should fix this exact error you're seeing if you make the necessary change to your copy of the plugin's code and reload the web server.  Can you try that and see if it starts to work (or at least gets you farther)?

( 2 ) I have no clue how to patch, the install (can you point me in the right direction. I know it's a lot to ask but perhaps you might be so kind to list the steps ?. I wouldn't ask, but I've been working on this for days now..), which was :

You don't need to use git or github to apply the patch.  You'll just need to:

1) Find the location on your filesystem where the code for the TracGit plugin was installed.  I'm not sure where these files end up when you're on a Mac -- the easiest way to find it might just be to search your computer for a file called "PyGIT.py".  (Hopefully there will be only one result found.)
2) Open the PyGIT.py file in a text editor (you'll probably need to open it as root) and go to around line 184
3) You should see a line like "_, _, version = v.strip().split()"
4) Delete that line, and replace it with "version = v.strip().split()[2]"

Then save the file, reload the web server, and see if things start working and/or your trac logs change their error message.

-Ethan

mbs400

unread,
Jun 18, 2012, 10:33:45 PM6/18/12
to trac-...@googlegroups.com
I found out that an egg is basically a zip file, with some additional info about the egg. With that in mind I figured out how to edit the file.

In the beginning BBEdit wanted me to save a copy of the file until I found that by renaming the file, and unzipping it, I could the edit it. I am sure there must be an easier way to do this, but being new to git, and knowing nothing about python, I am content that I was able to get the changes made. However I still have the same problem as before.

$ locate TracGit
---> /Library/Python/2.7/site-packages/TracGit-0.12.0.5dev-py2.7.egg

$ cd /Library/Python/2.7/site-packages

$ ls -la
---> total 6840
---> drwxr-xr-x  9 root  wheel      306 Jun 18 20:14 .
---> drwxr-xr-x  3 root  wheel      102 Aug  2  2011 ..
---> -rw-r--r--  1 root  wheel   260631 May 31 17:18 Genshi-0.6-py2.7.egg
---> -rw-r--r--  1 root  wheel      119 May 30 21:36 README
---> -rw-r--r--  1 root  wheel  1551223 May 31 17:18 Trac-0.12-py2.7.egg
---> -rw-r--r--  1 root  wheel  1627674 May 31 17:19 Trac-0.12.3-py2.7.egg
---> -rw-r--r--  1 root  wheel    50823 Jun 18 19:56 TracGit-0.12.0.5dev-py2.7.egg
---> drwxrwxr-x  3 root  wheel      102 Jun 18 20:47 __MACOSX
---> -rw-r--r--  1 root  wheel      264 Jun 18 16:33 easy-install.pth

$ sudo mv TracGit-0.12.0.5dev-py2.7.egg TracGit-0.12.0.5dev-py2.7.zip

$ sudo unzip TracGit-0.12.0.5dev-py2.7.zip

$ sudo chmod -R 777 TracGit-0.12.0.5dev-py2.7

$ bbedit TracGit-0.12.0.5dev-py2.7

use bbedit to :

( 1 ) navigate to tracext/git/PyGIT.py

without the quotes:

( 2 ) search  : "_, _, version = v.strip().split()"
( 3 ) replace : "version = v.strip().split()[2]"

( 4 ) Save the file and quit out of bbedit

$ sudo chmod -R 644 TracGit-0.12.0.5dev-py2.7
$ sudo chown -R root:wheel TracGit-0.12.0.5dev-py2.7

$ zip -r TracGit-0.12.0.5dev-py2.7

$ sudo chmod 644 TracGit-0.12.0.5dev-py2.7.zip
$ sudo chown root:wheel TracGit-0.12.0.5dev-py2.7.zip

$ sudo mv TracGit-0.12.0.5dev-py2.7.zip TracGit-0.12.0.5dev-py2.7.egg

restarted the server, trac, etc, and I still get :

Warning: Can't synchronize with repository "(default)" (Unsupported version control system "git": Can't find an appropriate component, maybe the corresponding plugin was not enabled? ). Look in the Trac log for more information.


I am about to give up on this...

Peter Suter

unread,
Jun 19, 2012, 1:53:15 AM6/19/12
to trac-...@googlegroups.com
On 19.06.2012 00:24, Ethan Jucovy wrote:
> https://github.com/hvr/trac-git-plugin/pull/15
>
> There's a patch attached to that request which looks like it should fix
> this exact error you're seeing if you make the necessary change to your
> copy of the plugin's code and reload the web server. Can you try that
> and see if it starts to work (or at least gets you farther)?
>
> FWIW it looks like this bug hasn't yet been fixed in the version of the
> plugin bundled with Trac's development version, and also hasn't yet been
> reported in the Edgewall Trac.


FYI I filed http://trac.edgewall.org/ticket/10731 and applied the patch
to the bundled TracGit to be released with Trac 1.0.

--
Peter

Matthew Caron

unread,
Jun 19, 2012, 9:01:47 AM6/19/12
to trac-...@googlegroups.com
On 06/18/2012 06:44 PM, mbs400 wrote:
> ( 2 ) I have no clue how to patch, the install (can you point me in
> the right direction. I know it's a lot to ask but perhaps you might
> be so kind to list the steps ?. I wouldn't ask, but I've been
> working on this for days now..), which was :
>
> $ sudo easy_install http://github.com/hvr/trac-git-plugin/tarball/master

And that is the problem with easy installs. They hide complexity, so
what otherwise would be an intuitive learning curve becomes a crash
course. This is why we don't use them, and every plugin and the core
trac source is mirrored locally because we hack the crap out of them.
Anyway....

git clone https://github.com/hvr/trac-git-plugin.git
cd trac-git-plugin/
git remote add patch https://github.com/choey/trac-git-plugin.git
git fetch patch
git merge patch/master
python setup.py bdist_egg
cp dist/TracGit-0.12.0.5dev-py2.6.egg <wherever the egg goes>
<restart trac>
--
Matthew Caron, Build Engineer
Sixnet, a Red Lion business | www.sixnet.com
+1 (518) 877-5173 x138 office


mbs400

unread,
Jun 19, 2012, 1:17:44 PM6/19/12
to trac-...@googlegroups.com
Matthew,

This worked perfectly, thanks a million... 

Being new to GIT having the commands in the correct order is fantastic. I can now read up on these commands, and even though the general gist makes sense, it will actually be extremely helpful to read up on the process of patching. Not having worked with python before, I didn't realize is that it was an interpreted/compiled language. This has been really interesting, and I would have nerver gotten this working without all the great help. I can begin converting the other SVN repositories to GIT, throw away my subversion books and get some new git material to read...

Many thanks also to Ethan Jucovy, and Peter Suter for helping...

$ git clone https://github.com/hvr/trac-git-plugin.git 
$ cd trac-git-plugin/ 
$ git remote add patch https://github.com/choey/trac-git-plugin.git 
$ git fetch patch 
$ git merge patch/master 
$ python setup.py bdist_egg 

## sudo cp dist/TracGit-0.12.0.5dev-py2.6.egg <wherever the egg goes> 

$ sudo cp dist/TracGit-0.12.0.5dev-py2.7.egg /Library/Python/2.7/site-packages/

<restart trac> 
$ export TRAC_ENV_INDEX_TEMPLATE=/bh_repository/trac_support/templates/projects.html
$ /usr/local/bin/tracd --port=8000 -e /bh_repository/bh_trac --basic-auth=*,/bh_repository/bh_trac/.htpasswd,/bh_repository/bh_trac
Server starting in PID 983.
Serving on 0.0.0.0:8000 view at http://127.0.0.1:8000/

Using HTTP/1.1 protocol version
127.0.0.1 - - [19/Jun/2012 11:34:36] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [19/Jun/2012 11:34:39] "GET /git_net HTTP/1.1" 200 -

Bill Hernandez
Plano, Texas

Matthew Caron

unread,
Jun 19, 2012, 1:22:56 PM6/19/12
to trac-...@googlegroups.com
On 06/19/2012 01:17 PM, mbs400 wrote:
> Being new to GIT having the commands in the correct order is
> fantastic. I can now read up on these commands, and even though
> the general gist makes sense, it will actually be extremely
> helpful to read up on the process of patching.

Glad to be of service. git makes your brain hurt for the first month or
so, then you wondered how you lived without it. (The same could be said
for mercurial and others, which work similarly).
Reply all
Reply to author
Forward
0 new messages