mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-27 05:59:08 +01:00
Summary: This commit doesn't change license of any file. It just makes the license implicit (inherited from LICENSE file in the root directory). We are removing the headers for these reasons: - It wastes space in editors, less code is visible in editor upon opening a file. - It brings noise to diff of the first change of any file every year. - It confuses Git file copy detection when creating small files. - We don't have an explicit license header in other files (JS, CSS, images, documentation). - Using license header in every file is not obligatory: http://www.apache.org/dev/apply-license.html#new. This change is approved by Alma Chao (Lead Open Source and IP Counsel at Facebook). Test Plan: Verified that the license survived only in LICENSE file and that it didn't modify externals. Reviewers: epriestley, davidrecordon Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2035 Differential Revision: https://secure.phabricator.com/D3886
102 lines
2.5 KiB
PHP
102 lines
2.5 KiB
PHP
<?php
|
|
|
|
final class DiffusionBranchTableView extends DiffusionView {
|
|
|
|
private $branches;
|
|
private $user;
|
|
private $commits = array();
|
|
|
|
public function setBranches(array $branches) {
|
|
assert_instances_of($branches, 'DiffusionBranchInformation');
|
|
$this->branches = $branches;
|
|
return $this;
|
|
}
|
|
|
|
public function setCommits(array $commits) {
|
|
$this->commits = mpull($commits, null, 'getCommitIdentifier');
|
|
return $this;
|
|
}
|
|
|
|
public function setUser(PhabricatorUser $user) {
|
|
$this->user = $user;
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
$drequest = $this->getDiffusionRequest();
|
|
$current_branch = $drequest->getBranch();
|
|
|
|
$rows = array();
|
|
$rowc = array();
|
|
foreach ($this->branches as $branch) {
|
|
$commit = idx($this->commits, $branch->getHeadCommitIdentifier());
|
|
if ($commit) {
|
|
$details = $commit->getCommitData()->getCommitMessage();
|
|
$details = idx(explode("\n", $details), 0);
|
|
$details = substr($details, 0, 80);
|
|
|
|
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
|
|
} else {
|
|
$datetime = null;
|
|
$details = null;
|
|
}
|
|
|
|
$rows[] = array(
|
|
phutil_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => $drequest->generateURI(
|
|
array(
|
|
'action' => 'history',
|
|
'branch' => $branch->getName(),
|
|
))
|
|
),
|
|
'History'
|
|
),
|
|
phutil_render_tag(
|
|
'a',
|
|
array(
|
|
'href' => $drequest->generateURI(
|
|
array(
|
|
'action' => 'browse',
|
|
'branch' => $branch->getName(),
|
|
)),
|
|
),
|
|
phutil_escape_html($branch->getName())),
|
|
self::linkCommit(
|
|
$drequest->getRepository(),
|
|
$branch->getHeadCommitIdentifier()),
|
|
$datetime,
|
|
AphrontTableView::renderSingleDisplayLine(
|
|
phutil_escape_html($details))
|
|
// TODO: etc etc
|
|
);
|
|
if ($branch->getName() == $current_branch) {
|
|
$rowc[] = 'highlighted';
|
|
} else {
|
|
$rowc[] = null;
|
|
}
|
|
}
|
|
|
|
$view = new AphrontTableView($rows);
|
|
$view->setHeaders(
|
|
array(
|
|
'History',
|
|
'Branch',
|
|
'Head',
|
|
'Modified',
|
|
'Details',
|
|
));
|
|
$view->setColumnClasses(
|
|
array(
|
|
'',
|
|
'pri',
|
|
'',
|
|
'',
|
|
'wide',
|
|
));
|
|
$view->setRowClasses($rowc);
|
|
return $view->render();
|
|
}
|
|
|
|
}
|