monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] Revision 4047a75642a389c8882e1aa328718797d98d48


From: monotone
Subject: [Monotone-commits-diffs] Revision 4047a75642a389c8882e1aa328718797d98d4800
Date: Fri, 7 Mar 2008 14:05:54 +0100

-----------------------------------------------------------------
Revision: 4047a75642a389c8882e1aa328718797d98d4800
Ancestor: 47426d890acc0c9ebbafbb5895f6784b173a004a
Author: Ralf S. Engelschall <address@hidden>
Date: 2008-03-07T12:28:20
Branch: net.venge.monotone

Added files:
        tests/diff_on_missing_trailing_newline_at_end_of_file/__driver__.lua
        tests/diff_on_missing_trailing_newline_at_end_of_file/file1
        tests/diff_on_missing_trailing_newline_at_end_of_file/file13.diff
        tests/diff_on_missing_trailing_newline_at_end_of_file/file14.diff
        tests/diff_on_missing_trailing_newline_at_end_of_file/file2
        tests/diff_on_missing_trailing_newline_at_end_of_file/file23.diff
        tests/diff_on_missing_trailing_newline_at_end_of_file/file24.diff
        tests/diff_on_missing_trailing_newline_at_end_of_file/file3
        tests/diff_on_missing_trailing_newline_at_end_of_file/file4
Added directories:
        tests/diff_on_missing_trailing_newline_at_end_of_file
Modified files:
        diff_patch.cc simplestring_xform.cc simplestring_xform.hh
        tests/merge_update_part_of_file/after.diff
        tests/merge_update_part_of_file/before.diff

ChangeLog: 

Fix "mtn diff" output by handling the special cases of missing trailing
newline at end of file. This makes the output compatible with GNU
diffutils' diff(1) and especially allows it to be correctly applied with
GNU patch(1) again, too.

The source of the problem is that diff_patch:cc:make_diff() called the
generic function simplestring_xform.cc:split_into_lines() for splitting
the file data into individual lines, this way removed all(!) newlines at
all and hence lost the information about the special case of a missing
trailing newline.

The least invasive fix is to already preserve the information in
simplestring_xform.cc:split_into_lines() by representing the missing
newline with the appended text "[\r]\n\\No newline at end of file" on
the last line (notice that this is the only case were a line can still
contain a newline after splitting).

Additionally, diff_patch.cc:walk_hunk_consumer() for unknown reasons
produces added before deleted lines (instead of the expection order of
deleted before added lines) and hence also had to be fixed in order to
produce output 100% compatible to GNU diff(1).

Finally, two existing tests related to diff_patch.cc:walk_hunk_consumer() 
were adjusted and a new test suite was added for checking all four
special cases related to the missing trailing newline. The complete
Monotone test suite still succeeed with 0 failures after this change.


Attachment: txtfLeMKH6WkC.txt
Description: Diff [47426d890acc0c9ebbafbb5895f6784b173a004a] -> [4047a75642a389c8882e1aa328718797d98d4800]


reply via email to

[Prev in Thread] Current Thread [Next in Thread]