Allow parenthesis in author name

Summary: We have a dozen users who has `(...)` in their 'real name', like 'Jimmy (He) Zhang', and it's causing the diffusion file browser problems when blame is enabled. The parser does not expect those parenthesis and the lines of code will be empty if they were last touched by a user like that.

Test Plan: Try it

Reviewers: wez, lifeihuang, JoelB, #blessed_reviewers, epriestley

Reviewed By: epriestley

CC: Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D8429
This commit is contained in:
Peng Li
2014-03-06 11:28:46 -08:00
committed by epriestley
parent 270916a26e
commit 81d9935efe
3 changed files with 39 additions and 1 deletions

View File

@@ -32,6 +32,10 @@ final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery {
}
protected function tokenizeLine($line) {
return self::match($line);
}
public static function match($line) {
$m = array();
// sample lines:
//
@@ -41,7 +45,7 @@ final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery {
// 8220d5d54f6d5d5552a636576cbe9c35f15b65b2
// (Andrew Gallagher 2010-12-03 324)
// // Add the lines for trailing context
preg_match('/^\s*?(\S+?)\s*\(\s*([^)]*)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/',
preg_match('/^\s*?(\S+?)\s*\(\s*(.*?)\s+\d{4}-\d{2}-\d{2}\s+\d+\)(.*)?$/',
$line, $m);
$rev_id = $m[1];
$author = $m[2];