How can svn diff find out the diff file when I add and delete over and over again

StackOverflow https://stackoverflow.com/questions/21110855

  •  27-09-2022
  •  | 
  •  

Question

I use

svn diff -r $new:$old $file --summarize

to find out if the $file change between $new and $old. But if I add and delete the file over and over again. such as

  1. add $file revision 230

  2. delete $file revision 231

  3. add $file revision 232

while the $file added at 230 and 232 is the same path and same name but different content, then call

svn diff -r $230:$232 $file --summarize

svn show nothing changed while I expect a result that tell me $file is modified.

How can I fix this problem?

Was it helpful?

Solution

First off, the --summarize option has a specific purpose that is mainly when comparing trees of files. It is to just show the list of files with differences as opposed to the detailed diff for each file. It has no value when used for a single file.

Second, diff is always simply comparing two snapshots of a file or tree. It does not care how the file got into the state it is in, just what it looks like in the snapshot. So for example, if you remove a block of code in one revision, add it back in the next, then change one line in a third. And then do a diff of the current revision with the code before all of this, it would only show one line of code as changed. It does not consider any of the changes that happened in between.

If you are looking to see all of the changes in a revision range, you want to use svn log.

OTHER TIPS

Though you are adding files with same name, SVN will internally consider it as two entities. So your command is trying to find the revision deference of the file between revisions 231 and 232, where at revision 231 the current file is not even present in SVN. You have to do svn diff on the parent folder in this case instead of on the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top