是否有某种方法可以分析 C++ mercurial 变更集以找出例如修改的函数或类?
我想统计某部分代码的修改量:方法、类、文件、文件夹等。
最佳答案
不确定这在使用 C++ 时有多好,但 Mercurial 可以选择使用 git 格式差异。 git diff
和 hg 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
选项,diff 输出的每个 block 都包含包含函数(在本例中为 _tmain
)。请注意,新函数似乎不包含该信息。
请注意,我不确定您将如何使用它。也许 grep 包含 @@.*\(.*\)
的行的输出以获得函数列表?
关于c++ - Mercurial changeset c++分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22387873/