Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does svn diff sometimes copy working files to a temp file?

Tags:

diff

svn

I use an external diff tool with Subversion (Beyond Compare rules!), and one of the great features is being able to use the diff program to make some minor edits to the file as I'm reviewing the changes I've made.

But svn diff works differently on different projects of mine. In all, the left-hand file is a temp file containing the latest revision stored in Subversion (the head). But in some, the right-hand file is the actual working file, while in others it's a temp file copy of the working file. In the first case, I can make changes in the diff program and they affect the working copy. In the second case, I'm editing a temp file, so changes are lost.

Why does Subversion sometimes diff against the working file but sometimes against a temp copy of the working file? How can I make it always use the working file?

like image 484
Ned Batchelder Avatar asked Feb 04 '23 12:02

Ned Batchelder


1 Answers

Do you have any svn:keywords set on those files? If yes, then Subversion will create a temp file first which has all those expanded keywords 'unexpanded'. This is to avoid having all the keyword lines shown as different even if they haven't been changed.

For example, if you diff a file in your working copy against BASE, the BASE file has no keywords expanded (and is also stored with LF lineendings), while the file in your working copy has all keywords expanded (and may be stored with CRLF lineendings). If you haven't modified that file locally, 'svn diff' would show all lines as different (if the line endings don't match) or at least all lines with the keywords would be shown as different - which is not what you would expect.

like image 102
Stefan Avatar answered Feb 06 '23 14:02

Stefan