【问题标题】:Mercurial changeset c++ analysisMercurial 变更集 C++ 分析
【发布时间】:2014-04-18 17:36:00
【问题描述】:

有什么方法可以分析 C++ mercurial 变更集以找出例如修改的函数或类吗?

我想统计一下代码某些部分的修订量:方法、类、文件、文件夹等。

【问题讨论】:

    标签: c++ mercurial analysis changeset


    【解决方案1】:

    不确定在使用 C++ 时这有多好,但 Mercurial 可以选择使用 git 格式差异。 git diffhg diff 都可以选择查看发生更改的函数...在 Mercurial 中,您可以使用 hg diff -p

    > hg diff
    diff --git a/sandbox/sandbox.cpp b/sandbox/sandbox.cpp
    --- a/sandbox/sandbox.cpp
    +++ b/sandbox/sandbox.cpp
    @@ -86,6 +103,8 @@
    ... diff output removed for conciseness
    
    > hg diff -p
    diff --git a/sandbox/sandbox.cpp b/sandbox/sandbox.cpp
    --- a/sandbox/sandbox.cpp
    +++ b/sandbox/sandbox.cpp
    @@ -86,6 +103,8 @@ int _tmain(int argc, _TCHAR* argv[])
    ... diff output removed for conciseness
    

    请注意,使用-p 选项,差异输出的每个块都包含包含函数(在本例中为_tmain)。请注意,新功能似乎不包含该信息。

    请注意,我不确定您将如何使用它。也许 grep 包含 @@.*\(.*\) 的行的输出以获取函数列表?

    【讨论】:

      【解决方案2】:

      VCS 通常与内容无关,它们只知道文本行,而对其他内容一无所知。为了增加了解 C 函数、C++ 类、FORTRAN 子例程/函数的负担,......最终出现在 emacs-land 中。不要去那里...

      【讨论】:

      • 谢谢,但我的建议是是否存在某种方法来分析变更集以获取函数/类或受影响的东西。这种方式可以使用多个工具,我不知道如何获得。
      猜你喜欢
      • 1970-01-01
      • 2011-07-23
      • 2010-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多