1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 02:12: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 ($revision->getAttached() as $type => $phids) {
foreach ($phids as $phid => $info) { foreach ($phids as $phid => $info) {
$object_phids[] = $phid; $object_phids[] = $phid;
@ -457,6 +461,13 @@ class DifferentialRevisionViewController extends DifferentialController {
$properties['Commits'] = implode('<br />', $links); $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'] = $properties['Apply Patch'] =
'<tt>arc patch D'.$revision->getID().'</tt>'; '<tt>arc patch D'.$revision->getID().'</tt>';
$properties['Export Patch'] = $properties['Export Patch'] =

View file

@ -75,6 +75,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$rows = array(); $rows = array();
$disable = false; $disable = false;
$radios = array(); $radios = array();
$last_base = null;
foreach ($data as $row) { foreach ($data as $row) {
$name = phutil_escape_html($row['name']); $name = phutil_escape_html($row['name']);
@ -123,7 +124,8 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$old = null; $old = null;
} }
$desc = phutil_escape_html($row['desc']); $desc = $row['desc'];
if ($row['age']) { if ($row['age']) {
$age = phabricator_format_timestamp($row['age']); $age = phabricator_format_timestamp($row['age']);
} else { } else {
@ -144,11 +146,18 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
$unit = null; $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[] = $rows[] =
'<tr'.$class.'>'. '<tr'.$class.'>'.
'<td class="revhistory-name">'.$name.'</td>'. '<td class="revhistory-name">'.$name.'</td>'.
'<td class="revhistory-id">'.$id.'</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-age">'.$age.'</td>'.
'<td class="revhistory-star">'.$lint.'</td>'. '<td class="revhistory-star">'.$lint.'</td>'.
'<td class="revhistory-star">'.$unit.'</td>'. '<td class="revhistory-star">'.$unit.'</td>'.
@ -157,31 +166,31 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'</tr>'; '</tr>';
} }
Javelin::initBehavior( Javelin::initBehavior(
'differential-diff-radios', '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( array(
'radios' => $radios, 'value' => $value,
)); 'selected' => ($value == $this->selectedWhitespace)
? 'selected'
$options = array( : null,
'ignore-all' => 'Ignore All', ),
'ignore-trailing' => 'Ignore Trailing', phutil_escape_html($label));
'show-all' => 'Show All', }
); $select .= '</select>';
$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>';
return return
'<div class="differential-revision-history differential-panel">'. '<div class="differential-revision-history differential-panel">'.
@ -191,6 +200,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'<tr>'. '<tr>'.
'<th>Diff</th>'. '<th>Diff</th>'.
'<th>ID</th>'. '<th>ID</th>'.
'<th>Base</th>'.
'<th>Description</th>'. '<th>Description</th>'.
'<th>Created</th>'. '<th>Created</th>'.
'<th>Lint</th>'. '<th>Lint</th>'.
@ -285,4 +295,17 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
'</span>'; '</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_STRY = 'STRY';
const PHID_TYPE_POLL = 'POLL'; const PHID_TYPE_POLL = 'POLL';
const PHID_TYPE_WIKI = 'WIKI'; const PHID_TYPE_WIKI = 'WIKI';
const PHID_TYPE_APRJ = 'APRJ';
} }

View file

@ -345,6 +345,26 @@ class PhabricatorObjectHandleData {
$handles[$phid] = $handle; $handles[$phid] = $handle;
} }
break; 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: case PhabricatorPHIDConstants::PHID_TYPE_WIKI:
$document_dao = newv('PhrictionDocument', array()); $document_dao = newv('PhrictionDocument', array());
$content_dao = newv('PhrictionContent', array()); $content_dao = newv('PhrictionContent', array());