Inconsistent SVN diff command output

Problem : The command svn diff

seems to be inconsistent when executed across the entire repository compared to executing in a single file.

Example : Consider committing r542208 of the Apache Tomcat source code.

svn log -v -r r542208 http://svn.apache.org/repos/asf/

Result:

------------------------------------------------------------------------
r542208 | fhanik | 2007-05-28 13:39:15 +0200 (H, 28 mΓ‘j. 2007) | 2 lines
Changed paths:
   M /tomcat/trunk/java/org/apache/catalina/connector/CometEventImpl.java
   M /tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
   M /tomcat/trunk/java/org/apache/catalina/connector/Request.java
   M /tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
   M /tomcat/trunk/java/org/apache/coyote/http11/Http11NioProtocol.java

Implement setTimeout using an Action instead of an attribute

------------------------------------------------------------------------

      

Now let's look at the source file /tomcat/trunk/java/org/apache/catalina/connector/Request.java

. Doing a wide variety of repositories gives some result.

svn diff -r r542207:r542208 http://svn.apache.org/repos/asf/tomcat

      

The related Request.java

part of the result is as follows:

===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java       (revision 542207)
+++ trunk/java/org/apache/catalina/connector/Request.java       (revision 542208)
@@ -2259,6 +2259,9 @@

     // ------------------------------------------------------ Protected Methods

+    protected void action(ActionCode actionCode, Object param) {
+        coyoteRequest.action(actionCode,param);
+    }

     protected Session doGetSession(boolean create) {

      

(There are other parts of the result.)

But if we only execute diff on this file, the result will be empty.

svn diff -r r542207:r542208 http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/connector/Request.java

      

I would expect the same result as above.

It is also strange that the above three lines are missing when listing this version of the original file, but there is a line above and below.

The question is : what can cause this strange behavior? Is there any option that maps the SVN base to another directory (like a branch)? Or maybe a later rename of the directory might cause this problem?

+3


source to share


1 answer


Alas, you are a victim of "Peg Revision Fallacy". For some time in its history, the file has Request.java

been replaced by another file with the same name. Therefore, you need to make sure that you also set the correct peg revision when requesting the repository, which is done by appending @revision

to the path in question. So the following command will give nothing (as you reported)

svn diff -r r542207:r542208 http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/connector/Request.java

      

but if you add the correct binding revision you will see the expected changes:



svn diff -r r542207:r542208 http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/connector/Request.java@542207

      

The version in which the original was removed Request.java

is the 573772

one in which the entire repository tree has been removed and replaced with another. More information can be found at http://svnbook.red-bean.com/en/1.8/svn.advanced.pegrevs.html .

+4


source







All Articles