Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I find the svn diff between working copy and arbitrary rev?

Tags:

I'm trying to write a multi-file patch for an open-source project, but the master copy has changed since I started working. I need to get the SVN difference (just the files under version control) between my uncommitted version and the revision from which it was checked. Which SVN command can I use to find the difference?

Edit: I'm sorry, I must have been using the term "working copy" improperly. I need to compare my uncommitted changes to the revision off which they are based. In other words, I checked out revision 1000 and changed files foo and bar. The rev number is now up to 1015, but I need to compare my version of foo and bar to the version of revision 1000. Is there an easy command to do this (compare my altered copy of a program with a past revision)?

like image 601
Evan Kroske Avatar asked Mar 04 '10 01:03

Evan Kroske


2 Answers

You can use -rN:M parameter with diff command which specifies the revisions you want to compare. Just provide revision from which your working copy was checked out (you can omit M as it defaults to working copy) and you should get what you need.

If you don't remember the original revision number try to run svn status -v and first column should show it.

More info svn help diff...

like image 131
Tom Avatar answered Sep 26 '22 15:09

Tom


svn diff takes a -rN:M argument which defaults to N == BASE and M == working copy. Will svn diff -r REV where REV is the revision you want not work?

To answer your edit, suppose you have the following:

$ ls
foo bar baz
$ svn st -u
Status against revision:    1071
$ echo "more stuff" >> foo
$ svn diff -r 1000 foo
Index: foo
===================================================================
--- foo  (revision 1000)
+++ foo  (working copy)
...

I believe this is what you are after, yes?

like image 36
ezpz Avatar answered Sep 26 '22 15:09

ezpz