Skip to content

issue #18:RCSStream: Fix issue on inserting incomplete line on RCS diff #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cvs2svn_lib/rcs_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def generate_edits_from_blocks(blocks):

input_position = 0
for (command, old_lines, new_lines) in blocks:
old_lines = msplit("".join(old_lines))
new_lines = msplit("".join(new_lines))
if command == 'c':
input_position += len(old_lines)
elif command == 'r':
Expand Down Expand Up @@ -252,7 +254,13 @@ def generate_blocks(self, edits):
yield ('c', copied_lines, copied_lines)
del copied_lines
input_pos = start
yield ('r', [], lines)
if lines[-1].endswith('\n') or input_pos == len(self._lines):
yield ('r', [], lines)
else:
copied_line = self._lines[input_pos]
yield ('r', [copied_line], lines + [copied_line])
del copied_line
input_pos = input_pos + 1

# Pass along the part of the input that follows all of the delta
# blocks:
Expand Down