1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

Link manual diff from lint error displayed at commit diff

Summary:
Some fields require displayed diff (e.g. Lines), some require last manual diff (Lint, Unit).
Lint requires both - it needs to find if the line with the error is displayed or not.

Test Plan: Displayed committed diff with lint errors, clicked on them, got last manual diff at the correct line.

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3331
This commit is contained in:
vrana 2012-08-17 17:46:16 -07:00
parent 1752435255
commit a64f5b0148
7 changed files with 33 additions and 7 deletions

View file

@ -84,6 +84,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
list($aux_fields, $props) = $this->loadAuxiliaryFieldsAndProperties(
$revision,
$target,
$target_manual,
array(
'local:commits',
@ -736,6 +737,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
private function loadAuxiliaryFieldsAndProperties(
DifferentialRevision $revision,
DifferentialDiff $diff,
DifferentialDiff $manual_diff,
array $special_properties) {
$aux_fields = DifferentialFieldSelector::newSelector()
@ -755,6 +757,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
$aux_props = array();
foreach ($aux_fields as $key => $aux_field) {
$aux_field->setDiff($diff);
$aux_field->setManualDiff($manual_diff);
$aux_props[$key] = $aux_field->getRequiredDiffProperties();
}
@ -767,7 +770,7 @@ final class DifferentialRevisionViewController extends DifferentialController {
if ($required_properties) {
$properties = id(new DifferentialDiffProperty())->loadAllWhere(
'diffID = %d AND name IN (%Ls)',
$diff->getID(),
$manual_diff->getID(),
$required_properties);
$property_map = mpull($properties, 'getData', 'getName');
}

View file

@ -28,7 +28,7 @@ final class DifferentialBranchFieldSpecification
}
public function renderValueForRevisionView() {
$diff = $this->getDiff();
$diff = $this->getManualDiff();
$branch = $diff->getBranch();
$bookmark = $diff->getBookmark();

View file

@ -38,6 +38,7 @@ abstract class DifferentialFieldSpecification {
private $revision;
private $diff;
private $manualDiff;
private $handles;
private $diffProperties;
private $user;
@ -788,6 +789,14 @@ abstract class DifferentialFieldSpecification {
return $this;
}
/**
* @task context
*/
final public function setManualDiff(DifferentialDiff $diff) {
$this->manualDiff = $diff;
return $this;
}
/**
* @task context
*/
@ -833,6 +842,16 @@ abstract class DifferentialFieldSpecification {
return $this->diff;
}
/**
* @task context
*/
final protected function getManualDiff() {
if (!$this->manualDiff) {
return $this->getDiff();
}
return $this->manualDiff;
}
/**
* @task context
*/

View file

@ -28,7 +28,7 @@ final class DifferentialHostFieldSpecification
}
public function renderValueForRevisionView() {
$diff = $this->getDiff();
$diff = $this->getManualDiff();
$host = $diff->getSourceMachine();
if (!$host) {
return null;

View file

@ -40,7 +40,7 @@ final class DifferentialLintFieldSpecification
}
public function renderValueForRevisionView() {
$diff = $this->getDiff();
$diff = $this->getManualDiff();
$path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename');
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
@ -92,10 +92,14 @@ final class DifferentialLintFieldSpecification
$line_link = 'line '.intval($line);
if (isset($path_changesets[$path])) {
$href = '#C'.$path_changesets[$path].'NL'.max(1, $line);
if ($diff->getID() != $this->getDiff()->getID()) {
$href = '/D'.$diff->getRevisionID().'?id='.$diff->getID().$href;
}
$line_link = phutil_render_tag(
'a',
array(
'href' => '#C'.$path_changesets[$path].'NL'.max(1, $line),
'href' => $href,
),
$line_link);
}

View file

@ -28,7 +28,7 @@ final class DifferentialPathFieldSpecification
}
public function renderValueForRevisionView() {
$diff = $this->getDiff();
$diff = $this->getManualDiff();
$path = $diff->getSourcePath();
if (!$path) {

View file

@ -36,7 +36,7 @@ final class DifferentialUnitFieldSpecification
}
public function renderValueForRevisionView() {
$diff = $this->getDiff();
$diff = $this->getManualDiff();
$ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
$umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);