diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index 9b91bedb95..1068655a16 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -165,11 +165,13 @@ phutil_register_library_map(array(
'DiffusionHistoryTableView' => 'applications/diffusion/view/historytable',
'DiffusionHomeController' => 'applications/diffusion/controller/home',
'DiffusionPathChange' => 'applications/diffusion/data/pathchange',
+ 'DiffusionPathChangeQuery' => 'applications/diffusion/query/pathchange/base',
'DiffusionRepositoryController' => 'applications/diffusion/controller/repository',
'DiffusionRepositoryPath' => 'applications/diffusion/data/repositorypath',
'DiffusionRequest' => 'applications/diffusion/request/base',
'DiffusionSvnBrowseQuery' => 'applications/diffusion/query/browse/svn',
'DiffusionSvnHistoryQuery' => 'applications/diffusion/query/history/svn',
+ 'DiffusionSvnPathChangeQuery' => 'applications/diffusion/query/pathchange/svn',
'DiffusionView' => 'applications/diffusion/view/base',
'Javelin' => 'infrastructure/javelin/api',
'LiskDAO' => 'storage/lisk/dao',
@@ -487,6 +489,7 @@ phutil_register_library_map(array(
'DiffusionRepositoryController' => 'DiffusionController',
'DiffusionSvnBrowseQuery' => 'DiffusionBrowseQuery',
'DiffusionSvnHistoryQuery' => 'DiffusionHistoryQuery',
+ 'DiffusionSvnPathChangeQuery' => 'DiffusionPathChangeQuery',
'DiffusionView' => 'AphrontView',
'ManiphestController' => 'PhabricatorController',
'ManiphestDAO' => 'PhabricatorLiskDAO',
diff --git a/src/applications/diffusion/controller/base/DiffusionController.php b/src/applications/diffusion/controller/base/DiffusionController.php
index 43cd81b269..addf89fe5d 100644
--- a/src/applications/diffusion/controller/base/DiffusionController.php
+++ b/src/applications/diffusion/controller/base/DiffusionController.php
@@ -122,7 +122,7 @@ abstract class DiffusionController extends PhabricatorController {
$branch_uri = $drequest->getBranchURIComponent($drequest->getBranch());
- if (empty($spec['view'])) {
+ if (empty($spec['view']) && empty($spec['commit'])) {
$crumb_list[] = $repository_name;
$crumbs->setCrumbs($crumb_list);
return $crumbs;
@@ -135,8 +135,9 @@ abstract class DiffusionController extends PhabricatorController {
),
$repository_name);
-
- if (empty($spec['view'])) {
+ $raw_commit = $drequest->getRawCommit();
+ if (isset($spec['commit'])) {
+ $crumb_list[] = "r{$callsign}{$raw_commit}";
$crumbs->setCrumbs($crumb_list);
return $crumbs;
}
@@ -161,7 +162,6 @@ abstract class DiffusionController extends PhabricatorController {
$jump_href = $view_root_uri;
$view_tail_uri = null;
- $raw_commit = $drequest->getRawCommit();
if ($raw_commit) {
$view_tail_uri = ';'.$drequest->getCommitURIComponent($raw_commit);
}
diff --git a/src/applications/diffusion/controller/commit/DiffusionCommitController.php b/src/applications/diffusion/controller/commit/DiffusionCommitController.php
index 8151f861b8..e59ec1486e 100644
--- a/src/applications/diffusion/controller/commit/DiffusionCommitController.php
+++ b/src/applications/diffusion/controller/commit/DiffusionCommitController.php
@@ -19,34 +19,43 @@
class DiffusionCommitController extends DiffusionController {
public function processRequest() {
- $drequest = $this->diffusionRequest;
-
-
+ $drequest = $this->getDiffusionRequest();
+ $content = array();
+ $content[] = $this->buildCrumbs(array(
+ 'commit' => true,
+ ));
$detail_panel = new AphrontPanelView();
$detail_panel->setHeader('Revision Detail');
$detail_panel->appendChild('
'.$drequest->getCommit().'
');
+ $content[] = $detail_panel;
+
+ $change_query = DiffusionPathChangeQuery::newFromDiffusionRequest(
+ $drequest);
+ $changes = $change_query->loadChanges();
+
$change_table = new DiffusionCommitChangeTableView();
$change_table->setDiffusionRequest($drequest);
- $change_table->setPathChanges(array());
+ $change_table->setPathChanges($changes);
$change_panel = new AphrontPanelView();
$change_panel->setHeader('Changes');
$change_panel->appendChild($change_table);
+ $content[] = $change_panel;
+
+
$change_list =
''.
'(list of changes goes here)'.
'
';
+ $content[] = $change_list;
+
return $this->buildStandardPageResponse(
- array(
- $detail_panel,
- $change_panel,
- $change_list,
- ),
+ $content,
array(
'title' => 'Diffusion',
));
diff --git a/src/applications/diffusion/controller/commit/__init__.php b/src/applications/diffusion/controller/commit/__init__.php
index 8d10609002..5909d3351d 100644
--- a/src/applications/diffusion/controller/commit/__init__.php
+++ b/src/applications/diffusion/controller/commit/__init__.php
@@ -7,6 +7,7 @@
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
+phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
phutil_require_module('phabricator', 'applications/diffusion/view/commitchangetable');
phutil_require_module('phabricator', 'view/layout/panel');
diff --git a/src/applications/diffusion/data/pathchange/DiffusionPathChange.php b/src/applications/diffusion/data/pathchange/DiffusionPathChange.php
index ebd38224ef..96db9a0cd5 100644
--- a/src/applications/diffusion/data/pathchange/DiffusionPathChange.php
+++ b/src/applications/diffusion/data/pathchange/DiffusionPathChange.php
@@ -18,10 +18,51 @@
final class DiffusionPathChange {
+ private $path;
private $commitIdentifier;
private $commit;
private $commitData;
+ private $changeType;
+ private $fileType;
+ private $targetPath;
+
+ final public function setPath($path) {
+ $this->path = $path;
+ return $this;
+ }
+
+ final public function getPath() {
+ return $this->path;
+ }
+
+ public function setChangeType($change_type) {
+ $this->changeType = $change_type;
+ return $this;
+ }
+
+ public function getChangeType() {
+ return $this->changeType;
+ }
+
+ public function setFileType($file_type) {
+ $this->fileType = $file_type;
+ return $this;
+ }
+
+ public function getFileType() {
+ return $this->fileType;
+ }
+
+ public function setTargetPath($target_path) {
+ $this->targetPath = $target_path;
+ return $this;
+ }
+
+ public function getTargetPath() {
+ return $this->targetPath;
+ }
+
final public function setCommitIdentifier($commit) {
$this->commitIdentifier = $commit;
return $this;
diff --git a/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php b/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php
new file mode 100644
index 0000000000..7eab3736c4
--- /dev/null
+++ b/src/applications/diffusion/query/pathchange/base/DiffusionPathChangeQuery.php
@@ -0,0 +1,83 @@
+
+ }
+
+ final public static function newFromDiffusionRequest(
+ DiffusionRequest $request) {
+ $query = new DiffusionPathChangeQuery();
+ $query->request = $request;
+
+ return $query;
+ }
+
+ final protected function getRequest() {
+ return $this->request;
+ }
+
+ final public function loadChanges() {
+ return $this->executeQuery();
+ }
+
+ protected function executeQuery() {
+
+ $drequest = $this->getRequest();
+ $repository = $drequest->getRepository();
+
+ $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
+ 'repositoryID = %d AND commitIdentifier = %s',
+ $repository->getID(),
+ $drequest->getCommit());
+
+ $raw_changes = queryfx_all(
+ $repository->establishConnection('r'),
+ 'SELECT c.*, p.path pathName, t.path targetPathName
+ FROM %T c
+ LEFT JOIN %T p ON c.pathID = p.id
+ LEFT JOIN %T t on c.targetPathID = t.id
+ WHERE c.commitID = %d',
+ PhabricatorRepository::TABLE_PATHCHANGE,
+ PhabricatorRepository::TABLE_PATH,
+ PhabricatorRepository::TABLE_PATH,
+ $commit->getID());
+
+ $changes = array();
+
+ $raw_changes = isort($raw_changes, 'pathName');
+ foreach ($raw_changes as $raw_change) {
+ $type = $raw_change['changeType'];
+ if ($type == DifferentialChangeType::TYPE_CHILD) {
+ continue;
+ }
+
+ $change = new DiffusionPathChange();
+ $change->setPath(ltrim($raw_change['pathName'], '/'));
+ $change->setChangeType($raw_change['changeType']);
+ $change->setFileType($raw_change['fileType']);
+ $changes[] = $change;
+ }
+
+ return $changes;
+ }
+}
diff --git a/src/applications/diffusion/query/pathchange/base/__init__.php b/src/applications/diffusion/query/pathchange/base/__init__.php
new file mode 100644
index 0000000000..60c1bac746
--- /dev/null
+++ b/src/applications/diffusion/query/pathchange/base/__init__.php
@@ -0,0 +1,18 @@
+commit) {
- execx(
+ list($commit) = execx(
'(cd %s && %s rev-parse --verify %s)',
$local_path,
$git,
$this->commit);
+
+ // Beyond verifying them, expand commit short forms to full 40-character
+ // sha1s.
+ $this->commit = trim($commit);
+
list($contains) = execx(
'(cd %s && %s branch --contains %s)',
$local_path,
diff --git a/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php b/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php
index 863455aec6..4478a49572 100644
--- a/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php
+++ b/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php
@@ -29,10 +29,10 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
$rows = array();
foreach ($this->pathChanges as $change) {
$rows[] = array(
- 'browse',
- 'whatever',
- $change->getPath(), // TODO: link
- // TODO: etc etc
+ $this->linkHistory($change->getPath()),
+ $this->linkBrowse($change->getPath()),
+ '-',
+ phutil_escape_html($change->getPath()),
);
}
@@ -40,11 +40,13 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
$view->setHeaders(
array(
'History',
+ 'Browse',
'Change',
'Path',
));
$view->setColumnClasses(
array(
+ '',
'',
'',
'wide',
diff --git a/src/applications/diffusion/view/commitchangetable/__init__.php b/src/applications/diffusion/view/commitchangetable/__init__.php
index a8d32cb9ac..ec22041ef3 100644
--- a/src/applications/diffusion/view/commitchangetable/__init__.php
+++ b/src/applications/diffusion/view/commitchangetable/__init__.php
@@ -9,5 +9,7 @@
phutil_require_module('phabricator', 'applications/diffusion/view/base');
phutil_require_module('phabricator', 'view/control/table');
+phutil_require_module('phutil', 'markup');
+
phutil_require_source('DiffusionCommitChangeTableView.php');