我在我的项目中使用 python mercurial API。
from mercurial import ui, hg, commands
from mercurial.node import hex
user_id = ui.ui()
hg_repo = hg.repository(user_id, '/path/to/repo')
hg_repo.ui.pushbuffer()
some_is_coming = commands.incoming(hg_repo.ui, hg_repo, source='default',
bundle=None, force=False)
if some_is_coming:
output = hg_repo.ui.popbuffer()
In [95]: output
Out[95]: 'comparing with ssh:host-name\nsearching for changes\nchangeset: 1:e74dcb2eb5e1\ntag: tip\nuser: that-is-me\ndate: Fri Nov 06 12:26:53 2015 +0100\nsummary: added input.txt\n\n'
提取短节点信息e74dcb2eb5e1
将很容易。然而,我真正需要的是 40 位十六进制修订 ID。有没有办法在不先拉回购的情况下检索这些信息?