mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01:00
diffusion: fix git log author name parsing
Summary: The current git log parsing wouldn't work correctly when space appeared in the author name. This diff fixes to regex to work with multi-word author names and increases the author column width when viewing blame info to accound for larger author names. Test Plan: viewed file with blame info in diffusion where author name contained multiple words Reviewed By: jungejason Reviewers: jungejason, epriestley CC: aran, rm, jungejason Differential Revision: 399
This commit is contained in:
parent
acdb215310
commit
b8194202e6
2 changed files with 11 additions and 5 deletions
|
@ -160,7 +160,7 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
$rev = $rev_list[$k];
|
||||
$author = $blame_dict[$rev]['author'];
|
||||
$rows[] =
|
||||
sprintf("%-10s %-15s %s", substr($rev, 0, 7), $author, $line);
|
||||
sprintf("%-10s %-20s %s", substr($rev, 0, 7), $author, $line);
|
||||
}
|
||||
|
||||
$corpus = phutil_render_tag(
|
||||
|
@ -269,8 +269,8 @@ class DiffusionBrowseFileController extends DiffusionController {
|
|||
$blame_info =
|
||||
$prev_link .
|
||||
'<th style="background: '.$color.
|
||||
'; width: 9em;">'.$revision_link.'</th>'.
|
||||
'<th style="background: '.$color.
|
||||
'; width: 12em;">'.$revision_link.'</th>'.
|
||||
'<th style="background: '.$color.'; width: 12em'.
|
||||
'; font-weight: normal; color: #333;">'.$author_link.'</th>';
|
||||
$last_rev = $rev;
|
||||
}
|
||||
|
|
|
@ -49,10 +49,16 @@ final class DiffusionGitFileContentQuery extends DiffusionFileContentQuery {
|
|||
|
||||
protected function tokenizeLine($line) {
|
||||
$m = array();
|
||||
// sample line:
|
||||
// sample lines:
|
||||
//
|
||||
// d1b4fcdd2a7c8c0f8cbdd01ca839d992135424dc
|
||||
// ( hzhao 2009-05-01 202)function print();
|
||||
preg_match('/^\s*?(\S+?)\s*\(\s*(\S+)\s+\S+\s+\d+\)(.*)?$/', $line, $m);
|
||||
//
|
||||
// 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+\)(.*)?$/',
|
||||
$line, $m);
|
||||
$rev_id = $m[1];
|
||||
$author = $m[2];
|
||||
$text = idx($m, 3);
|
||||
|
|
Loading…
Reference in a new issue