我正在开发一个包含预提交挂钩的扩展。我希望能够在我的钩子中接收一个新选项。但是,如果我使用文档中的 cmdtable 示例添加它,替换对现有提交命令的引用,它只会覆盖内置选项。这样做的正确方法是什么?
1 回答
1
这可以通过使用extensions.wrapcommand
:
def commit(originalcommit, ui, repo, **opts):
return originalcommit(ui, repo, **opts)
def uisetup(ui):
entry = extensions.wrapcommand(commands.table, "commit", commit)
entry[1].append(('', 'newcommitoption', None, ('Description for the new commit option')))
于 2011-10-21T21:29:33.597 回答