Separate handling of ChangeIds and Git SHAs in Gerrit

Since Ia337ddfe2ddc82c858072135a613786070f0dc67, ChangeIds not
surrounded by whitespace (such as that one) are no longer turned into
links. (It also reduces the minimum length of a hex string required to
recognise a ChangeId from 8 to 7 for reasons that are undocumented, and
therefore suspect.)

The purpose of that patch was to prevent overzealous matching of strings
in e.g. URLs as possible ChangeIds. This stems from
I5cd74bef5510c8dbf3891dcfa3086a141e445f0d, which extended the changeid
regex to also look for Git SHA hashes, which are far more likely to
show up as false positives.

In fact, Ia337ddfe2ddc82c858072135a613786070f0dc67 actually destroys the
original rationale of I5cd74bef5510c8dbf3891dcfa3086a141e445f0d by
refusing to match SHAs that are followed by a closing parenthesis, as
cherry-picked commits on stable branches are.

This patch makes the following changes:
* Separates the changeid and gitsha commentlink handlers
* Restores the changeid patterns to their original values
* Matches only full Git SHAs (not just all 8+ character hex strings)
* Allows for other common punctuation around Git SHAs (commas, colons,
  semicolons, parentheses).

Fixes bug 1265646

Change-Id: I0844ee2fd8d8699059eb7afa92b282cf5b890c18
Merge "Separate handling of ChangeIds and Git SHAs in Gerrit"