Mercurial pretxncommit hook - 仅在提交时执行,忽略rebase和patch

Art*_*lus 9 mercurial mercurial-hook

我们使用pretxncommithook for HG对提交的代码运行快速静态分析检查.但是,在对提交树应用任何更改时触发挂钩 - 包括重新绑定和使用MQ编辑和压缩提交.

是否有可能以某种方式检查钩子本身发生了什么类型的变化?喜欢

def analyze_hook(ui, repo, node=None, **kwargs):
    if repo.state.is_commit_added and not (repo.state.is_rebase or repo.state.is_patch):
        return 0
Run Code Online (Sandbox Code Playgroud)