[viewvc-dev] Question regarding DiffSource()

Alexey Neyman <[email protected]> Mon, 10 Oct 2011 10:05:39 -0700
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
Hi,

I have a question regarding the DiffSource() behavior with inputs which don't 
end with a new line. The following code in DiffSource._get_row() treats the 
input from diff command noting the condition:

    if line[0] == '\\':
      # \ No newline at end of file

      # move into the flushing state. note: it doesn't matter if we really
      # have data to flush or not; that will be figured out later
      self.state = 'flush-' + self.state
      return None

It does not explain, though, why the state change is necessary. The result of 
the state change is that a change in the last line in such input is displayed 
as removed and added lines, not as a changed line.

Why?

Removing state change (just returning None) for these lines properly displays 
such lines as changed. This also affects property diff display (as many, if 
not most, properties are a single newline without \n at the end).

Regards,
Alexey.

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2852635

To unsubscribe from this discussion, e-mail: [[email protected]].