如何查找 CVS 版本之间更改的行数?
我花了一天的大部分时间对我们的一个项目的代码库进行一些基本的内务更改(用 log4j 替换所有 System.out.println()
调用)。
我有点好奇我用这组更改更新了多少行代码。
无论如何,是否可以使用 cvs diff 或其他命令来准确计算已更改的行数?
我试图
cvs diff -b -B -R
获取工作目录(以及递归子目录)中的所有更改,但对于每个更改的文件,它还会打印出文件/版本信息,这使得仅计算输出行数毫无用处。
有任何想法吗?
I've spent most of the day making what are basically some housekeeping changes to the codebase of one of our projects (replacing all System.out.println()
calls with log4j).
I'm kind of curious how many lines of code I've updated with this set of changes.
Is there anyway with cvs diff
or another command to get an accurate count of how many lines have changed?
I've tried
cvs diff -b -B -R
to get all of the changes in the working directory (and recursively the subdirectories), but for each file changed it also prints out file/version information, which makes just counting the lines of output useless.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
diffstat 实用程序是一个很好的工具,用于从 cvs、svn 或其他差异的输出中获取一些简单的指标。
The diffstat utility is a nice tool for getting some simple metrics from the output of cvs, svn or other diffs.
从 diff 输出中过滤掉多余的行,然后对行进行计数。
例如,grep 仅以 < 开头的行 或>
Filter out extra lines from the diff output and then count the lines.
For example, grep only lines starting with < or >
您可以简单地将 cvs diff 的输出传输到 diffstat。
You can simply pipe output of cvs diff to diffstat.
验证您是否已使用类似以下内容更改了所有实例怎么样:
这应该给您零。
然后用“log4j”替换第二个egrep中的正则表达式应该让 wc -l 返回您更改的行数。
HTH。
干杯,
罗布
What about verify that you've changed all instances with something like:
that should give you zero.
Then replacing the regex in the second egrep with 'log4j' should have wc -l returning the number of lines you've changed.
HTH.
cheers,
Rob