0
我想在pre-commit-hook中检查用户名。在命令行中,我想实现看起来是这样的:如何使用内部Mercurial API获取两个修订之间的变更集列表?
hg log -r "$HG_NODE:tip" --template "{author}\n"
如何使用内部水银API达到同样的?
我想在pre-commit-hook中检查用户名。在命令行中,我想实现看起来是这样的:如何使用内部Mercurial API获取两个修订之间的变更集列表?
hg log -r "$HG_NODE:tip" --template "{author}\n"
如何使用内部水银API达到同样的?
假设你已经想通了如何获得回购对象,用稳定的版本,你可以这样做:
start = repo[node].rev()
end = repo['tip'].rev()
for r in xrange(start, end + 1):
ctx = repo[r]
print ctx.user()
在开发分支,你可以这样做:
for ctx in repo.set('%s:tip', node): # node here must be hex, use %n for binary
print ctx.user()
还要注意'node :: tip'(两个冒号)可能是'between'中更有用的定义:它包含节点的所有后代和tip的所有祖先,而不仅仅是数字排序。
最后,确保你已经了解这里使用的内部API的所有注意事项:
https://www.mercurial-scm.org/wiki/MercurialApi
...并考虑使用python-hglib代替:
那么,我需要在节点(包括)之后添加的所有变更集。所以严格的数字排序实际上就是我需要的。 –