1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Show more information on revision views

Summary:
Show line count, arcanist project and base revision.

This adds a little clutter but I think we're still okay and I can play around
with it later.

Test Plan: Looked at a couple of revisions. I'm actually not 100% sure about the
SVN logic but maybe I will test that before committing.
Reviewed By: tomo
Reviewers: tomo, jungejason, tuomaspelkonen, aran
CC: aran, tomo
Differential Revision: 685
This commit is contained in:
epriestley 2011-07-16 18:44:48 -07:00
parent 4a3ebd9a68
commit 5e00d00cf7
4 changed files with 81 additions and 26 deletions

View file

@ -99,6 +99,10 @@ class DifferentialRevisionViewController extends DifferentialController {
}
}
if ($target->getArcanistProjectPHID()) {
$object_phids[] = $target->getArcanistProjectPHID();
}
foreach ($revision->getAttached() as $type => $phids) {
foreach ($phids as $phid => $info) {
$object_phids[] = $phid;
@ -457,6 +461,13 @@ class DifferentialRevisionViewController extends DifferentialController {
$properties['Commits'] = implode('<br />', $links);
}
$properties['Lines'] = number_format($diff->getLineCount());
$arcanist_phid = $diff->getArcanistProjectPHID();
if ($arcanist_phid) {
$properties['Arcanist Project'] = phutil_escape_html(
$handles[$arcanist_phid]->getName());
}
$properties['Apply Patch'] =
'<tt>arc patch D'.$revision->getID().'</tt>';
$properties['Export Patch'] =

View file

@ -75,6 +75,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$rows = array();
$disable = false;
$radios = array();
$last_base = null;
foreach ($data as $row) {
$name = phutil_escape_html($row['name']);
@ -123,7 +124,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$old = null;
}
$desc = phutil_escape_html($row['desc']);
$desc = $row['desc'];
if ($row['age']) {
$age = phabricator_format_timestamp($row['age']);
} else {
@ -144,11 +146,18 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$unit = null;
}
$base = $this->renderBaseRevision($diff);
if ($last_base !== null && $base !== $last_base) {
// TODO: Render some kind of notice about rebases.
}
$last_base = $base;
$rows[] =
'<tr'.$class.'>'.
'<td class="revhistory-name">'.$name.'</td>'.
'<td class="revhistory-id">'.$id.'</td>'.
'<td class="revhistory-desc">'.$desc.'</td>'.
'<td class="revhistory-base">'.phutil_escape_html($base).'</td>'.
'<td class="revhistory-desc">'.phutil_escape_html($desc).'</td>'.
'<td class="revhistory-age">'.$age.'</td>'.
'<td class="revhistory-star">'.$lint.'</td>'.
'<td class="revhistory-star">'.$unit.'</td>'.
@ -157,31 +166,31 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'</tr>';
}
Javelin::initBehavior(
'differential-diff-radios',
Javelin::initBehavior(
'differential-diff-radios',
array(
'radios' => $radios,
));
$options = array(
'ignore-all' => 'Ignore All',
'ignore-trailing' => 'Ignore Trailing',
'show-all' => 'Show All',
);
$select = '<select name="whitespace">';
foreach ($options as $value => $label) {
$select .= phutil_render_tag(
'option',
array(
'radios' => $radios,
));
$options = array(
'ignore-all' => 'Ignore All',
'ignore-trailing' => 'Ignore Trailing',
'show-all' => 'Show All',
);
$select = '<select name="whitespace">';
foreach ($options as $value => $label) {
$select .= phutil_render_tag(
'option',
array(
'value' => $value,
'selected' => ($value == $this->selectedWhitespace)
? 'selected'
: null,
),
phutil_escape_html($label));
}
$select .= '</select>';
'value' => $value,
'selected' => ($value == $this->selectedWhitespace)
? 'selected'
: null,
),
phutil_escape_html($label));
}
$select .= '</select>';
return
'<div class="differential-revision-history differential-panel">'.
@ -191,6 +200,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'<tr>'.
'<th>Diff</th>'.
'<th>ID</th>'.
'<th>Base</th>'.
'<th>Description</th>'.
'<th>Created</th>'.
'<th>Lint</th>'.
@ -285,4 +295,17 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'</span>';
}
private function renderBaseRevision(DifferentialDiff $diff) {
switch ($diff->getSourceControlSystem()) {
case 'git':
return substr($diff->getSourceControlBaseRevision(), 0, 7);
case 'svn':
$base = $diff->getSourceControlBaseRevision();
$base = explode('@', $base);
$base = end($base);
return $base;
default:
return null;
}
}
}

View file

@ -33,5 +33,6 @@ final class PhabricatorPHIDConstants {
const PHID_TYPE_STRY = 'STRY';
const PHID_TYPE_POLL = 'POLL';
const PHID_TYPE_WIKI = 'WIKI';
const PHID_TYPE_APRJ = 'APRJ';
}

View file

@ -345,6 +345,26 @@ class PhabricatorObjectHandleData {
$handles[$phid] = $handle;
}
break;
case PhabricatorPHIDConstants::PHID_TYPE_APRJ:
$project_dao = newv('PhabricatorRepositoryArcanistProject', array());
$projects = $project_dao->loadAllWhere(
'phid IN (%Ls)',
$phids);
$projects = mpull($projects, null, 'getPHID');
foreach ($phids as $phid) {
$handle = new PhabricatorObjectHandle();
$handle->setPHID($phid);
$handle->setType($type);
if (empty($projects[$phid])) {
$handle->setName('Unknown Arcanist Project');
} else {
$project = $projects[$phid];
$handle->setName($project->getName());
}
$handles[$phid] = $handle;
}
break;
case PhabricatorPHIDConstants::PHID_TYPE_WIKI:
$document_dao = newv('PhrictionDocument', array());
$content_dao = newv('PhrictionContent', array());