Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to get svn diff of current and previous revision number

How can I get diff in file content of current and previous revision number by command line?

And how can I get previous revision number?

like image 877
Pavan Tiwari Avatar asked May 16 '12 12:05

Pavan Tiwari


People also ask

How do you find the difference between two svn revisions?

Display the differences between two paths. The ways you can use svn diff are: Use just svn diff'to display local modifications in a working copy. Display the changes made to TARGET s as they are seen in REV between two revisions.

How do I compare to previous version in svn?

If you want to see the difference between the last committed revision and your working copy, assuming that the working copy hasn't been modified, just right click on the file. Then select TortoiseSVN → Diff with previous version.

Which command is used to show the difference between two revisions?

The diff command is used to compare different revisions of files.

How do I find old revision in svn?

On the file, simply right-click => Team => Switch to another branch/tag/revision. Besides the revision field, you click select, and you'll see all the versions of that file.


2 Answers

svn diff -r HEAD <item> if you want to get the difference between your working copy and the last committed revision.

svn diff -r PREV:COMMITTED <item> if you want to see what the last commit did.

You should take look at Revision Keywords.

svn info <item> will give you (among other things) the last change revision for the item.

like image 100
Konerak Avatar answered Oct 18 '22 01:10

Konerak


As per your comments you'd like to see differences between the current and previous versions of an item that is not in your working copy. For that you need to know the item's URL (e.g. svn://[repo_root]/[path]/[item]) which I assume you do. Then you do the following:

svn info <item-URL> 

will contain (among other things) the last change revision. With that revision number R you run:

svn diff -c <R> <item-URL> 

and it will give you the last commit diff.

like image 43
malenkiy_scot Avatar answered Oct 18 '22 00:10

malenkiy_scot