Save blame info to lint messages
Test Plan: Applied the patch. Looked at blame and plain blame of SVN and Git file. Ran the lint saver. Looked at lint messages list. /diffusion/lint/ Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5218
This commit is contained in:
@@ -202,11 +202,7 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
||||
$rows = array();
|
||||
foreach ($text_list as $k => $line) {
|
||||
$rev = $rev_list[$k];
|
||||
if (isset($blame_dict[$rev]['handle'])) {
|
||||
$author = $blame_dict[$rev]['handle']->getName();
|
||||
} else {
|
||||
$author = $blame_dict[$rev]['author'];
|
||||
}
|
||||
$author = $blame_dict[$rev]['author'];
|
||||
$rows[] =
|
||||
sprintf("%-10s %-20s %s", substr($rev, 0, 7), $author, $line);
|
||||
}
|
||||
@@ -430,11 +426,13 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
||||
DiffusionFileContentQuery $file_query,
|
||||
$selected) {
|
||||
|
||||
$handles = array();
|
||||
if ($blame_dict) {
|
||||
$epoch_list = ipull(ifilter($blame_dict, 'epoch'), 'epoch');
|
||||
$epoch_min = min($epoch_list);
|
||||
$epoch_max = max($epoch_list);
|
||||
$epoch_range = ($epoch_max - $epoch_min) + 1;
|
||||
$handles = $this->loadViewerHandles(ipull($blame_dict, 'authorPHID'));
|
||||
}
|
||||
|
||||
$line_arr = array();
|
||||
@@ -499,8 +497,9 @@ final class DiffusionBrowseFileController extends DiffusionController {
|
||||
$display_line['color'] = $color;
|
||||
$display_line['commit'] = $rev;
|
||||
|
||||
if (isset($blame['handle'])) {
|
||||
$author_link = $blame['handle']->renderLink();
|
||||
$author_phid = idx($blame, 'authorPHID');
|
||||
if ($author_phid && $handles[$author_phid]) {
|
||||
$author_link = $handles[$author_phid]->renderLink();
|
||||
} else {
|
||||
$author_link = phutil_tag(
|
||||
'span',
|
||||
|
||||
@@ -169,29 +169,30 @@ final class DiffusionLintController extends DiffusionController {
|
||||
}
|
||||
|
||||
if ($owner_phids) {
|
||||
$or = array();
|
||||
$or[] = qsprintf($conn, 'authorPHID IN (%Ls)', $owner_phids);
|
||||
|
||||
$paths = array();
|
||||
$packages = id(new PhabricatorOwnersOwner())
|
||||
->loadAllWhere('userPHID IN (%Ls)', $owner_phids);
|
||||
if (!$packages) {
|
||||
return array();
|
||||
if ($packages) {
|
||||
$paths = id(new PhabricatorOwnersPath())->loadAllWhere(
|
||||
'packageID IN (%Ld)',
|
||||
mpull($packages, 'getPackageID'));
|
||||
}
|
||||
|
||||
$paths = id(new PhabricatorOwnersPath())
|
||||
->loadAllWhere('packageID IN (%Ld)', array_keys($packages));
|
||||
if (!$paths) {
|
||||
return array();
|
||||
if ($paths) {
|
||||
$repositories = id(new PhabricatorRepository())->loadAllWhere(
|
||||
'phid IN (%Ls)',
|
||||
array_unique(mpull($paths, 'getRepositoryPHID')));
|
||||
$repositories = mpull($repositories, 'getID', 'getPHID');
|
||||
|
||||
$branches = id(new PhabricatorRepositoryBranch())->loadAllWhere(
|
||||
'repositoryID IN (%Ld)',
|
||||
$repositories);
|
||||
$branches = mgroup($branches, 'getRepositoryID');
|
||||
}
|
||||
|
||||
$repositories = id(new PhabricatorRepository())->loadAllWhere(
|
||||
'phid IN (%Ls)',
|
||||
array_unique(mpull($paths, 'getRepositoryPHID')));
|
||||
$repositories = mpull($repositories, 'getID', 'getPHID');
|
||||
|
||||
$branches = id(new PhabricatorRepositoryBranch())->loadAllWhere(
|
||||
'repositoryID IN (%Ld)',
|
||||
$repositories);
|
||||
$branches = mgroup($branches, 'getRepositoryID');
|
||||
|
||||
$or = array();
|
||||
foreach ($paths as $path) {
|
||||
$branch = idx($branches, $repositories[$path->getRepositoryPHID()]);
|
||||
if ($branch) {
|
||||
@@ -207,9 +208,6 @@ final class DiffusionLintController extends DiffusionController {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$or) {
|
||||
return array();
|
||||
}
|
||||
$where[] = '('.implode(' OR ', $or).')';
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ final class DiffusionLintDetailsController extends DiffusionController {
|
||||
$messages = $this->loadLintMessages($branch, $limit, $offset);
|
||||
$is_dir = (substr('/'.$drequest->getPath(), -1) == '/');
|
||||
|
||||
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
|
||||
|
||||
$rows = array();
|
||||
foreach ($messages as $message) {
|
||||
$path = hsprintf(
|
||||
@@ -31,9 +33,15 @@ final class DiffusionLintDetailsController extends DiffusionController {
|
||||
)),
|
||||
$message['line']);
|
||||
|
||||
$author = $message['authorPHID'];
|
||||
if ($author && $authors[$author]) {
|
||||
$author = $authors[$author]->renderLink();
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
$path,
|
||||
$line,
|
||||
$author,
|
||||
ArcanistLintSeverity::getStringForSeverity($message['severity']),
|
||||
$message['name'],
|
||||
$message['description'],
|
||||
@@ -44,11 +52,12 @@ final class DiffusionLintDetailsController extends DiffusionController {
|
||||
->setHeaders(array(
|
||||
'Path',
|
||||
'Line',
|
||||
'Author',
|
||||
'Severity',
|
||||
'Name',
|
||||
'Description',
|
||||
))
|
||||
->setColumnClasses(array('', 'n', '', '', ''))
|
||||
->setColumnClasses(array('', 'n'))
|
||||
->setColumnVisibility(array($is_dir));
|
||||
|
||||
$content = array();
|
||||
|
||||
Reference in New Issue
Block a user