4022: syntax highlighting failed with CVS repository due to trailing ",v"

wesly.chen
david
david

What version are you running?

2.0.20

What's the URL of the page containing the problem?

http://reviews-test.adara.com/reviews/r/114/diff/3-4/ (require login)

What steps will reproduce the problem?

  1. setup CVS repository and pointing to CVS repository when use "rbt post"
  2. rbt post

What is the expected output? What do you see instead?

Syntax highlighting should work and show in different color for certain keyword, comments in Diff Viewer.
However, it shows only different color for the different lines in Diff Viewer.

In the reviewboard.log, it seems to be related to CVS repository. In CVS repository, all the files will be trailed with ",v" and the content of CVS files are not similar with original one.
Review Board might need to add a filename check for CVS repository and remove the trailing ",v" then pass the filename without ",v" to "_apply_pygments" in reviewboard/diffviewer/chunk_generator.py.

What operating system are you using? What browser?

OS: CentOS 6.5 x86_64
browser: Google chrome

Please provide any additional information below.

more details in this discussion thread
https://groups.google.com/forum/?fromgroups=#!topic/reviewboard/obWSo4AR7rA

--- reviewboard.log -------
2015-11-18 22:51:22,158 - 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

#1 wesly.chen

We have a fix.

In ReviewBoard-2.0.20-py2.6.egg/reviewboard/scmtools/cvs.py

185a186,188

def normalize_path_for_display(self, filename):
    return re.sub(",v$", "", filename)

Basically, we add the following two lines after line 186 in ReviewBoard-2.0.20-py2.6.egg/reviewboard/scmtools/cvs.py

 def normalize_path_for_display(self, filename):
     return re.sub(",v$", "", filename)

chipx86
#2 chipx86
  • -New
    +Confirmed
  • +Release-2.0.x
    +Release-2.5.x
  • +Component:DiffParser
    +Component:SCMTools
    +SCM:CVS
  • +chipx86
david
#3 david
  • -Confirmed
    +PendingReview
  • -chipx86
    +david
david
#4 david

Fixed in release-2.5.x (f1d9813). This will ship in 2.5.8. Thanks!

  • -PendingReview
    +Fixed