2

我正在运行一个 rhodecode 实例进行代码审查等。但是当我通过 ssh 推送时,rhodecode 看不到变更集(除非我从 hgweb 手动提取)。

我是否需要 mercurial 中的传入钩子或其他东西才能使 rhodecode 正常工作?

编辑

通过添加钩子incoming.rhodecode = python:rhodecode.lib.hooks.log_push_action,我得到了堆栈跟踪:

remote:   File "/usr/share/mercurial-server/hg-ssh", line 91, in <module>
remote:     dispatch.dispatch(request(['-R', repo, 'serve', '--stdio']))
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 65, in dispatch
remote:     return _runcatch(req)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 88, in _runcatch
remote:     return _dispatch(req)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 741, in _dispatch
remote:     cmdpats, cmdoptions)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 514, in runcommand
remote:     ret = _runcommand(ui, options, cmd, d)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 831, in _runcommand
remote:     return checkargs()
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 802, in checkargs
remote:     return cmdfunc()
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/dispatch.py", line 738, in <lambda>
remote:     d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/util.py", line 472, in check
remote:     return func(*args, **kwargs)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/commands.py", line 5211, in serve
remote:     s.serve_forever()
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/sshserver.py", line 94, in serve_forever
remote:     while self.serve_one():
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/sshserver.py", line 112, in serve_one
remote:     rsp = wireproto.dispatch(self.repo, self, cmd)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/wireproto.py", line 351, in dispatch
remote:     return func(repo, proto, *args)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/wireproto.py", line 629, in unbundle
remote:     lock.release()
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/lock.py", line 143, in release
remote:     callback()
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/localrepo.py", line 2452, in runhooks
remote:     source=srctype, url=url)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/localrepo.py", line 386, in hook
remote:     return hook.hook(self.ui, self, name, throw, **args)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/hook.py", line 181, in hook
remote:     r = _pythonhook(ui, repo, name, hname, hookfn, args, throw) or r
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/hook.py", line 38, in _pythonhook
remote:     obj = __import__(modname)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/demandimport.py", line 95, in _demandimport
remote:     return _import(name, globals, locals, fromlist, level)
remote:   File "/usr/local/lib/python2.7/dist-packages/rhodecode/lib/hooks.py", line 35, in <module>
remote:     from rhodecode.lib.utils import action_logger
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/demandimport.py", line 114, in _demandimport
remote:     mod = _origimport(name, globals, locals)
remote:   File "/usr/local/lib/python2.7/dist-packages/rhodecode/lib/utils.py", line 55, in <module>
remote:     from rhodecode.model.db import Repository, User, RhodeCodeUi, \
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/demandimport.py", line 114, in _demandimport
remote:     mod = _origimport(name, globals, locals)
remote:   File "/usr/local/lib/python2.7/dist-packages/rhodecode/model/db.py", line 147, in <module>
remote:     class RhodeCodeSetting(Base, BaseModel):
remote:   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative.py", line 1343, in __init__
remote:     _as_declarative(cls, classname, cls.__dict__)
remote:   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/ext/declarative.py", line 1082, in _as_declarative
remote:     class_mapped = _is_mapped_class(base)
remote:   File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/util.py", line 696, in _is_mapped_class
remote:     manager = attributes.manager_of_class(cls)
remote:   File "/usr/local/lib/python2.7/dist-packages/mercurial/demandimport.py", line 87, in __getattribute__
remote:     return getattr(self._module, attr)
remote: AttributeError: 'module' object has no attribute 'manager_of_class'
abort: unexpected response: empty string
4

1 回答 1

3

RhodeCode 使用 post-push 挂钩来使存储库的缓存无效,并将 push/pull 事件存储在它的日志中。你可以做一些事情来克服这个问题。

  • 禁用 vcs_full_cache,并将缓存过期时间调低到某个较低的数值(例如 60 秒)
  • 通过 SSH 推送时调用正确的 RhodeCode 钩子,我认为这是最合适的解决方案
于 2013-01-08T23:02:28.510 回答