views:

147

answers:

3

Hey guys,

Here's the scenario I'm currently running into:

  1. Programmer A (Using a Mac Version of Dreamweaver) edits file client.php and commits that file to the production branch of Project Foo's repository
  2. Programmer B (Using a Windows Version of Dreamweaver) edits file client.php to fix a bug in the that file. He then does a cp clientInfo.php ../prod-branch/clientInfo.php to take that bug-fix from his working copy to the production branch.
  3. Programmer B then does an svn diff ../prod-branch/clientInfo.php to see what svn says his changes were only to discover that svn says he's changed every line in the file!

Now, this is what I believe is happening:

When the file gets edited by Mac, Dreamweaver on Mac replaces all the Windows newline characters with Mac newline characters so that it's readable in Dreamweaver. In short, Dreamweaver has altered every line in the file. Now, once the commit is done, svn sees that every line of the file has changed and marks this fact down. When the windows programmer makes a change and the newline characters get changed again, svn thinks that, again, every line has changed.

My question is this: How can we prevent this from happening? I know there's no way to undo the damage that's already been done, but I want to prevent this from happening in the future.

+2  A: 

svn:eol-style is a property that can be set centrally in the repository and should sort out your problem.

Check out the chapter on New Line Sequences in the Subversion book.

The solution to this problem is the svn:eol-style property. When this property is set to a valid value, Subversion uses it to determine what special processing to perform on the file so that the file's line ending style isn't flip-flopping with every commit that comes from a different operating system. The valid values are:

Pekka
Okay, here's an issue I'm running into: our working copies are not on our desktop. We're using dreamweaver to pull down, edit, and then upload our changes to our working copies. Our IDE's are the culprit here. Any suggestions?
Levi Hackwith
Is that really necessary? Why not have a working copy locally?
Pekka
... if it's for uploading to a test server, why not have the working copy locally and still have the IDE upload everything anytime you need.
Pekka
+5  A: 

You need to use the "svn:eol-style" property on all text files. Usually setting it to "native" will suffice

sylvanaar
First off, WOW you guys are fast. Okay, I'll give "native" a shot and let you guys know if that did it. Thanks.
Levi Hackwith
+1  A: 

Dreamweaver has an option to set which line break type it uses. Edit (on Mac: Dreamweaver ) -> Preferences, Code Format, Line break type.

Get your users to have the same setting, and things should play a little better together. It would be better, of course, if you can set your source control to ignore line break differences.

Danilo Celic
Works like a charm! The prize goes to you, Mr. Celic. Thank you all for your help with this. StackOverflow, FTW.
Levi Hackwith