hg clone error raise keyerror(key)

时间:2011-04-28 05:25:32

标签: mercurial mercurial-hook

我有一个主要的mercurial repo和一个远程克隆repo。在初始克隆之后,我将一个pretxnchangegroup钩子函数添加到主repo中。钩子函数使用os.environ["REMOTE_USER"]来检索经过身份验证的用户。当我从之前克隆的远程仓库执行hg push时,钩子函数按预期工作。当我尝试新克隆时出现问题。我收到以下错误

File "/usr/lib/pymodules/python2.6/mercurial/localrepo.py", line 2048, in addchangegroup
  url=url, pending=p)
File "/usr/lib/pymodules/python2.6/mercurial/localrepo.py", line 145, in hook
  return hook.hook(self.ui, self, name, throw, **args)
File "/usr/lib/pymodules/python2.6/mercurial/hook.py", line 139, in hook
  r = _pythonhook(ui, repo, name, hname, hookfn, args, throw) or r
File "/usr/lib/pymodules/python2.6/mercurial/hook.py", line 68, in _pythonhook
  r = obj(ui=ui, repo=repo, hooktype=name, **args)
File "/usr/lib/python2.6/pushvalidation.py", line 18, in chkaccess
  username = os.environ["REMOTE_USER"]
File "/usr/lib/python2.6/UserDict.py", line 22, in __getitem__
  raise KeyError(key)
KeyError: 'REMOTE_USER'

pushvalidation.py是位于主repo的全局hgrc中的进程内pretxnchangegroup钩子。

我刚刚开始使用Mercurial,这是我写的第一个大钩子函数。

0 个答案:

没有答案