diff --git a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php
index cd684cfef8..58ba4810e4 100644
--- a/src/applications/differential/parser/changeset/DifferentialChangesetParser.php
+++ b/src/applications/differential/parser/changeset/DifferentialChangesetParser.php
@@ -90,6 +90,10 @@ class DifferentialChangesetParser {
return $this;
}
+ public function getChangeset() {
+ return $this->changeset;
+ }
+
public function getChangesetID() {
return $this->changesetID;
}
@@ -858,10 +862,10 @@ EOSYNTHETIC;
}
protected function renderShield($message, $more) {
- $end = $this->getLength();
- $changeset_id = $this->getChangesetID();
if ($more) {
+ $end = $this->getLength();
+ $reference = $this->getChangeset()->getRenderingReference();
$more =
' '.
javelin_render_tag(
@@ -872,7 +876,7 @@ EOSYNTHETIC;
'class' => 'complete',
'href' => '#',
'meta' => array(
- 'id' => $changeset_id,
+ 'id' => $reference,
'range' => "0-{$end}",
),
),
@@ -958,6 +962,7 @@ EOSYNTHETIC;
$gaps = array_reverse($gaps);
$changeset = $this->changesetID;
+ $reference = $this->getChangeset()->getRenderingReference();
for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) {
if (empty($mask[$ii])) {
@@ -977,7 +982,7 @@ EOSYNTHETIC;
'mustcapture' => true,
'sigil' => 'show-more',
'meta' => array(
- 'id' => $changeset,
+ 'id' => $reference,
'range' => "{$top}-{$len}/{$top}-20",
),
),
@@ -991,7 +996,7 @@ EOSYNTHETIC;
'mustcapture' => true,
'sigil' => 'show-more',
'meta' => array(
- 'id' => $changeset,
+ 'id' => $reference,
'range' => "{$top}-{$len}/{$top}-{$len}",
),
),
@@ -1005,7 +1010,7 @@ EOSYNTHETIC;
'mustcapture' => true,
'sigil' => 'show-more',
'meta' => array(
- 'id' => $changeset,
+ 'id' => $reference,
'range' => "{$top}-{$len}/{$end}-20",
),
),
@@ -1067,13 +1072,13 @@ EOSYNTHETIC;
$html[] = $context_not_available;
}
- if ($o_num) {
+ if ($o_num && $changeset) {
$o_id = ' id="C'.$changeset.'OL'.$o_num.'"';
} else {
$o_id = null;
}
- if ($n_num) {
+ if ($n_num && $changeset) {
$n_id = ' id="C'.$changeset.'NL'.$n_num.'"';
} else {
$n_id = null;
diff --git a/src/applications/differential/storage/changeset/DifferentialChangeset.php b/src/applications/differential/storage/changeset/DifferentialChangeset.php
index 9fde61affb..14c2bb8e8c 100644
--- a/src/applications/differential/storage/changeset/DifferentialChangeset.php
+++ b/src/applications/differential/storage/changeset/DifferentialChangeset.php
@@ -32,6 +32,7 @@ class DifferentialChangeset extends DifferentialDAO {
private $unsavedHunks = array();
private $hunks;
+ private $renderingReference;
protected function getConfiguration() {
return array(
@@ -75,6 +76,18 @@ class DifferentialChangeset extends DifferentialDAO {
return $name;
}
+ public function setRenderingReference($rendering_reference) {
+ $this->renderingReference = $rendering_reference;
+ return $this;
+ }
+
+ public function getRenderingReference() {
+ if ($this->renderingReference) {
+ return $this->renderingReference;
+ }
+ return $this->getID();
+ }
+
public function addUnsavedHunk(DifferentialHunk $hunk) {
if ($this->hunks === null) {
$this->hunks = array();
diff --git a/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php b/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
index 66fa6dd472..1dc86e05d8 100644
--- a/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
+++ b/src/applications/differential/view/changesetlistview/DifferentialChangesetListView.php
@@ -70,10 +70,12 @@ class DifferentialChangesetListView extends AphrontView {
$vs_id = null;
}
- $detail_uri = new PhutilURI('/differential/changeset/');
+ $ref = $changeset->getRenderingReference();
+
+ $detail_uri = new PhutilURI($this->renderURI);
$detail_uri->setQueryParams(
array(
- 'id' => $id,
+ 'id' => $ref,
'vs' => $vs_id,
'whitespace' => 'TODO',
));
@@ -103,7 +105,7 @@ class DifferentialChangesetListView extends AphrontView {
$output[] = $detail->render();
$mapping[$uniq_id] = array(
- $changeset->getID(),
+ $ref,
$vs_id);
}
diff --git a/src/applications/diffusion/controller/commit/DiffusionCommitController.php b/src/applications/diffusion/controller/commit/DiffusionCommitController.php
index 0c62de6e0a..0c7f4ecfc8 100644
--- a/src/applications/diffusion/controller/commit/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/commit/DiffusionCommitController.php
@@ -21,6 +21,8 @@ class DiffusionCommitController extends DiffusionController {
public function processRequest() {
$drequest = $this->getDiffusionRequest();
+ $callsign = $drequest->getRepository()->getCallsign();
+
$content = array();
$content[] = $this->buildCrumbs(array(
'commit' => true,
@@ -43,7 +45,7 @@ class DiffusionCommitController extends DiffusionController {
$detail_panel->appendChild(
'
'.
'
'.
- 'r'.$repository->getCallsign().$commit->getCommitIdentifier().
+ 'r'.$callsign.$commit->getCommitIdentifier().
' · '.
date('F jS, Y g:i A', $commit->getEpoch()).
'
'.
@@ -82,7 +84,7 @@ class DiffusionCommitController extends DiffusionController {
id(new PhabricatorRepository())->establishConnection('r'),
'SELECT * FROM %T WHERE fullCommitName = %s',
PhabricatorRepository::TABLE_BADCOMMIT,
- 'r'.$repository->getCallsign().$commit->getCommitIdentifier());
+ 'r'.$callsign.$commit->getCommitIdentifier());
}
if ($bad_commit) {
@@ -100,11 +102,36 @@ class DiffusionCommitController extends DiffusionController {
$content[] = $change_panel;
- $change_list =
- '
'.
- '(list of changes goes here)'.
- '
';
+ if ($changes) {
+ $changesets = DiffusionPathChange::convertToDifferentialChangesets(
+ $changes);
+ foreach ($changesets as $changeset) {
+ $branch = $drequest->getBranchURIComponent(
+ $drequest->getBranch());
+ $filename = $changeset->getFilename();
+ $commit = $drequest->getCommit();
+ $reference = "{$branch}{$filename};{$commit}";
+ $changeset->setRenderingReference($reference);
+ }
+
+ $change_list = new DifferentialChangesetListView();
+ $change_list->setChangesets($changesets);
+ $change_list->setRenderURI('/diffusion/'.$callsign.'/diff/');
+
+ // TODO: This is pretty awkward, unify the CSS between Diffusion and
+ // Differential better.
+ require_celerity_resource('differential-core-view-css');
+ $change_list =
+ '
'.
+ $change_list->render().
+ '
';
+ } else {
+ $change_list =
+ '
'.
+ '(no changes blah blah)'.
+ '
';
+ }
$content[] = $change_list;
}
diff --git a/src/applications/diffusion/controller/commit/__init__.php b/src/applications/diffusion/controller/commit/__init__.php
index 6e629ab204..36ce108d3e 100644
--- a/src/applications/diffusion/controller/commit/__init__.php
+++ b/src/applications/diffusion/controller/commit/__init__.php
@@ -6,7 +6,9 @@
+phutil_require_module('phabricator', 'applications/differential/view/changesetlistview');
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
+phutil_require_module('phabricator', 'applications/diffusion/data/pathchange');
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
phutil_require_module('phabricator', 'applications/diffusion/view/commitchangetable');
phutil_require_module('phabricator', 'applications/repository/storage/repository');
diff --git a/src/applications/diffusion/data/pathchange/DiffusionPathChange.php b/src/applications/diffusion/data/pathchange/DiffusionPathChange.php
index 00e7d5e080..65d93d520b 100644
--- a/src/applications/diffusion/data/pathchange/DiffusionPathChange.php
+++ b/src/applications/diffusion/data/pathchange/DiffusionPathChange.php
@@ -125,5 +125,33 @@ final class DiffusionPathChange {
return substr($first, 0, 80);
}
+ final public static function convertToArcanistChanges(array $changes) {
+ $direct = array();
+ $result = array();
+ foreach ($changes as $path) {
+ $change = new ArcanistDiffChange();
+ $change->setCurrentPath($path->getPath());
+ $direct[] = $path->getPath();
+ $change->setType($path->getChangeType());
+ $file_type = $path->getFileType();
+ if ($file_type == DifferentialChangeType::FILE_NORMAL) {
+ $file_type = DifferentialChangeType::FILE_TEXT;
+ }
+ $change->setFileType($file_type);
+ $change->setOldPath($path->getTargetPath());
+ foreach ($path->getAwayPaths() as $away_path) {
+ $change->addAwayPath($away_path);
+ }
+ $result[$path->getPath()] = $change;
+ }
+
+ return array_select_keys($result, $direct);
+ }
+
+ final public static function convertToDifferentialChangesets(array $changes) {
+ $arcanist_changes = self::convertToArcanistChanges($changes);
+ $diff = DifferentialDiff::newFromRawChanges($arcanist_changes);
+ return $diff->getChangesets();
+ }
}
diff --git a/src/applications/diffusion/data/pathchange/__init__.php b/src/applications/diffusion/data/pathchange/__init__.php
index 0256f567bf..46cfbb20fa 100644
--- a/src/applications/diffusion/data/pathchange/__init__.php
+++ b/src/applications/diffusion/data/pathchange/__init__.php
@@ -6,6 +6,11 @@
+phutil_require_module('arcanist', 'parser/diff/change');
+
+phutil_require_module('phabricator', 'applications/differential/constants/changetype');
+phutil_require_module('phabricator', 'applications/differential/storage/diff');
+
phutil_require_module('phutil', 'utils');
diff --git a/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php b/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php
index ad3d91e901..f2bc4390b2 100644
--- a/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php
+++ b/src/applications/diffusion/query/diff/svn/DiffusionSvnDiffQuery.php
@@ -112,8 +112,8 @@ final class DiffusionSvnDiffQuery extends DiffusionDiffQuery {
$changesets = $diff->getChangesets();
$changeset = reset($changesets);
- $id = $drequest->getPath().';'.$drequest->getCommit();
- $changeset->setID($id);
+ $reference = $drequest->getPath().';'.$drequest->getCommit();
+ $changeset->setRenderingReference($reference);
return $changeset;
}