mercurial api:repo.changectx(更改)不存在!
-
11-10-2019 - |
题
我正在尝试为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())
解决方案
我认为它需要当地的存储库才能这样工作。另外,您需要修订 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())
编辑: 此常见问题解答条目 似乎证实了它在远程存储库中不起作用。
不隶属于 StackOverflow