通知挂钩抛出一个整数是必需的错误。为什么?

Notify hook is throwing an integer is required error .Why?

我正在使用 notCi 挂钩通知我的 CI server.This 没有给我任何关于

的问题

hg = 版本 2.2.1 OS = Linux Python2.6.6

但是

给我一个问题

hg = 版本 4.6.1 os = Linux Python2.7.5

我看来 hg 4.6.1 有变化 version.Any 想法?

 22 def notci(ui, repo, node=None, **kwargs):
 23     """Notify the continuous integration server about pushed changesets.
 24     """
 25
 26     (isRemote, uid) = __parse_url(kwargs['url'])
 27     if not isRemote:
 28         return False
 29
 30     ui.status(_('Not CI'))
 31     rel_repo = repo.root[len('/test/repo/'):]
 32     print rel_repo
 33     for rev in xrange(repo[node], len(repo)):
 34         cset = repo[rev]
 35         print cset
 36         curl = '/usr/bin/curl -d repo=/%s -d user=%s -d changeset=%s -d branch=%s http://jenkins.com'
 37         curl = curl % (rel_repo, uid, cset, cset.branch())
 38         print curl
 39         ui.status(_("  %s pushed changeset %s\n" % (uid, cset)))
 40         #ui.status(_("%s\n" % curl))
 41         if subprocess.call(curl, shell=True):
 42             ui.status(_("Could not notify service\n"))
 43             return False

Error : line 33, in notifyci for rev in xrange(repo[node], len(repo)): TypeError: an integer is required

我对此进行了更多探索,发现如果我从第 33 行删除 repo[node] 然后它移到下一个但没有给我正确的 changeset.It 看起来问题出在 repo[node]

repo[node] 返回的对象不能再隐式转换为整数。您需要显式获取修订号 user repo[node].rev()

第 33 行变为:

     for rev in xrange(repo[node].rev(), len(repo)):

(免责声明:我没有测试代码)