补丁文件的格式是什么? [英] What is the format of a patch file?

查看:228
本文介绍了补丁文件的格式是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是什么意思?

diff -rBNu src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java src/java/org/apache/nutch/analysis/NutchAnalysisConstants.java
--- src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java 2009-03-10 11:34:01.000000000 -0700
+++ src/java/org/apache/nutch/analysis/NutchAnalysisConstants.java  2009-03-10 14:11:55.000000000 -0700
@@ -4,9 +4,12 @@

+  int CJK = 21;
+  int DIGIT = 22;

   int DEFAULT = 0;

   String[] tokenImage = {
     "<EOF>",
+    "\"OR\"",
     "<WORD>",
     "<ACRONYM>",
     "<SIGRAM>",
@@ -39,6 +42,8 @@
     "\"\\\"\"",
     "\":\"",
     "\"/\"",
+    "\"(\"",
+    "\")\"",
     "\".\"",
     "\"@\"",
     "\"\\\'\"",

推荐答案

您使用的 -u 选项指定了统一格式.在这种格式中,前两行是标题:--- 是原始文件,+++ 是新文件,以及时间戳.

The -u option you used specifies the unified format. In that format the first two lines is a header: --- is the original file, +++ is the new file, and the timestamps.

然后是以 @@ -R,r +R,r @@ 语法开头的块(更改块).

That is then followed by chunks (change hunks) that starts with the @@ -R,r +R,r @@ syntax.

这是两个范围,一个带有-的是原始文件中chunk的范围,一个带有+的是新文件中的范围.R 指定开始差异操作的行号.

Those are two ranges, the one with the - is the range for the chunk in the original file, and the one with the + the range in the new file. The R designates the line number where the diff operation is started.

逗号后面的数字是每个文件中受影响的行数.

  • 每次删除一行,+r 的数字都会小于-r.
  • 每次添加一行,+r的数字都会大于-r
  • 更改一行会将 0 添加到 +r 数字.(相同范围的行)
  • Every time you remove a line, the +r number will be smaller than -r.
  • Every time you add a line, the +r number will be bigger than -r
  • Changing a line will add 0 to the +r number. (same scope of lines)

在这些块中,行被标识为添加或删除 - 表示删除,+ 表示添加.在那个块中没有改变的行不会有 +- 前面.

Within these chunks lines are identified as additions or deletions - means delete, + means addition. Lines that did not change in that chunk will have neither + or - front of it.

在您的示例中,这意味着有两个块或部分在两个文件之间发生了变化,其中带有 + 的行是新添加的行,没有删除任何内容.

In your example it means there are two chunks, or sections, that changed between the two files and the lines with + in it are the new ones added, nothing was deleted.

你可以通过谷歌搜索统一差异来找到更多关于语法的信息.

You can find much more information about the syntax by doing a google search for unified diff.

这篇关于补丁文件的格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆