Re: [viewvc-dev] Issue with annotation
"C. Michael Pilato" <[email protected]> Fri, 02 May 2014 11:03:38 -0400
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Organization | CollabNet, Inc. |
| Message-ID | <5363B3CA.6020803__7155.81440967998$1399043030$gmane$org@collab.net> |
------=_Part_3259_1559384672.1399043024261 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On 05/02/2014 09:44 AM, C. Michael Pilato wrote: > On 05/01/2014 04:06 PM, Emmanuel Stapf wrote: >> Hi, >> >> I had an issue with annotation which would not show up because of the following >> error: >> >> Error occurred while calculating annotation data. >> >> I pinpointed the problem to the following line #1819 in lib/viewvc.py: >> >> if blame_data and (len(file_lines) != len(blame_data)): > > Manu, > > Thanks so much for the report. Sorry for what appears like a regression > in ViewVC's functionality. > > In looking at the file you pointed me to (thanks!), it looks like > there's just a bunch of empty lines at the end of the file that are > getting dropped. I'm comparing the "annotate" view and the "markup" > view of that 'ev_dialog_i.e' file -- the "markup" view lacks the > trailing blank lines. Does that seem to always be the case when this > error has cropped up for you? > > I checked out a copy of your source at the revision you pointed me to, > and the blank lines are certainly present there at the end of the file. > I was able even to replicate the history of the file into a local > repository so I can more easily diagnose the problem. I'll let you know > what I find, hoping that this one file is exemplary of the problems seen > elsewhere in your data set. Found it! Seems I was a bit sloppy with some string manipulation. If you are able to test out the attached patch (with your tweaks removed), that would be great. (I've committed these changes to ViewVC's trunk and 1.1.x branches.) -- C. Michael Pilato <[email protected]> CollabNet <> www.collab.net <> Enterprise Cloud Development ------------------------------------------------------ http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=3077413 To unsubscribe from this discussion, e-mail: [[email protected]]. ------=_Part_3259_1559384672.1399043024261 Content-Type: text/x-patch; name=viewvc.markup.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=viewvc.markup.patch Index: lib/viewvc.py =================================================================== --- lib/viewvc.py (revision 2934) +++ lib/viewvc.py (revision 2935) @@ -1766,7 +1766,10 @@ # file, try to guess the lexer based on the file's content. if not pygments_lexer and is_text(mime_type) and file_lines: try: - pygments_lexer = guess_lexer(file_lines[0]) + pygments_lexer = guess_lexer(file_lines[0], + encoding=encoding, + tabsize=cfg.options.tabsize, + stripnl=False) except ClassNotFound: pygments_lexer = None @@ -1791,7 +1794,8 @@ # objects. lines = [] file_lines = transcode_text(string.join(file_lines, ''), encoding) - file_lines = string.rstrip(file_lines, '\n') + if file_lines[-1] == '\n': + file_lines = file_lines[:-1] file_lines = string.split(file_lines, '\n') for i in range(len(file_lines)): line = file_lines[i] ------=_Part_3259_1559384672.1399043024261--