What is the format of a patch file?

前端 未结 4 898
南旧
南旧 2020-12-08 06:11

What does the following mean ?

diff -rBNu src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java src/java/org/apache/nutch/analysis/NutchAnalysi         


        
4条回答
  •  無奈伤痛
    2020-12-08 06:46

    The old file name

    --- src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java 2009-03-10 11:34:01.000000000 -0700
    

    The new file name

    +++ src/java/org/apache/nutch/analysis/NutchAnalysisConstants.java  2009-03-10 14:11:55.000000000 -0700
    
    • -4: chunk begins at line 4 in old file (including context lines);
    • 9: number of lines in the chunk in old file including context lines (so total of lines that have a - or nothing in front of them);
    • +4: chunk begins at line 4 in the new file;
    • 12: number of lines in the chunk in new file including context lines (so total of lines that have a + or nothing in front of them).

    Notice: I changed the diff to include a modified line, so a deleted line followed by an added line.

    @@ -4,9 +4,12 @@
    
    +  int CJK = 21;
    +  int DIGIT = 22;
    
    -  int DEFAULT = 0;
    +  int DEFAULT = 42;
    
       String[] tokenImage = {
         "",
    +    "\"OR\"",
         "",
         "",
         "",
    

    Same as above, but notice the chunk in the new file starts 3 lines further because the previous chunk added a net worth of 3 lines.

    @@ -39,6 +42,8 @@
         "\"\\\"\"",
         "\":\"",
         "\"/\"",
    +    "\"(\"",
    +    "\")\"",
         "\".\"",
         "\"@\"",
         "\"\\\'\"",
    

提交回复
热议问题