2011-03-12 16:17:34 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/*
|
2012-01-20 13:27:32 -08:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-03-12 16:17:34 -08:00
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class DiffusionRepositoryController extends DiffusionController {
|
|
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
|
$drequest = $this->diffusionRequest;
|
|
|
|
|
|
|
|
|
|
$content = array();
|
|
|
|
|
|
|
|
|
|
$crumbs = $this->buildCrumbs();
|
|
|
|
|
$content[] = $crumbs;
|
|
|
|
|
|
|
|
|
|
$history_query = DiffusionHistoryQuery::newFromDiffusionRequest(
|
|
|
|
|
$drequest);
|
|
|
|
|
$history_query->setLimit(15);
|
|
|
|
|
$history = $history_query->loadHistory();
|
2011-04-02 16:39:23 -07:00
|
|
|
|
|
|
|
|
$browse_query = DiffusionBrowseQuery::newFromDiffusionRequest($drequest);
|
|
|
|
|
$browse_results = $browse_query->loadPaths();
|
|
|
|
|
|
|
|
|
|
$phids = array();
|
|
|
|
|
|
|
|
|
|
foreach ($history as $item) {
|
|
|
|
|
$data = $item->getCommitData();
|
|
|
|
|
if ($data) {
|
|
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
|
$phids[$data->getCommitDetail('authorPHID')] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($browse_results as $item) {
|
|
|
|
|
$data = $item->getLastCommitData();
|
|
|
|
|
if ($data) {
|
|
|
|
|
if ($data->getCommitDetail('authorPHID')) {
|
|
|
|
|
$phids[$data->getCommitDetail('authorPHID')] = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$phids = array_keys($phids);
|
|
|
|
|
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
|
|
|
|
|
2011-03-12 16:17:34 -08:00
|
|
|
$history_table = new DiffusionHistoryTableView();
|
|
|
|
|
$history_table->setDiffusionRequest($drequest);
|
2011-04-02 16:39:23 -07:00
|
|
|
$history_table->setHandles($handles);
|
2011-03-12 16:17:34 -08:00
|
|
|
$history_table->setHistory($history);
|
|
|
|
|
|
2011-03-12 22:51:40 -08:00
|
|
|
$callsign = $drequest->getRepository()->getCallsign();
|
|
|
|
|
$all = phutil_render_tag(
|
|
|
|
|
'a',
|
|
|
|
|
array(
|
|
|
|
|
'href' => "/diffusion/{$callsign}/history/",
|
|
|
|
|
),
|
|
|
|
|
'View Full Commit History');
|
|
|
|
|
|
2011-03-12 16:17:34 -08:00
|
|
|
$panel = new AphrontPanelView();
|
2011-03-12 22:51:40 -08:00
|
|
|
$panel->setHeader("Recent Commits · {$all}");
|
2011-03-12 16:17:34 -08:00
|
|
|
$panel->appendChild($history_table);
|
|
|
|
|
|
|
|
|
|
$content[] = $panel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$browse_table = new DiffusionBrowseTableView();
|
|
|
|
|
$browse_table->setDiffusionRequest($drequest);
|
2011-04-02 16:39:23 -07:00
|
|
|
$browse_table->setHandles($handles);
|
|
|
|
|
$browse_table->setPaths($browse_results);
|
2011-03-12 16:17:34 -08:00
|
|
|
|
|
|
|
|
$browse_panel = new AphrontPanelView();
|
|
|
|
|
$browse_panel->setHeader('Browse Repository');
|
|
|
|
|
$browse_panel->appendChild($browse_table);
|
|
|
|
|
|
|
|
|
|
$content[] = $browse_panel;
|
|
|
|
|
|
|
|
|
|
if ($drequest->getBranch() !== null) {
|
|
|
|
|
$branch_query = DiffusionBranchQuery::newFromDiffusionRequest($drequest);
|
|
|
|
|
$branches = $branch_query->loadBranches();
|
|
|
|
|
|
|
|
|
|
$branch_table = new DiffusionBranchTableView();
|
|
|
|
|
$branch_table->setDiffusionRequest($drequest);
|
|
|
|
|
$branch_table->setBranches($branches);
|
|
|
|
|
|
|
|
|
|
$branch_panel = new AphrontPanelView();
|
|
|
|
|
$branch_panel->setHeader('Branches');
|
|
|
|
|
$branch_panel->appendChild($branch_table);
|
|
|
|
|
|
|
|
|
|
$content[] = $branch_panel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->buildStandardPageResponse(
|
|
|
|
|
$content,
|
|
|
|
|
array(
|
2012-01-20 13:27:32 -08:00
|
|
|
'title' => $drequest->getRepository()->getName(),
|
2011-03-12 16:17:34 -08:00
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|