【问题标题】:How to get C++ function names in hg diffs?如何在 hg diffs 中获取 C++ 函数名称?
【发布时间】:2023-04-07 08:44:01
【问题描述】:

我想在一个文件中获取 C++ 函数名。我尝试使用命令 diff 执行此操作,因为我只需要获取已修改但无法获取的函数的名称。 我知道对于 python 文件,可以使用带有选项 'git diff file.py' 的 git。 是否可以在 Mercurial 中使用 c++ 文件?

【问题讨论】:

  • git diff -p 不会列出任何语言的函数,它会生成一个补丁文件。 (和git diff一样)

标签: c++ mercurial diff


【解决方案1】:

我认为您正在寻找配置选项diff.showfunc。文档 (hg help config) 说:

"showfunc"
    Show which function each change is in.

它适用于 Python 函数,我认为启发式算法应该同样适用于 C++ 文件。也许它需要缩进函数体才能正确检测 C++ 函数。

【讨论】:

    猜你喜欢
    • 2014-05-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-10
    • 2011-10-26
    • 1970-01-01
    相关资源
    最近更新 更多