Bug 115395

Summary: TextStreamMerger always uses '\n' as line ending
Product: [Eclipse Project] Platform Reporter: Bogdan Gheorghe <gheorghe>
Component: CompareAssignee: Andre Weinand <andre_weinand>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert
Version: 3.2   
Target Milestone: 3.2 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch to IStreamMerger none

Description Bogdan Gheorghe CLA 2005-11-07 16:52:45 EST
performThreeWayMerge in MergeContext makes use of Compare's IStreamMerger to
merge. Somehow the line endings get messed up after the merge.

Repro steps (using 3.2 M3):

1. Check out a project from CVS twice into the same workspace (using a different
name for the second one).

2. Turn on model merging Window>Preferences>Team>CVS>Work In Progress

3. Make a change in any file in Project1. Create a patch of your change from
Project1 and apply it to Project2.

4. Commit changes to Project2.

5. Update Project1. If you compare the file you just updated in Project1 with
the latest from HEAD, you will see that there are changes in the line endings.
(Or you can also try to Clean Timestamps and notice that it doesn't work).
Comment 1 Michael Valenta CLA 2005-11-29 12:10:24 EST
Created attachment 30783 [details]
Patch to IStreamMerger

Here's a patch to IStreamMerger that makes it use the platform line ending instead of just '\n'. This may not be the proper behavior either though. It may be better to use whatever line ending is used in the incoming streams or, if they are not the same, use the Eclipse platform new file line ending.
Comment 2 Michael Valenta CLA 2005-11-29 12:13:43 EST
Moving to Compare. Andre, was there a reason that the outgoing line-ending of the TextStreamMerge was just '\n'?

P.S. The patch is for TextStreamMerger, not IStreamMerger
Comment 3 Andre Weinand CLA 2005-12-07 17:11:13 EST
modified patch released and tests adapted
Comment 4 Dani Megert CLA 2005-12-13 04:40:44 EST
Start verifying...
Comment 5 Dani Megert CLA 2005-12-13 04:48:56 EST
The patch improves the situation but still has problems when the files are checked out with a line delimiter that's different from System.getProperty("line.separator").
Comment 6 Michael Valenta CLA 2005-12-13 08:51:22 EST
This is true (as stated in comment 1). The purpose of the patch was to make the TextStreamMerger usable on non-*nix platforms for most users.
Comment 7 Michael Valenta CLA 2005-12-13 16:12:40 EST
It does not appear that this is in the M4 test candidate build. The compare.map file has not been updated.
Comment 8 Andre Weinand CLA 2006-04-27 18:51:47 EDT
In build now.