42

I need to get the changed files list between two revisions in SVN.

I have used the following command:

svn diff -r 5001:6001 --summarize https://svn.blah.com/../  > output.txt

For some reason, the files modified on revision 5001 are not populated in the output text file.

What is the exact command to extract the files list between the two revisions (inclusive of from and to revisions, that is, including revision 5001 and revision 6001)?

Abhijeet Kasurde
  • 3,937
  • 1
  • 24
  • 33
Madhan
  • 1,291
  • 3
  • 21
  • 34

5 Answers5

55

Try svn diff -r 5000:6001 instead. To understand this, consider the following: what would the output of svn diff -r 100:100 look like? It would show no changes, because the revisions are the same. To see the changes for revision 100, we must use -r 99:100.

jpaugh
  • 6,634
  • 4
  • 38
  • 90
Dirk-Willem van Gulik
  • 7,566
  • 2
  • 35
  • 40
  • 7
    Right - as there is no difference between 100 and 100 - they are identical. By definition. Hence if you want to know the difference in your 5001:6001 inclusive of 5001 one needs to do a -r 5000:6001. – Dirk-Willem van Gulik Feb 08 '12 at 10:38
11

Try svn log -r 5000:6001 -v to get the list of files. This gives list of files categorized by revision no. So, one can have better idea on what files went in what revision at a glance.

subbu
  • 524
  • 6
  • 16
  • I needed a list of the files that had changed between two arbitrary revisions and this worked for me, while the diff -r suggestion, with --summarize or not listed all the files in the repo. Perhaps I'm missing something? – Tony Adams Jan 14 '14 at 19:39
  • Be careful about the output of this when there are revisions coming from merges. Experience an issue today where the output looked like /branch/abc/new_file.js (from trunk/new_file.js:12344). In my experience you are always better of using --xml if you are planning consuming this data as the input of something else. – MattSaw Sep 14 '16 at 13:49
8

Dirk-Willem van Gulik's answer is perfect if you want all changes. However if you want only the list of files changed append --summarize switch to your command,

svn diff -r 13447:HEAD
8

svn diff -r v1:v2 --summarize | awk '{print $2}' > filelist.txt

Explanation:

svn diff -r v1:v2 --summarize provides you the status and the name of the file separated by a tab character. You need to select the string after the tab character - the second field. You can do that using awk and redirect the output to filelist.txt

Ankur
  • 2,171
  • 23
  • 29
-1
svn diff -r 5001:6001 ...local path hier ...  > output.txt
ProgramFOX
  • 6,131
  • 11
  • 45
  • 51