'GitRepository' object has no attribute 'db_rev

33 views
Skip to first unread message

Mo

unread,
Jan 4, 2017, 11:04:42 AM1/4/17
to Trac Users
Hi,
recently I get this error when selecting a source changeset:


 Trac detected an internal error:
AttributeError: 'GitRepository' object has no attribute 'db_rev'

Most recent call last:

File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 554, in _dispatch_request
  dispatcher
.dispatch(req)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 257, in dispatch
 
self._post_process_request(req, *resp)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 388, in _post_process_request
  resp
= f.post_process_request(req, *resp)
File "build/bdist.linux-x86_64/egg/coderev/web_ui.py", line 81, in post_process_request
  reponame
, rev = repos.reponame, repos.db_rev(changeset.rev)



The source browser is ok and the git log on the repositories is working.
I have no idea what is causing this issue, and hints?

Best regards,
Mo

Peter Suter

unread,
Jan 4, 2017, 1:09:17 PM1/4/17
to trac-...@googlegroups.com
Hi,


On 04.01.2017 17:04, Mo wrote:
Hi,
recently I get this error when selecting a source changeset:


 Trac detected an internal error:
AttributeError: 'GitRepository' object has no attribute 'db_rev'

Most recent call last:

File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 554, in _dispatch_request
  dispatcher
.dispatch(req)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 257, in dispatch
 
self._post_process_request(req, *resp)
File "/usr/lib64/python2.7/site-packages/trac/web/main.py", line 388, in _post_process_request
  resp
= f.post_process_request(req, *resp)
File "build/bdist.linux-x86_64/egg/coderev/web_ui.py", line 81, in post_process_request
  reponame
, rev = repos.reponame, repos.db_rev(changeset.rev)
Looks like the error occurred here: https://trac-hacks.org/browser/codereviewerplugin/1.0/coderev/web_ui.py#L81
in the CodeReviewerPlugin. https://trac-hacks.org/wiki/CodeReviewerPlugin
You might want to open a ticket there.

That plugin might be incompatible with uncached Git repositories. It assumes

GitRepository.db_rev() exists, but it doesn't. db_rev() exists on CachedRepository subclasses, where changesets are cached in the database. https://trac.edgewall.org/browser/trunk/trac/versioncontrol/cache.py#L461

You could try using caching for Git:
[
git] cached_repository = true
You might have to setup hooks. https://trac.edgewall.org/wiki/TracGit#hooks

Best regards,
Peter

Mo

unread,
Jan 5, 2017, 8:24:39 AM1/5/17
to Trac Users
Hi,

https://trac.edgewall.org/wiki/TracGit#Troubleshooting
even says to disable caching. I have a bare repo as it takes less space. Didn't care about the caching so far, I just updated all my plugins like CodeReviewerPlugin, must be some bug introduced since my last version. I filed the bug here: https://trac-hacks.org/ticket/13029#ticket

Best regards,
Mo

Am Mittwoch, 4. Januar 2017 19:09:17 UTC+1 schrieb Peter Suter:

RjOllos

unread,
Jan 5, 2017, 8:39:08 AM1/5/17
to Trac Users


On Thursday, January 5, 2017 at 8:24:39 AM UTC-5, Mo wrote:
Hi,

https://trac.edgewall.org/wiki/TracGit#Troubleshooting
even says to disable caching. I have a bare repo as it takes less space. Didn't care about the caching so far, I just updated all my plugins like CodeReviewerPlugin, must be some bug introduced since my last version. I filed the bug here: https://trac-hacks.org/ticket/13029#ticket

Best regards,
Mo

You'll need to enable repository caching to use the plugin.

Prior to r16165 you wouldn't see the error, however the plugin wasn't working correctly. The plugin needs the tables created by a cached repository to exist.

Peter, do you know if this recommendation is still valid?:
  • If you don't see the shortrev and commit branch, you probably have caching enabled (cached_repository = truepersistent_cache = true). Set those to false.
- Ryan

 

Peter Suter

unread,
Jan 5, 2017, 1:07:27 PM1/5/17
to trac-...@googlegroups.com
On 05.01.2017 14:39, RjOllos wrote:

Peter, do you know if this recommendation is still valid?:
  • If you don't see the shortrev and commit branch, you probably have caching enabled (cached_repository = truepersistent_cache = true). Set those to false.

Honestly I have no idea. I added this recommendation in version 1 of the TracGit wiki page [1] when the Git plugin was being integrated into Trac, by copying seemingly relevant text from the th:GitPlugin wiki page [2]. There it was added by someone else [3] and I'm not sure what problem it's referring to, maybe just a common installation problem where the hooks are missing or misconfigured? Feel free to remove that line if the caching support is robust and "the way to go" now. I can't really say either way as I don't use Git that much myself.

[1] https://trac.edgewall.org/wiki/TracGit#Troubleshooting
[2] https://trac-hacks.org/wiki/GitPlugin#Troubleshooting
[3] https://trac-hacks.org/wiki/GitPlugin?sfp_email=&sfph_mail=&action=diff&version=69&old_version=68&sfp_email=&sfph_mail=


Peter

RjOllos

unread,
Feb 11, 2017, 12:55:25 AM2/11/17
to Trac Users
I went ahead and removed that. We can add it back if it becomes a known issue. 

- Ryan

RjOllos

unread,
May 19, 2021, 3:47:21 PM5/19/21
to Trac Users
Is explicit synchronization needed to use the persistent cache? I was looking at a Trac config that I didn't setup and it had:

[git]
cached_repository = false
persistent_cache = true

and no explicit synchronization. Recent commits were not being shown until I disabled persistent_cache.

Ryan

RjOllos

unread,
May 24, 2021, 7:24:03 PM5/24/21
to Trac Users
On Wednesday, May 19, 2021 at 12:47:21 PM UTC-7 RjOllos wrote:
Is explicit synchronization needed to use the persistent cache?

Looks like explicit synchronization or sync_per_request is needed otherwise the cache won't be refreshed after a commit:

Ryan
Reply all
Reply to author
Forward
0 new messages