Reputation: 1305
Is there an easy way to compare a given revision to its last change? I'm looking or a shortcut similar to svn diff file.ext -PREV:HEAD
, but with prev relative to a given revision number instead of HEAD.
For example:
Suppose I have a repository on at r10 and file that has been modified in r1, 2, 3, 8, 9. svn diff -rPREV:HEAD
will give me a diff of r8:10, which is essential the same as r8:9. But if I want a diff of 8 vs its previous state (r3) is there any way to diff without looking at its log, seeing when it was changed and explicitly specifying r3? -rPREV:8 would be diffing r8 to r8.
Upvotes: 0
Views: 94
Reputation: 1305
expanding on @Ben Reser's suggestion to use svn log --diff
If given a file at r911, and its last change between r900 and r901 (file@r911 is the same as file@r901 and file@901 is different than file@r900)
svn log filename --diff -r911:0 --l 1
will return the diff between r901:900, which is essentially the same as diff r911:900
Upvotes: 1
Reputation: 5765
You're overthinking this. In your example a file changes in r1, 2, 3, 8, and 9. You don't need to specify svn diff -r 3:8 file.ext
to get the changes made in revision 8, you can do svn diff -r 7:8 file.ext
to do that. Since the file wasn't changed in revision 7 it will be the same as the file in 3. To make it even easier Subversion provides the -c
flag which does the subtraction for you. So in your example you can just use svn diff -c 8 file.ext
Upvotes: 2
Reputation: 28194
To go back further than you're currently doing with PREV
, you will need to know the revision numbers themselves.
Note that PREV
only works when you're referencing a working copy in the first place (and therefore if that WC isn't fully up to date, PREV
may not be what you think it should be), so you'll have to know revision numbers anyway if you're working with repository URLs.
Upvotes: 0