Re: [viewvc-dev] Question regarding DiffSource()

Alexey Neyman <[email protected]> Mon, 17 Oct 2011 09:47:37 -0700
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <[email protected]>
On Monday, October 17, 2011 08:39:41 am C. Michael Pilato wrote:
> On 10/10/2011 01:05 PM, Alexey Neyman wrote:
> > 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).
> 
> The DiffSource code predates me, so I can't offer much help here.  If
> you've spotted a bug therein and found a solution for it, awesome!

Thing is, I am not sure if it is a bug or feature. To me, marking such lines 
as removed and readded looks counterintuitive, but with the explicit handling 
of this case, I think the original author thought otherwise.

Regards,
Alexey.

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

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