Mercurial API:repo.changectx(change) 不存在!

发布于 2024-10-12 15:33:41 字数 605 浏览 1 评论 0原文

我正在尝试为 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())

i'm trying to make a Mercurial support plugin for a Python IDE and i have a lot of troubles understanding the API. Right now i'm only making experiments for understanding the uses of the different commands of the api, but i can't find the api's doc or anything like it.

My problem is that r.changectx doesn't work because r hasn't this operation. And i see a lot of examples that use the changectx function.

My mercurial version is 1.7.3 . Thanks a lot !!

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())

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

再可℃爱ぅ一点好了 2024-10-19 15:33:41

我认为它需要一个本地存储库才能像这样工作。此外,您还需要对 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())

编辑:此常见问题解答条目 似乎证实它不适用于远程存储库。

I think it needs a local repo for it to work like that. Also, you need a revision for 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())

Edit: this FAQ entry seems to corroborate that it won't work on remote repositories.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文