3

I just recently upgraded my Trac system so we could handle multiple repositories. I started getting some browser errors and tracked it down to GitPlugin (when I disable it all of the errors go away, though of course my version control tracking does too).

On every page I get:

'Warning:  Error with navigation contributor "BrowserModule"'

and on the timeline page I get:

 Trac detected an internal error:

TypeError: 'NoneType' object is unsubscriptable

The Log gives me this for the timeline page out of 'main':

Internal Server Error: Traceback (most recent call last): File "/usr/local
/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/web/main.py", line 513, in 
_dispatch_request dispatcher.dispatch(req) File "/usr/local/lib/python2.6/dist-packages
/Trac-0.12-py2.6.egg/trac/web/main.py", line 235, in dispatch resp = 
chosen_handler.process_request(req) File "/usr/local/lib/python2.6/dist-packages/Trac-
0.12-py2.6.egg/trac/timeline/web_ui.py", line 142, in process_request available_filters += 
event_provider.get_timeline_filters(req) or [] File "/usr/local/lib/python2.6/dist-packages
/Trac-0.12-py2.6.egg/trac/versioncontrol/web_ui/changeset.py", line 861, in 
get_timeline_filters repositories = rm.get_real_repositories() File "/usr/local
/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/versioncontrol/api.py", line 588, in 
get_real_repositories repos = self.get_repository(reponame) File "/usr/local/lib/python2.6
/dist-packages/Trac-0.12-py2.6.egg/trac/versioncontrol/api.py", line 526, in 
get_repository repos = connector.get_repository(rtype, rdir, repoinfo.copy()) File 
"/usr/lib/python2.6/dist-packages/tracext/git/git_fs.py", line 159, in get_repository 
shortrev_len=self._shortrev_len) File "/usr/lib/python2.6/dist-packages/tracext
/git/git_fs.py", line 177, in __init__ Repository.__init__(self, "git:"+path, None, log)
 File "/usr/local/lib/python2.6/dist-packages/Trac-0.12-py2.6.egg/trac/versioncontrol
/api.py", line 730, in __init__ self.reponame = params['name'] TypeError: 'NoneType' 
object is unsubscriptable

and this for all pages out of 'Chrome':

Error with navigation contributor BrowserModule: TypeError: 'NoneType' object is unsubscriptable

I set up a few test environments before upgrading this system and they both worked with multi repositories and git, but with 2 key differences: they started as 0.12 and the repositories are not bare repositories.

My question is this: Did I mess something up when upgrading and need to start from a fresh environment, do I need to switch my repositories to non-bare, or am I missing something completely and need to do something else?

Alex Shepard
  • 216
  • 2
  • 10
  • 2
    I've managed to duplicate the error on my test machine, the bare repository is the failure. Apparently somewhere between trac 0.11 and 0.12 gitPlugin broke for bare repositories. I've considered a work around for it which involves playing with the git hooks. I'll post the results. – Alex Shepard Mar 10 '11 at 19:51
  • This is strange... I'm running trac 0.12.3 with bare repositories on debian and get this exact problem. At work we have the same setup, except it runs on windows under bitnami and I don't get this! – ingh.am Aug 05 '12 at 16:09

1 Answers1

6

All right, so I've managed to get a functioning work around.

Go into the server and create a new directory.

git clone the bare remote repository in that new directory.

go into the old repository and change the post-receive hook (under .git/hooks) to be:

#!/bin/sh
pushd /path/to/new/repo > /dev/null
unset $(git rev-parse --local-env-vars)
git pull -q
popd > /dev/null

If there is no post-receive just create a file with that file name.

Now go to your trac.ini and point any repository references to the new repository directory and poof! it works.

Note: the people who are pushing still push to the old repository. This script merely calls a pull from the "new" repository.

Alex Shepard
  • 216
  • 2
  • 10