How are you generating the diffs? I noticed that as well, and I don't believe it should be showing the ",v".
Christian -- Christian Hammond - [email protected] Review Board - https://www.reviewboard.org Beanbag, Inc. - https://www.beanbaginc.com On Wed, Nov 18, 2015 at 2:25 PM, Wesly Chen <[email protected]> wrote: > It seems to be related to CVS repository. In CVS repository, all the file > will be trailed with ",v" and the content of CVS files are not similar with > original one. > However, "cvs diff" can parse and generate the diff file. So the review > board Diff Viewer should check and parse the lexer based on the original > filename instead of the one in CVS repository with ",v". > > Wesly Chen於 2015年11月17日星期二 UTC-8下午5時36分20秒寫道: > >> 2015-11-18 01:34:33,284 - DEBUG - None - wchen - >> /reviews/r/114/diff/3/fragment/1876/ - Patching file >> check_mysql_multirow.pl took 0.042870 seconds >> 2015-11-18 01:34:33,409 - ERROR - - Failed to apply pygments: no lexer >> for filename u'/home/cvs/OPS/nagios/libexec/check_mysql_multirow.pl,v' >> found >> Traceback (most recent call last): >> File >> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/chunk_generator.py", >> line 231, in _get_chunks_uncached >> markup_a = self._apply_pygments(old or '', source_file) >> File >> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/chunk_generator.py", >> line 654, in _apply_pygments >> encoding='utf-8') >> File >> "/usr/lib/python2.6/site-packages/Pygments-2.0.2-py2.6.egg/pygments/lexers/__init__.py", >> line 149, in get_lexer_for_filename >> raise ClassNotFound('no lexer for filename %r found' % _fn) >> ClassNotFound: no lexer for filename u'/home/cvs/OPS/nagios/libexec/ >> check_mysql_multirow.pl,v' found >> 2015-11-18 01:34:33,425 - DEBUG - None - wchen - >> /reviews/r/114/diff/3/fragment/1876/ - Begin: Generating diff chunks for >> self.filediff id 1876 (/home/cvs/OPS/nagios/libexec/ >> check_mysql_multirow.pl,v) >> 2015-11-18 01:34:33,432 - DEBUG - None - wchen - >> /reviews/r/114/diff/3/fragment/1876/ - End: Generating diff chunks for >> self.filediff id 1876 (/home/cvs/OPS/nagios/libexec/ >> check_mysql_multirow.pl,v) >> 2015-11-18 01:34:33,432 - DEBUG - None - wchen - >> /reviews/r/114/diff/3/fragment/1876/ - Generating diff chunks for >> self.filediff id 1876 (/home/cvs/OPS/nagios/libexec/ >> check_mysql_multirow.pl,v) took 0.006171 seconds >> >> >> Christian Hammond於 2015年11月17日星期二 UTC-8下午5時29分13秒寫道: >>> >>> Okay, you'll have to add 'import logging' to the line above the logging >>> statement. >>> >>> Christian >>> >>> -- >>> Christian Hammond - [email protected] >>> Review Board - https://www.reviewboard.org >>> Beanbag, Inc. - https://www.beanbaginc.com >>> >>> On Tue, Nov 17, 2015 at 5:09 PM, Wesly Chen <[email protected]> wrote: >>> >>>> I modified >>>> ---------- >>>> markup_b = self._apply_pygments(new or '', dest_file) >>>> except: >>>> pass >>>> ------------ >>>> to >>>> ------------ >>>> markup_b = self._apply_pygments(new or '', dest_file) >>>> except Exception as e: >>>> logging.exception('Failed to apply pygments: %s', e) >>>> -------------- >>>> >>>> Then restarted memcached/httpd. >>>> loaded a diff file via rbt (rbt post -u -r 114 -I >>>> check_mysql_multirow.pl) >>>> and I got an error on UI >>>> ---- >>>> There was an error displaying this diff. >>>> >>>> global name 'logging' is not defined >>>> >>>> Details: >>>> Traceback (most recent call last): >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/views.py", >>>> line 265, in get >>>> response = renderer.render_to_response(request) >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/renderers.py", >>>> line 56, in render_to_response >>>> return HttpResponse(self.render_to_string(request)) >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/renderers.py", >>>> line 74, in render_to_string >>>> large_data=True) >>>> File >>>> "/usr/lib/python2.6/site-packages/Djblets-0.8.22-py2.6.egg/djblets/cache/backend.py", >>>> line 111, in cache_memoize >>>> data = lookup_callable() >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/renderers.py", >>>> line 73, in <lambda> >>>> lambda: self.render_to_string_uncached(request), >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/renderers.py", >>>> line 87, in render_to_string_uncached >>>> request=request) >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/diffutils.py", >>>> line 422, in populate_diff_chunks >>>> chunks = generator.get_chunks() >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/chunk_generator.py", >>>> line 161, in get_chunks >>>> large_data=True) >>>> File >>>> "/usr/lib/python2.6/site-packages/Djblets-0.8.22-py2.6.egg/djblets/cache/backend.py", >>>> line 111, in cache_memoize >>>> data = lookup_callable() >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/chunk_generator.py", >>>> line 160, in <lambda> >>>> lambda: list(self._get_chunks_uncached()), >>>> File >>>> "/usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/chunk_generator.py", >>>> line 236, in _get_chunks_uncached >>>> logging.exception('Failed to apply pygments: %s', e) >>>> NameError: global name 'logging' is not defined >>>> ----- >>>> >>>> Here is the reviewboard.log >>>> ---------- >>>> 2015-11-18 01:01:28,274 - DEBUG - - DiffParser.parse: Beginning parse >>>> of diff, size = 748 >>>> 2015-11-18 01:01:28,275 - DEBUG - - DiffParser.parse: Finished parsing >>>> diff. >>>> 2015-11-18 01:01:36,063 - DEBUG - - DiffParser.parse: Beginning parse >>>> of diff, size = 748 >>>> 2015-11-18 01:01:36,063 - DEBUG - - DiffParser.parse: Finished parsing >>>> diff. >>>> 2015-11-18 01:01:49,314 - DEBUG - - Cache miss for key >>>> jsi18n-djangojs-reviewboard_djblets-en-1444348511. >>>> 2015-11-18 01:02:30,588 - DEBUG - None - wchen - /reviews/r/114/diff/ - >>>> Generating diff viewer page for filediff id 405 >>>> 2015-11-18 01:02:30,619 - DEBUG - None - wchen - /reviews/r/114/diff/ - >>>> Begin: Generating diff file info for diffset id 405 >>>> 2015-11-18 01:02:30,625 - DEBUG - None - wchen - /reviews/r/114/diff/ - >>>> End: Generating diff file info for diffset id 405 >>>> 2015-11-18 01:02:30,626 - DEBUG - None - wchen - /reviews/r/114/diff/ - >>>> Generating diff file info for diffset id 405 took 0.005950 seconds >>>> 2015-11-18 01:02:30,630 - DEBUG - None - wchen - /reviews/r/114/diff/ - >>>> Done generating diff viewer page for filediff id 405 >>>> 2015-11-18 01:02:31,074 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - Begin: Generating diff file info for >>>> diffset id 405, filediff 1876 >>>> 2015-11-18 01:02:31,080 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - End: Generating diff file info for >>>> diffset id 405, filediff 1876 >>>> 2015-11-18 01:02:31,081 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - Generating diff file info for >>>> diffset id 405, filediff 1876 took 0.006040 seconds >>>> 2015-11-18 01:02:31,086 - DEBUG - - Cache miss for key >>>> diffviewer/diff_file_fragment.html-0-3-1876-collapsed-highlighting-en-1444348487. >>>> 2015-11-18 01:02:31,087 - DEBUG - - Cache miss for key >>>> diff-sidebyside-hl-1876-en. >>>> 2015-11-18 01:02:31,088 - DEBUG - - Cache miss for key >>>> file:2:/home/cvs/OPS/nagios/libexec/check_mysql_multirow.pl%2Cv:1.1:. >>>> 2015-11-18 01:02:31,088 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - Begin: Fetching file >>>> '/home/cvs/OPS/nagios/libexec/check_mysql_multirow.pl,v' r1.1 from >>>> CVS-prod >>>> 2015-11-18 01:02:33,822 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - End: Fetching file >>>> '/home/cvs/OPS/nagios/libexec/check_mysql_multirow.pl,v' r1.1 from >>>> CVS-prod >>>> 2015-11-18 01:02:33,824 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - Fetching file >>>> '/home/cvs/OPS/nagios/libexec/check_mysql_multirow.pl,v' r1.1 from >>>> CVS-prod took 2.733748 seconds >>>> 2015-11-18 01:02:33,842 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - Begin: Patching file >>>> check_mysql_multirow.pl >>>> 2015-11-18 01:02:33,889 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - End: Patching file >>>> check_mysql_multirow.pl >>>> 2015-11-18 01:02:33,891 - DEBUG - None - wchen - >>>> /reviews/r/114/diff/3/fragment/1876/ - Patching file >>>> check_mysql_multirow.pl took 0.046748 seconds >>>> >>>> >>>> >>>> Christian Hammond於 2015年11月17日星期二 UTC-8下午2時30分56秒寫道: >>>>> >>>>> They're part of the site_siteconfiguration table, but if it's showing >>>>> as checked, then that's fine. The issue you're hitting has not come up >>>>> before, that I've seen, so I expect it's something internal. >>>>> >>>>> In that code block you pasted, there's this: >>>>> >>>>> try: >>>>> # TODO: Try to figure out the right lexer for these files >>>>> # once instead of twice. >>>>> if not source_file.endswith(self.STYLED_EXT_BLACKLIST): >>>>> markup_a = self._apply_pygments(old or '', source_file) >>>>> >>>>> if not dest_file.endswith(self.STYLED_EXT_BLACKLIST): >>>>> markup_b = self._apply_pygments(new or '', dest_file) >>>>> except: >>>>> pass >>>>> >>>>> Modify the last two lines to be: >>>>> >>>>> except Exception as e: >>>>> logging.exception('Failed to apply pygments: %s', e) >>>>> >>>>> Then restart, clear memcached, try loading a diff, and then check the >>>>> logs to see what it says. >>>>> >>>>> Christian >>>>> >>>>> -- >>>>> Christian Hammond - [email protected] >>>>> Review Board - https://www.reviewboard.org >>>>> Beanbag, Inc. - https://www.beanbaginc.com >>>>> >>>>> On Sun, Nov 15, 2015 at 9:45 AM, Wesly Chen <[email protected]> >>>>> wrote: >>>>> >>>>>> I can try. >>>>>> Could you tell me where are the following settings in MySQL database >>>>>> "reviewboard" so I can verify the setting is enabled in MySQL or not. >>>>>> 1. System setting => Diff Viewer settings => Show syntax >>>>>> highlighting is checked. >>>>>> 2. Account settings " Enable syntax highlighting in the diff viewer" >>>>>> is checked. >>>>>> >>>>>> Thanks, >>>>>> >>>>>> Wesly >>>>>> >>>>>> Christian Hammond於 2015年11月15日星期日 UTC-8上午12時00分55秒寫道: >>>>>>> >>>>>>> Right. What were you looking to do with this file? Are you >>>>>>> comfortable debugging Python web applications? >>>>>>> >>>>>>> Christian >>>>>>> >>>>>>> -- >>>>>>> Christian Hammond - [email protected] >>>>>>> Review Board - https://www.reviewboard.org >>>>>>> Beanbag, Inc. - https://www.beanbaginc.com >>>>>>> >>>>>>> On Sat, Nov 14, 2015 at 11:50 PM, Wesly Chen <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> On my review board system, it is in >>>>>>>> /usr/lib/python2.6/site-packages/ReviewBoard-2.0.20-py2.6.egg/reviewboard/diffviewer/chunk_generator.py >>>>>>>> (not in diffutils.py) >>>>>>>> ------- >>>>>>>> (started with line 219) >>>>>>>> if self._get_enable_syntax_highlighting(old, new, a, b): >>>>>>>> repository = self.filediff.diffset.repository >>>>>>>> tool = repository.get_scmtool() >>>>>>>> source_file = \ >>>>>>>> >>>>>>>> tool.normalize_path_for_display(self.filediff.source_file) >>>>>>>> dest_file = \ >>>>>>>> >>>>>>>> tool.normalize_path_for_display(self.filediff.dest_file) >>>>>>>> >>>>>>>> try: >>>>>>>> # TODO: Try to figure out the right lexer for these >>>>>>>> files >>>>>>>> # once instead of twice. >>>>>>>> if not >>>>>>>> source_file.endswith(self.STYLED_EXT_BLACKLIST): >>>>>>>> markup_a = self._apply_pygments(old or '', >>>>>>>> source_file) >>>>>>>> >>>>>>>> if not >>>>>>>> dest_file.endswith(self.STYLED_EXT_BLACKLIST): >>>>>>>> markup_b = self._apply_pygments(new or '', >>>>>>>> dest_file) >>>>>>>> except: >>>>>>>> pass >>>>>>>> ... >>>>>>>> (line 646) >>>>>>>> def _apply_pygments(self, data, filename): >>>>>>>> """Applies Pygments syntax-highlighting to a file's >>>>>>>> contents. >>>>>>>> >>>>>>>> The resulting HTML will be returned as a list of lines. >>>>>>>> """ >>>>>>>> lexer = get_lexer_for_filename(filename, >>>>>>>> stripnl=False, >>>>>>>> encoding='utf-8') >>>>>>>> lexer.add_filter('codetagify') >>>>>>>> >>>>>>>> return split_line_endings( >>>>>>>> highlight(data, lexer, NoWrapperHtmlFormatter())) >>>>>>>> ------------------- >>>>>>>> >>>>>>>> >>> -- Supercharge your Review Board with Power Pack: https://www.reviewboard.org/powerpack/ Want us to host Review Board for you? Check out RBCommons: https://rbcommons.com/ Happy user? Let us know! https://www.reviewboard.org/users/ --- You received this message because you are subscribed to the Google Groups "reviewboard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
