diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php index 48add69981..6843a1f243 100644 --- a/src/applications/differential/controller/DifferentialRevisionViewController.php +++ b/src/applications/differential/controller/DifferentialRevisionViewController.php @@ -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'); } diff --git a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php index 12ae748c37..213d7b3021 100644 --- a/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialBranchFieldSpecification.php @@ -28,7 +28,7 @@ final class DifferentialBranchFieldSpecification } public function renderValueForRevisionView() { - $diff = $this->getDiff(); + $diff = $this->getManualDiff(); $branch = $diff->getBranch(); $bookmark = $diff->getBookmark(); diff --git a/src/applications/differential/field/specification/DifferentialFieldSpecification.php b/src/applications/differential/field/specification/DifferentialFieldSpecification.php index 51057cd40c..92fcda63d9 100644 --- a/src/applications/differential/field/specification/DifferentialFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialFieldSpecification.php @@ -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 */ diff --git a/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php b/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php index be5125ef86..2d2f1a6bc9 100644 --- a/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialHostFieldSpecification.php @@ -28,7 +28,7 @@ final class DifferentialHostFieldSpecification } public function renderValueForRevisionView() { - $diff = $this->getDiff(); + $diff = $this->getManualDiff(); $host = $diff->getSourceMachine(); if (!$host) { return null; diff --git a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php index b2de5678d2..27ab0b1af8 100644 --- a/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialLintFieldSpecification.php @@ -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); } diff --git a/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php b/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php index 9a747b6aaa..60eecd365f 100644 --- a/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialPathFieldSpecification.php @@ -28,7 +28,7 @@ final class DifferentialPathFieldSpecification } public function renderValueForRevisionView() { - $diff = $this->getDiff(); + $diff = $this->getManualDiff(); $path = $diff->getSourcePath(); if (!$path) { diff --git a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php index 692df21c10..675fef3b51 100644 --- a/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php +++ b/src/applications/differential/field/specification/DifferentialUnitFieldSpecification.php @@ -36,7 +36,7 @@ final class DifferentialUnitFieldSpecification } public function renderValueForRevisionView() { - $diff = $this->getDiff(); + $diff = $this->getManualDiff(); $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff); $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);