diff --git a/resources/sql/patches/013.commitdetail.sql b/resources/sql/patches/013.commitdetail.sql new file mode 100644 index 0000000000..940a1717d4 --- /dev/null +++ b/resources/sql/patches/013.commitdetail.sql @@ -0,0 +1,2 @@ +ALTER TABLE phabricator_repository.repository_commitdata + ADD commitDetails LONGBLOB NOT NULL; diff --git a/src/applications/diffusion/controller/base/DiffusionController.php b/src/applications/diffusion/controller/base/DiffusionController.php index 6736571ba6..55ef58e9ac 100644 --- a/src/applications/diffusion/controller/base/DiffusionController.php +++ b/src/applications/diffusion/controller/base/DiffusionController.php @@ -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; } } diff --git a/src/applications/diffusion/controller/change/DiffusionChangeController.php b/src/applications/diffusion/controller/change/DiffusionChangeController.php index e6cb4318ab..5d73afcab7 100644 --- a/src/applications/diffusion/controller/change/DiffusionChangeController.php +++ b/src/applications/diffusion/controller/change/DiffusionChangeController.php @@ -47,7 +47,6 @@ class DiffusionChangeController extends DiffusionController { $changeset_view->render(). ''; - $nav = $this->buildSideNav('change', true); $nav->appendChild($content); diff --git a/src/applications/diffusion/controller/commit/DiffusionCommitController.php b/src/applications/diffusion/controller/commit/DiffusionCommitController.php index 575348a302..4f515f0e55 100644 --- a/src/applications/diffusion/controller/commit/DiffusionCommitController.php +++ b/src/applications/diffusion/controller/commit/DiffusionCommitController.php @@ -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(); diff --git a/src/applications/diffusion/controller/commit/__init__.php b/src/applications/diffusion/controller/commit/__init__.php index ac585c939a..578fd0f942 100644 --- a/src/applications/diffusion/controller/commit/__init__.php +++ b/src/applications/diffusion/controller/commit/__init__.php @@ -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'); diff --git a/src/applications/diffusion/query/diff/git/DiffusionGitDiffQuery.php b/src/applications/diffusion/query/diff/git/DiffusionGitDiffQuery.php index 38245cb4ba..38099827bd 100644 --- a/src/applications/diffusion/query/diff/git/DiffusionGitDiffQuery.php +++ b/src/applications/diffusion/query/diff/git/DiffusionGitDiffQuery.php @@ -49,7 +49,7 @@ final class DiffusionGitDiffQuery extends DiffusionDiffQuery { $changeset = reset($changesets); $id = - $drequest->getBranch().'/'. + $drequest->getBranchURIComponent($drequest->getBranch()). $drequest->getPath().';'. $drequest->getCommit(); diff --git a/src/applications/diffusion/query/diff/svn/__init__.php b/src/applications/diffusion/query/diff/svn/__init__.php index 17a8b4ac46..114f3781e6 100644 --- a/src/applications/diffusion/query/diff/svn/__init__.php +++ b/src/applications/diffusion/query/diff/svn/__init__.php @@ -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'); diff --git a/src/applications/diffusion/request/git/DiffusionGitRequest.php b/src/applications/diffusion/request/git/DiffusionGitRequest.php index 56351b65eb..f215aabfec 100644 --- a/src/applications/diffusion/request/git/DiffusionGitRequest.php +++ b/src/applications/diffusion/request/git/DiffusionGitRequest.php @@ -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!"); } diff --git a/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php b/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php index 72c11b1598..8d3623355c 100644 --- a/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php +++ b/src/applications/diffusion/view/commitchangetable/DiffusionCommitChangeTableView.php @@ -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, ); } diff --git a/src/applications/repository/storage/commitdata/PhabricatorRepositoryCommitData.php b/src/applications/repository/storage/commitdata/PhabricatorRepositoryCommitData.php index 1e4cf5e92b..119393a13f 100644 --- a/src/applications/repository/storage/commitdata/PhabricatorRepositoryCommitData.php +++ b/src/applications/repository/storage/commitdata/PhabricatorRepositoryCommitData.php @@ -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(); } diff --git a/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php b/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php index 87ce4a69d1..fade2cda75 100644 --- a/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php +++ b/src/applications/repository/worker/base/PhabricatorRepositoryCommitParserWorker.php @@ -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); } diff --git a/webroot/index.php b/webroot/index.php index 2c893c2060..42f60905c4 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -17,6 +17,7 @@ */ error_reporting(E_ALL | E_STRICT); +ini_set('memory_limit', -1); $env = getenv('PHABRICATOR_ENV'); // Apache if (!$env) {