77

So I want to compare this folder http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ with this http://svn.boost.org/svn/boost/sandbox/boost/extension/. I want to get a diff file as a result. These folders are under svn control but I'd prefer git styled diff file (like one shown here) I tried git diff but it seems not to work that way for web folders. So how to do the same thing with one command on Linux?

Update: So we had a great answer. But it works strangely - it seems to me it shows that all files (same files) have all theire contents replaced with very same contents (while I know for sure that there were only like 3-4 code lines changed at all)...

Update 2: To achieve what I really needed (dif file with only really changed lines, with git styling, on Linux) do:

$ svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2 --native-eol CRLF
$ svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos --native-eol CRLF
$ git diff repos repos2 > fileWithReadableDiff.diff
Community
  • 1
  • 1
Rella
  • 59,216
  • 102
  • 341
  • 614
  • 2
    haha; I just noticed you linked to my diff with [`one shown here`](http://stackoverflow.com/questions/5836948/boost-extension-simple-inheritance-sample-why-we-see-no-animals-on-linux/5838527#5838527)... wotta coincidence – sehe May 03 '11 at 21:06

2 Answers2

160

Once you have the source trees, e.g.

diff -ENwbur repos1/ repos2/ 

Even better

diff -ENwbur repos1/ repos2/  | kompare -o -

and have a crack at it in a good gui tool :)

  • -Ewb ignore the bulk of whitespace changes
  • -N detect new files
  • -u unified
  • -r recurse
sehe
  • 328,274
  • 43
  • 416
  • 565
  • so... yep - loved your [`diff style`](http://stackoverflow.com/questions/5836948/boost-extension-simple-inheritance-sample-why-we-see-no-animals-on-linux/5838527#5838527), sent a full diff patch on yours+mine boost.extension to Jeremy... (see this post update for my way of getting it)... I still wonder how to do such thing with one line=) – Rella May 04 '11 at 11:03
  • Well thanks for the accept; I guess my [original (rev. 2) instructions](http://stackoverflow.com/posts/5849377/revisions#spacer-4f409b65-3284-40a8-99db-770fdbc477be) in that other post hid my secret: I used 'git svn clone ... http://svn..../branches/v0.4' and just edited locally. It then becomes a simple `git diff` or git `format-patch` depending on how much work was done – sehe May 04 '11 at 11:14
  • didn't know about kompare before, this is exactly what I was looking for. Thanks – Erin Jan 05 '16 at 19:11
  • 2
    would be nice to add a reference to `kompare` as it's an external package (at least on my Ubuntu 16.04) – gilad mayani Jun 14 '19 at 11:32
  • 1
    You can totally use notepad++ with Language set on "Diff" it works like a charm (without kompare) – Hybris95 Jan 22 '20 at 09:20
  • @Hybris95 does that do side-by-side diffs? Personally, I don't take to context/unified diffs too well – sehe Jan 22 '20 at 16:55
4

You urls are not in the same repository, so you can't do it with the svn diff command.

svn: 'http://svn.boost.org/svn/boost/sandbox/boost/extension' isn't in the same repository as 'http://cloudobserver.googlecode.com/svn'

Another way you could do it, is export each repos using svn export, and then use the diff command to compare the 2 directories you exported.

// Export repositories
svn export http://svn.boost.org/svn/boost/sandbox/boost/extension/ repos1
svn export http://cloudobserver.googlecode.com/svn/branches/v0.4/Boost.Extension.Tutorial/libs/boost/extension/ repos2

// Compare exported directories
diff repos1 repos2 > file.diff
yvoyer
  • 7,208
  • 5
  • 29
  • 37
  • I replaced last line with `git diff repos1 repos2 > file2.diff` and it got more informative... but it seems to me it shows that all files (same files) have all thare contents replaced with wary same contents (while I know for sure that there were only like 3 code lines changed at all)... – Rella May 03 '11 at 19:16