mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 21:40:55 +01:00
More Diffusion junk.
This commit is contained in:
parent
793df0cfc5
commit
e6cf7a9cb0
12 changed files with 69 additions and 30 deletions
2
resources/sql/patches/013.commitdetail.sql
Normal file
2
resources/sql/patches/013.commitdetail.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE phabricator_repository.repository_commitdata
|
||||||
|
ADD commitDetails LONGBLOB NOT NULL;
|
|
@ -92,9 +92,14 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildCrumbs(array $spec = array()) {
|
public function buildCrumbs(array $spec = array()) {
|
||||||
$drequest = $this->diffusionRequest;
|
|
||||||
|
|
||||||
$crumbs = new AphrontCrumbsView();
|
$crumbs = new AphrontCrumbsView();
|
||||||
|
$crumb_list = $this->buildCrumbList($spec);
|
||||||
|
$crumbs->setCrumbs($crumb_list);
|
||||||
|
return $crumbs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildCrumbList(array $spec = array()) {
|
||||||
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
|
||||||
$crumb_list = array();
|
$crumb_list = array();
|
||||||
|
|
||||||
|
@ -108,8 +113,7 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
'Diffusion');
|
'Diffusion');
|
||||||
} else {
|
} else {
|
||||||
$crumb_list[] = 'Diffusion';
|
$crumb_list[] = 'Diffusion';
|
||||||
$crumbs->setCrumbs($crumb_list);
|
return $crumb_list;
|
||||||
return $crumbs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$callsign = $repository->getCallsign();
|
$callsign = $repository->getCallsign();
|
||||||
|
@ -124,8 +128,7 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
|
|
||||||
if (empty($spec['view']) && empty($spec['commit'])) {
|
if (empty($spec['view']) && empty($spec['commit'])) {
|
||||||
$crumb_list[] = $repository_name;
|
$crumb_list[] = $repository_name;
|
||||||
$crumbs->setCrumbs($crumb_list);
|
return $crumb_list;
|
||||||
return $crumbs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$crumb_list[] = phutil_render_tag(
|
$crumb_list[] = phutil_render_tag(
|
||||||
|
@ -138,8 +141,7 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
$raw_commit = $drequest->getRawCommit();
|
$raw_commit = $drequest->getRawCommit();
|
||||||
if (isset($spec['commit'])) {
|
if (isset($spec['commit'])) {
|
||||||
$crumb_list[] = "r{$callsign}{$raw_commit}";
|
$crumb_list[] = "r{$callsign}{$raw_commit}";
|
||||||
$crumbs->setCrumbs($crumb_list);
|
return $crumb_list;
|
||||||
return $crumbs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = $spec['view'];
|
$view = $spec['view'];
|
||||||
|
@ -167,8 +169,7 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
case 'change':
|
case 'change':
|
||||||
$view_name = 'Change';
|
$view_name = 'Change';
|
||||||
$crumb_list[] = phutil_escape_html($path).' ('.$commit_link.')';
|
$crumb_list[] = phutil_escape_html($path).' ('.$commit_link.')';
|
||||||
$crumbs->setCrumbs($crumb_list);
|
return $crumb_list;
|
||||||
return $crumbs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$view_root_uri = "/diffusion/{$callsign}/{$view}/{$branch_uri}";
|
$view_root_uri = "/diffusion/{$callsign}/{$view}/{$branch_uri}";
|
||||||
|
@ -231,10 +232,7 @@ abstract class DiffusionController extends PhabricatorController {
|
||||||
|
|
||||||
$crumb_list[] = $last_crumb;
|
$crumb_list[] = $last_crumb;
|
||||||
|
|
||||||
|
return $crumb_list;
|
||||||
$crumbs->setCrumbs($crumb_list);
|
|
||||||
|
|
||||||
return $crumbs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ class DiffusionChangeController extends DiffusionController {
|
||||||
$changeset_view->render().
|
$changeset_view->render().
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
|
|
||||||
$nav = $this->buildSideNav('change', true);
|
$nav = $this->buildSideNav('change', true);
|
||||||
$nav->appendChild($content);
|
$nav->appendChild($content);
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,28 @@ class DiffusionCommitController extends DiffusionController {
|
||||||
if ($changes) {
|
if ($changes) {
|
||||||
$changesets = DiffusionPathChange::convertToDifferentialChangesets(
|
$changesets = DiffusionPathChange::convertToDifferentialChangesets(
|
||||||
$changes);
|
$changes);
|
||||||
foreach ($changesets as $changeset) {
|
|
||||||
|
$vcs = $repository->getVersionControlSystem();
|
||||||
|
switch ($vcs) {
|
||||||
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||||
|
$vcs_supports_directory_changes = true;
|
||||||
|
break;
|
||||||
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
||||||
|
$vcs_supports_directory_changes = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Unknown VCS.");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($changesets as $key => $changeset) {
|
||||||
|
$file_type = $changeset->getFileType();
|
||||||
|
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
||||||
|
if (!$vcs_supports_directory_changes) {
|
||||||
|
unset($changesets[$key]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$branch = $drequest->getBranchURIComponent(
|
$branch = $drequest->getBranchURIComponent(
|
||||||
$drequest->getBranch());
|
$drequest->getBranch());
|
||||||
$filename = $changeset->getFilename();
|
$filename = $changeset->getFilename();
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
|
||||||
phutil_require_module('phabricator', 'applications/differential/parser/markup');
|
phutil_require_module('phabricator', 'applications/differential/parser/markup');
|
||||||
phutil_require_module('phabricator', 'applications/differential/view/changesetlistview');
|
phutil_require_module('phabricator', 'applications/differential/view/changesetlistview');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/data/pathchange');
|
phutil_require_module('phabricator', 'applications/diffusion/data/pathchange');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/view/commitchangetable');
|
phutil_require_module('phabricator', 'applications/diffusion/view/commitchangetable');
|
||||||
|
phutil_require_module('phabricator', 'applications/repository/constants/repositorytype');
|
||||||
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
||||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
|
|
|
@ -49,7 +49,7 @@ final class DiffusionGitDiffQuery extends DiffusionDiffQuery {
|
||||||
$changeset = reset($changesets);
|
$changeset = reset($changesets);
|
||||||
|
|
||||||
$id =
|
$id =
|
||||||
$drequest->getBranch().'/'.
|
$drequest->getBranchURIComponent($drequest->getBranch()).
|
||||||
$drequest->getPath().';'.
|
$drequest->getPath().';'.
|
||||||
$drequest->getCommit();
|
$drequest->getCommit();
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ phutil_require_module('arcanist', 'parser/diff');
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
|
phutil_require_module('phabricator', 'applications/differential/constants/changetype');
|
||||||
phutil_require_module('phabricator', 'applications/differential/storage/diff');
|
phutil_require_module('phabricator', 'applications/differential/storage/diff');
|
||||||
|
phutil_require_module('phabricator', 'applications/diffusion/data/pathchange');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/diff/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/diff/base');
|
||||||
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
|
phutil_require_module('phabricator', 'applications/diffusion/query/pathchange/base');
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,11 @@ class DiffusionGitRequest extends DiffusionRequest {
|
||||||
// sha1s.
|
// sha1s.
|
||||||
$this->commit = trim($commit);
|
$this->commit = trim($commit);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
TODO: Unclear if this is actually a good idea or not; it breaks commit views
|
||||||
|
at the very least.
|
||||||
|
|
||||||
list($contains) = execx(
|
list($contains) = execx(
|
||||||
'(cd %s && git branch --contains %s)',
|
'(cd %s && git branch --contains %s)',
|
||||||
$local_path,
|
$local_path,
|
||||||
|
@ -78,6 +83,8 @@ class DiffusionGitRequest extends DiffusionRequest {
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
"Commit does not exist on this branch!");
|
"Commit does not exist on this branch!");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +96,7 @@ class DiffusionGitRequest extends DiffusionRequest {
|
||||||
return $this->branch;
|
return $this->branch;
|
||||||
}
|
}
|
||||||
if ($this->repository) {
|
if ($this->repository) {
|
||||||
return $this->repository->getDetail('default-branch', 'master');
|
return $this->repository->getDetail('default-branch', 'origin/master');
|
||||||
}
|
}
|
||||||
throw new Exception("Unable to determine branch!");
|
throw new Exception("Unable to determine branch!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,19 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
|
||||||
$change_verb = DifferentialChangeType::getFullNameForChangeType(
|
$change_verb = DifferentialChangeType::getFullNameForChangeType(
|
||||||
$change->getChangeType());
|
$change->getChangeType());
|
||||||
|
|
||||||
$suffix = null;
|
|
||||||
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
|
|
||||||
$suffix = '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
$path = $change->getPath();
|
$path = $change->getPath();
|
||||||
$hash = substr(sha1($path), 0, 7);
|
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
|
||||||
|
$path_column = phutil_escape_html($path).'/';
|
||||||
|
} else {
|
||||||
|
$hash = substr(md5($path), 0, 8);
|
||||||
|
|
||||||
|
$path_column = phutil_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '#'.$hash,
|
||||||
|
),
|
||||||
|
phutil_escape_html($path));
|
||||||
|
}
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
$this->linkHistory($change->getPath()),
|
$this->linkHistory($change->getPath()),
|
||||||
|
@ -51,12 +57,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
|
||||||
$change->getChangeType(),
|
$change->getChangeType(),
|
||||||
$change->getFileType(),
|
$change->getFileType(),
|
||||||
$change->getPath()),
|
$change->getPath()),
|
||||||
phutil_render_tag(
|
$path_column,
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => '#'.$hash,
|
|
||||||
),
|
|
||||||
phutil_escape_html($path).$suffix),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,14 @@ class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
|
||||||
protected $commitID;
|
protected $commitID;
|
||||||
protected $authorName;
|
protected $authorName;
|
||||||
protected $commitMessage;
|
protected $commitMessage;
|
||||||
|
protected $commitDetails = array();
|
||||||
|
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_TIMESTAMPS => false,
|
self::CONFIG_TIMESTAMPS => false,
|
||||||
|
self::CONFIG_SERIALIZATION => array(
|
||||||
|
'commitDetails' => self::SERIALIZATION_JSON,
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ abstract class PhabricatorRepositoryCommitParserWorker
|
||||||
extends PhabricatorWorker {
|
extends PhabricatorWorker {
|
||||||
|
|
||||||
protected $commit;
|
protected $commit;
|
||||||
|
protected $repository;
|
||||||
|
|
||||||
final public function doWork() {
|
final public function doWork() {
|
||||||
$commit_id = $this->getTaskData();
|
$commit_id = $this->getTaskData();
|
||||||
|
@ -43,6 +44,8 @@ abstract class PhabricatorRepositoryCommitParserWorker
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->repository = $repository;
|
||||||
|
|
||||||
return $this->parseCommit($repository, $commit);
|
return $this->parseCommit($repository, $commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(E_ALL | E_STRICT);
|
||||||
|
ini_set('memory_limit', -1);
|
||||||
|
|
||||||
$env = getenv('PHABRICATOR_ENV'); // Apache
|
$env = getenv('PHABRICATOR_ENV'); // Apache
|
||||||
if (!$env) {
|
if (!$env) {
|
||||||
|
|
Loading…
Reference in a new issue