Inconsistent newlines

Jun 5, 2012 at 9:07 AM

Hello Everyone,
Trying to convert some VSS projects but I get this

INFO  Processing revision 1 / 655
FATAL
SharpSvn.SvnIllegalTargetException: File 'D:\Temp\_migrate\Multi\Common\CommonCode.vcproj' has inconsistent newlines ---> SharpSvn.SvnIOException: Inconsistent line
ending style
   --- Fine dell'analisi dello stack dell'eccezione interna ---
   in SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, SvnException error)
   in SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, svn_error_t* error)
   in SharpSvn.SvnClient.Add(String path, SvnAddArgs args)
   in SharpSvn.SvnClient.Add(String path)
   in VssMigrate.Program.GetFileVersion(IVSSItem vssFile, IVSSVersion vssVersion, SvnClient svnClient) in C:\Users\Desktop\VssMigrate-0.2.0.0-src\src\P
rogram.cs:riga 588
   in VssMigrate.Program.GetAndAddRevision(VssRevProps properties, Dictionary`2 files, SvnClient svnClient) in C:\Users\Desktop\VssMigrate-0.2.0.0-src\
src\Program.cs:riga 521
   in VssMigrate.Program.GetAndAddRevisions() in C:\Users\Desktop\VssMigrate-0.2.0.0-src\src\Program.cs:riga 508
   in VssMigrate.Program.Main(String[] argv) in C:\Users\Desktop\VssMigrate-0.2.0.0-src\src\Program.cs:riga 155

What can I do to overcome this?

Thanks,Marco

Jun 5, 2012 at 9:16 AM

I know what the problem is (some files have DOS style end-of-line markers, that is cr/lf, and others have Mac/Unix style, that is just lf), but not exactly how to fix it. A quick Google search produced these results (among ~91 700 others :-):

[FIXING SVN INCONSISTENT NEWLINES] - http://blog.eflow.org/archives/130

["inconsisten newlines" - how to fix?] http://svn.haxx.se/users/archive-2004-11/0857.shtml

 

The search phrase I used was: svn inconsistent newlines

 

HTH,

John

Jun 5, 2012 at 9:20 AM

Hello John,

Ok, if I had a SVN repository I could definitely use these techniques to fix these, but I have a SourceSafe repo which I am trying to convert to SVN.

Thanks,

M

Jun 5, 2012 at 9:44 AM

Tried to comment line 574 of Program.cs -- VssBindingRemover.RemoveBindings(filePath); -- hoping it was the removal of the bindings to create issues but no luck.

Maybe I should sent by hand the properties of these files before to add them?

Jun 5, 2012 at 10:00 AM

No, the problem isn't in the binding, it's in the actual content of the file you are adding. A "quick'n'dirty" hack that might work would be to:

 

1. Read the original file into a string (or array);

2. Replace all cr/lf character pairs with just lf (or vice-versa, but then you'd need to take care to not create duplicate cr characters!);

3. Write the file back to disk;

4. Perform the call to "svnClient.Add(filePath)".

 

Another possibility (and in fact this would now be my first choice) might be to force the line endings to be nl only, when getting from VSS.

I did another quick search and found the following page: http://support.microsoft.com/kb/170750 [INFO: End of Line Character Settings for Visual SourceSafe] (search keywords: vss line ending). By adding the EOL switch in the user's .ini file, you can force a get to automagically convert Window's cr/nl combination into just nl for example.

HTH!

John

 

Jun 5, 2012 at 10:17 AM

Hello John!

I tried to modify the user's ini adding EOL = n and all seems to work now!!

Thank you very much,

Marco

Jun 5, 2012 at 10:40 AM

Glad I was able to help :-)