Uploaded image for project: 'Infrastructure'
  1. Infrastructure
  2. INFRA-7862

Hilite r123456 as links when followed by comma or ')'.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Fix Version/s: Nov 2014
    • Component/s: Bugzilla
    • Labels:
      None

      Description

      Look at the following issue as an example:
      https://issues.apache.org/bugzilla/show_bug.cgi?id=56582

      I want the text such as "r1599385, " and "r1599395)" to be converted into links to ViewVC. Currently they are displayed as plain text.

      Looking into /infrastructure/bugzilla/bugzilla/ and searching for places that use "svn_url" configuration parameter, I think the following file is responsible for this feature:
       Bugzilla/Template.pm

      It contains the following regexp:
      > # Subversion revision links of the form r123456
      > $text =~ s~\b((?<!-|\.)r(\d+))(?=\.?($|\s))

      I interpret it [1] as
      - World boundary
      - "(?<!pattern)" is a zero-width negative look-behind assertion
       that previous character is not '-' or '.'.
      - "r" + digits are captured as $1
      - digits are captured as $2
      - "(?=pattern)" is a zero-width positive look-ahead assertion
       that the text is followed by optional '.' followed by either end-of-line or whitespace.

      I propose to change the look-ahead part of that regexp to be the following:
      (?=(\.|\,)?($|\s|\)))

      That should mean:
      - optional point or comma followed by either end-of-line, whitespace or ')'.

      There is also similar regular expression in Bugzilla/BugMail.pm, but as I have never seen e-mails with such links from Bugzilla, I think that BugMail.pm is not worth being changed. Changing BugMail.pm would also be more risky, as e-mails are archived, as opposed to on-line display.

      [1] http://perldoc.perl.org/perlre.html

        Attachments

        1. Template.pm.patch
          0.5 kB
          Konstantin Kolinko

          Activity

            People

            • Assignee:
              markt Mark Thomas
              Reporter:
              kkolinko Konstantin Kolinko
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: