19

I would like to see the changes that my co-workers have made before I accept the incoming changes.

So I start by getting the status

svn st -u

...which tells me that I've got an incoming change

    *     9803   incomingChanges.html
M         9803   localChanges.html
M   *     9803   localAndIncoming.html

I can see what I've changed

svn diff localChanges.html

...but how can I diff localAndIncoming.html to show what has been changed, and how it's different than my working copy?

3
  • Not an answer to your command line question, but: in the end, once you know what is different from your working copy, you'll probably want to merge the repository changes with your own changes. When using some GUI to do so, why not use a GUI to help you do the initial diff as well? Tools like TortoiseSVN offer such compare. Also, IDEs like Eclipse can make reviewing incoming changes (even when there's nothing to merge -- nice to get an idea of what your coworkers have been up to) very easy, avoiding automatic merges.
    – Arjan
    Jun 12, 2010 at 12:08
  • 1
    Is there a GUI way of seeing incoming changes using TortoiseSVN?
    – Christian
    Dec 20, 2010 at 14:48
  • You'd also want to diff incomingChanges.html as well, no?
    – khatchad
    Sep 10, 2013 at 20:59

6 Answers 6

21

I believe what you need is:

svn diff -rBASE:HEAD
2

FYI svn diff gives a diff based on the unmodified file stored in the .svn directory, not based on the live repo version.

You can run svn update to get subversion to attempt an update (and possibly merge) and then do an svn diff, but that's not as clean as I guess you want.

Finally svn diff does support diffing just on the repo. Example:

svn diff svn://svnserver/repo/localChanges.html -r REV_NO

Which defaults to comparing HEAD with the passed revision.

2

With tortoisesvn (if you use windows)

  • Invoke the log screen

  • Select head revision

  • Right click on localAndIncoming.html

  • Choose Compare with working copy

0

You really can't until you actually download the new version. Limitations like this were one of the big reasons why a new type of source control has become popular lately. It's called decentralized source control.
With this new form you have your own local repository, and you can then take changes from the main repository and run a diff on it, if you don't like the changes made you can revert your own repository and go from there.

http://mercurial.selenic.com/

And yeah, I know suggesting you switch products isn't an optimal solution, but it is a solution none the less.

0

Do another checkout in a fresh folder.

cd ..
svn checkout  /path/to/repo clean_working_copy

If you reuse clean_working_copy do not forget to update before

svn update clean_working_copy

Then compare your file with the one from clean_working_copy

diff your_working_copy/localAndIncoming.html clean_working_copy/localAndIncoming.html

Or with your prefered 3-way diff (mine is kdiff3)

kdiff3 --L1 Base --L2 theirs --L3 mine your_working_copy/.svn/text-base/localAndIncoming.html clean_working_copy/localAndIncoming.html your_working_copy/localAndIncoming.html
1
  • This work, but a scm should provide a more integrated way.
    – rds
    Oct 21, 2011 at 9:34
0

I think

svn diff -r HEAD

almost gives what you want. The only thing is that the + and - are reversed relative to what you expect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .