Mercurial API:repo.changectx(change)不存在!
我正在为一个Python的IDE制作一个Mercurial支持插件,但我在理解API时遇到了很多麻烦。目前我只是做一些实验,想搞清楚这个API中不同命令的用法,但我找不到API的文档或类似的东西。
我的问题是,r.changectx这个操作不起作用,因为r没有这个操作。而且我看到很多例子都在使用changectx这个函数。
我的Mercurial版本是1.7.3。非常感谢!!
from mercurial import ui, hg
r = hg.repository(ui.ui(), "https://ninja-ide.googlecode.com/hg/")
c = r.changectx("setup.py")
# show some information about the changeset
print c # represented as the changeset hash
print c.user()
print c.description()
print
# let's take a peek at the files
files = c.files()
for f in files:
fc = c[f]
print " ", f, len(fc.data())
1 个回答
3
我觉得要让它那样工作,需要一个本地的代码库。另外,你还需要为changectx
指定一个版本。
from mercurial import ui, hg, commands
myui = ui.ui()
repourl = "https://ninja-ide.googlecode.com/hg/"
commands.clone(myui, repourl, 'ninja')
r = hg.repository(myui, './ninja')
c = r.changectx("tip")
# show some information about the changeset
print c # represented as the changeset hash
print c.user()
print c.description()
print
# let's take a peek at the files
files = c.files()
for f in files:
fc = c[f]
print " ", f, len(fc.data())
补充:这个常见问题解答似乎也证实了它在远程代码库上是无法工作的。