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()) {
|
||||
$drequest = $this->diffusionRequest;
|
||||
|
||||
$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();
|
||||
|
||||
|
@ -108,8 +113,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
'Diffusion');
|
||||
} else {
|
||||
$crumb_list[] = 'Diffusion';
|
||||
$crumbs->setCrumbs($crumb_list);
|
||||
return $crumbs;
|
||||
return $crumb_list;
|
||||
}
|
||||
|
||||
$callsign = $repository->getCallsign();
|
||||
|
@ -124,8 +128,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
|
||||
if (empty($spec['view']) && empty($spec['commit'])) {
|
||||
$crumb_list[] = $repository_name;
|
||||
$crumbs->setCrumbs($crumb_list);
|
||||
return $crumbs;
|
||||
return $crumb_list;
|
||||
}
|
||||
|
||||
$crumb_list[] = phutil_render_tag(
|
||||
|
@ -138,8 +141,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
$raw_commit = $drequest->getRawCommit();
|
||||
if (isset($spec['commit'])) {
|
||||
$crumb_list[] = "r{$callsign}{$raw_commit}";
|
||||
$crumbs->setCrumbs($crumb_list);
|
||||
return $crumbs;
|
||||
return $crumb_list;
|
||||
}
|
||||
|
||||
$view = $spec['view'];
|
||||
|
@ -167,8 +169,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
case 'change':
|
||||
$view_name = 'Change';
|
||||
$crumb_list[] = phutil_escape_html($path).' ('.$commit_link.')';
|
||||
$crumbs->setCrumbs($crumb_list);
|
||||
return $crumbs;
|
||||
return $crumb_list;
|
||||
}
|
||||
|
||||
$view_root_uri = "/diffusion/{$callsign}/{$view}/{$branch_uri}";
|
||||
|
@ -231,10 +232,7 @@ abstract class DiffusionController extends PhabricatorController {
|
|||
|
||||
$crumb_list[] = $last_crumb;
|
||||
|
||||
|
||||
$crumbs->setCrumbs($crumb_list);
|
||||
|
||||
return $crumbs;
|
||||
return $crumb_list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ class DiffusionChangeController extends DiffusionController {
|
|||
$changeset_view->render().
|
||||
'</div>';
|
||||
|
||||
|
||||
$nav = $this->buildSideNav('change', true);
|
||||
$nav->appendChild($content);
|
||||
|
||||
|
|
|
@ -109,7 +109,28 @@ class DiffusionCommitController extends DiffusionController {
|
|||
if ($changes) {
|
||||
$changesets = DiffusionPathChange::convertToDifferentialChangesets(
|
||||
$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(
|
||||
$drequest->getBranch());
|
||||
$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/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/constants/repositorytype');
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
|
|
|
@ -49,7 +49,7 @@ final class DiffusionGitDiffQuery extends DiffusionDiffQuery {
|
|||
$changeset = reset($changesets);
|
||||
|
||||
$id =
|
||||
$drequest->getBranch().'/'.
|
||||
$drequest->getBranchURIComponent($drequest->getBranch()).
|
||||
$drequest->getPath().';'.
|
||||
$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/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/pathchange/base');
|
||||
|
||||
|
|
|
@ -61,6 +61,11 @@ class DiffusionGitRequest extends DiffusionRequest {
|
|||
// sha1s.
|
||||
$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(
|
||||
'(cd %s && git branch --contains %s)',
|
||||
$local_path,
|
||||
|
@ -78,6 +83,8 @@ class DiffusionGitRequest extends DiffusionRequest {
|
|||
throw new Exception(
|
||||
"Commit does not exist on this branch!");
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +96,7 @@ class DiffusionGitRequest extends DiffusionRequest {
|
|||
return $this->branch;
|
||||
}
|
||||
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!");
|
||||
}
|
||||
|
|
|
@ -36,13 +36,19 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
|
|||
$change_verb = DifferentialChangeType::getFullNameForChangeType(
|
||||
$change->getChangeType());
|
||||
|
||||
$suffix = null;
|
||||
if ($change->getFileType() == DifferentialChangeType::FILE_DIRECTORY) {
|
||||
$suffix = '/';
|
||||
}
|
||||
|
||||
$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(
|
||||
$this->linkHistory($change->getPath()),
|
||||
|
@ -51,12 +57,7 @@ final class DiffusionCommitChangeTableView extends DiffusionView {
|
|||
$change->getChangeType(),
|
||||
$change->getFileType(),
|
||||
$change->getPath()),
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '#'.$hash,
|
||||
),
|
||||
phutil_escape_html($path).$suffix),
|
||||
$path_column,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,10 +21,14 @@ class PhabricatorRepositoryCommitData extends PhabricatorRepositoryDAO {
|
|||
protected $commitID;
|
||||
protected $authorName;
|
||||
protected $commitMessage;
|
||||
protected $commitDetails = array();
|
||||
|
||||
public function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_TIMESTAMPS => false,
|
||||
self::CONFIG_SERIALIZATION => array(
|
||||
'commitDetails' => self::SERIALIZATION_JSON,
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ abstract class PhabricatorRepositoryCommitParserWorker
|
|||
extends PhabricatorWorker {
|
||||
|
||||
protected $commit;
|
||||
protected $repository;
|
||||
|
||||
final public function doWork() {
|
||||
$commit_id = $this->getTaskData();
|
||||
|
@ -43,6 +44,8 @@ abstract class PhabricatorRepositoryCommitParserWorker
|
|||
return;
|
||||
}
|
||||
|
||||
$this->repository = $repository;
|
||||
|
||||
return $this->parseCommit($repository, $commit);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
ini_set('memory_limit', -1);
|
||||
|
||||
$env = getenv('PHABRICATOR_ENV'); // Apache
|
||||
if (!$env) {
|
||||
|
|
Loading…
Reference in a new issue