Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2896808
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
7 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/diffusion/view/base/DiffusionView.php b/src/applications/diffusion/view/base/DiffusionView.php
index ff1856345a..3cb5c8bc35 100644
--- a/src/applications/diffusion/view/base/DiffusionView.php
+++ b/src/applications/diffusion/view/base/DiffusionView.php
@@ -1,142 +1,145 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* 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.
*/
abstract class DiffusionView extends AphrontView {
private $diffusionRequest;
final public function setDiffusionRequest(DiffusionRequest $request) {
$this->diffusionRequest = $request;
return $this;
}
final public function getDiffusionRequest() {
return $this->diffusionRequest;
}
- final public function linkChange($change_type, $file_type, $path = null) {
+ final public function linkChange($change_type, $file_type, $path = null,
+ $commit_identifier = null) {
$text = DifferentialChangeType::getFullNameForChangeType($change_type);
if ($change_type == DifferentialChangeType::TYPE_CHILD) {
// TODO: Don't link COPY_AWAY without a direct change.
return $text;
}
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
return $text;
}
$drequest = $this->getDiffusionRequest();
- if ($drequest->getRawCommit()) {
+ if ($commit_identifier) {
+ $commit = ';'.$commit_identifier;
+ } else if ($drequest->getRawCommit()) {
$commit = ';'.$drequest->getCommitURIComponent($drequest->getRawCommit());
} else {
$commit = null;
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$branch = $drequest->getBranchURIComponent($drequest->getBranch());
$path = $branch.($path ? $path : $drequest->getPath());
return phutil_render_tag(
'a',
array(
'href' => "/diffusion/{$callsign}/change/{$path}{$commit}",
),
$text);
}
final public function linkHistory($path) {
$drequest = $this->getDiffusionRequest();
if ($drequest->getRawCommit()) {
$commit = ';'.$drequest->getCommitURIComponent($drequest->getRawCommit());
} else {
$commit = null;
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$branch = $drequest->getBranchURIComponent($drequest->getBranch());
$path = $branch.$path;
$text = 'History';
return phutil_render_tag(
'a',
array(
'href' => "/diffusion/{$callsign}/history/{$path}{$commit}",
),
$text);
}
final public function linkBrowse($path, array $details = array()) {
$drequest = $this->getDiffusionRequest();
$raw_commit = idx($details, 'commit', $drequest->getRawCommit());
if ($raw_commit) {
$commit = ';'.$drequest->getCommitURIComponent($raw_commit);
} else {
$commit = null;
}
$repository = $drequest->getRepository();
$callsign = $repository->getCallsign();
$branch = $drequest->getBranchURIComponent($drequest->getBranch());
$path = $branch.$path;
if (isset($details['text'])) {
$text = phutil_escape_html($details['text']);
} else {
$text = 'Browse';
}
return phutil_render_tag(
'a',
array(
'href' => "/diffusion/{$callsign}/browse/{$path}{$commit}",
),
$text);
}
final public static function linkCommit($repository, $commit) {
switch ($repository->getVersionControlSystem()) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
$commit_name = substr($commit, 0, 7);
break;
default:
$commit_name = $commit;
break;
}
$callsign = $repository->getCallsign();
$commit_name = "r{$callsign}{$commit_name}";
return phutil_render_tag(
'a',
array(
'href' => "/r{$callsign}{$commit}",
),
$commit_name);
}
}
diff --git a/src/applications/diffusion/view/historytable/DiffusionHistoryTableView.php b/src/applications/diffusion/view/historytable/DiffusionHistoryTableView.php
index dddb708669..283cf99828 100644
--- a/src/applications/diffusion/view/historytable/DiffusionHistoryTableView.php
+++ b/src/applications/diffusion/view/historytable/DiffusionHistoryTableView.php
@@ -1,107 +1,109 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* 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.
*/
final class DiffusionHistoryTableView extends DiffusionView {
private $history;
private $handles = array();
public function setHistory(array $history) {
$this->history = $history;
return $this;
}
public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
public function render() {
$drequest = $this->getDiffusionRequest();
$handles = $this->handles;
$rows = array();
foreach ($this->history as $history) {
$epoch = $history->getEpoch();
if ($epoch) {
$date = date('M j, Y', $epoch);
$time = date('g:i A', $epoch);
} else {
$date = null;
$time = null;
}
$data = $history->getCommitData();
$author_phid = null;
if ($data) {
$author_phid = $data->getCommitDetail('authorPHID');
}
if ($author_phid && isset($handles[$author_phid])) {
$author = $handles[$author_phid]->renderLink();
} else {
$author = phutil_escape_html($history->getAuthorName());
}
$rows[] = array(
$this->linkBrowse(
$drequest->getPath(),
array(
'commit' => $history->getCommitIdentifier(),
)),
self::linkCommit(
$drequest->getRepository(),
$history->getCommitIdentifier()),
$this->linkChange(
$history->getChangeType(),
- $history->getFileType()),
+ $history->getFileType(),
+ null,
+ $history->getCommitIdentifier()),
$date,
$time,
$author,
phutil_escape_html($history->getSummary()),
// TODO: etc etc
);
}
$view = new AphrontTableView($rows);
$view->setHeaders(
array(
'Browse',
'Commit',
'Change',
'Date',
'Time',
'Author',
'Details',
));
$view->setColumnClasses(
array(
'',
'n',
'',
'',
'right',
'',
'wide wrap',
));
return $view->render();
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jan 19 2025, 23:36 (6 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129969
Default Alt Text
(7 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment