cvs diff的输出格式

发布于 2024-12-08 22:01:18 字数 728 浏览 0 评论 0原文

我修改了某个文件的第 494 行,并使用 cvs diff -u4 来查看我修改的内容,cvs 输出如下所示:

@@ -490,9 +490,9 @@         
if (!(hPtr->hStatus & (HOST_STAT_UNAVAIL | HOST_STAT_UNLICENSED |
                       HOST_STAT_UNREACH))){ 
            printf(" %s:\n",
            _i18n_msg_get(ls_catd,NL_SETN,1612, "CURRENT LOAD USED FOR SCHEDULING")); /* catgets  1612  */
    -       prtLoad(hPtr, lsInfo);
    +       prtLoad(hPtr, lsInfo,bhostParams);

            if (lsbSharedResConfigured_) {
            /* there are share resources */
            retVal = makeShareFields(hPtr->host, lsInfo, &nameTable,

我不明白第一行“@@ -490,9 +490,9 @@”是什么意思是,我确实修改了第 494 行,但是为什么 CVS 写的是 490 呢?谁能告诉我“@@ -490,9 +490,9 @@”是什么意思?

I modified line 494 of a certain file, and use cvs diff -u4 to see what I have modified, cvs outputs something like :

@@ -490,9 +490,9 @@         
if (!(hPtr->hStatus & (HOST_STAT_UNAVAIL | HOST_STAT_UNLICENSED |
                       HOST_STAT_UNREACH))){ 
            printf(" %s:\n",
            _i18n_msg_get(ls_catd,NL_SETN,1612, "CURRENT LOAD USED FOR SCHEDULING")); /* catgets  1612  */
    -       prtLoad(hPtr, lsInfo);
    +       prtLoad(hPtr, lsInfo,bhostParams);

            if (lsbSharedResConfigured_) {
            /* there are share resources */
            retVal = makeShareFields(hPtr->host, lsInfo, &nameTable,

I didn't understand what the first line "@@ -490,9 +490,9 @@" mean, I did modify line 494, but why CVS writes 490 instead? Could anyone tell me what does "@@ -490,9 +490,9 @@" mean?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

撕心裂肺的伤痛 2024-12-15 22:01:18

“u”为您提供 统一差异 和“4”为您提供两侧 4 行上下文。从我刚刚链接的 WP 条目中:

范围信息行的格式如下:

<前><代码>@@ -l,s +l,s @@

块范围信息包含两个块范围。范围为
原始文件的块前面有一个减号,并且范围
对于新文件,前面有一个加号。每个大块范围是
格式 l,s 其中 l 是起始行号,s 是行号
更改块适用于每个相应文件的行数。

所以基本上这个数字不是被改变的行。这是该块中显示的范围的开始。使用您的示例,该块从第 490 行开始,并且该范围内有 9 行。范围涵盖 9 行的原因是因为您更改了一行以及两侧的四行上下文。

请注意,您的示例似乎删除了一些换行符。我建议您修复它,以便其他人清楚地了解。

The "u" gives you a unified diff and the "4" give you 4 lines of context on either side. From the WP entry I just linked:

The format of the range information line is as follows:

@@ -l,s +l,s @@

The hunk range information contains two hunk ranges. The range for the
hunk of the original file is preceded by a minus symbol, and the range
for the new file is preceded by a plus symbol. Each hunk range is of
the format l,s where l is the starting line number and s is the number
of lines the change hunk applies to for each respective file.

So basically the number isn't the line that was changed. It's the start of the range being displayed in that hunk. Using your example, the hunk starts at line 490 and 9 lines were in the range. The reason the range covers 9 lines is because of the one line you changed and the four lines of context on either side.

Note that your example seems to have some newlines stripped. I would recommend you fix it so it is clear for other people.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文