2011-01-27 23:55:52 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|
|
|
|
|
|
|
private $diffs = array();
|
2011-02-03 22:20:43 +01:00
|
|
|
private $selectedVersusDiffID;
|
|
|
|
private $selectedDiffID;
|
2011-04-18 22:38:54 +02:00
|
|
|
private $selectedWhitespace;
|
2014-04-02 22:18:11 +02:00
|
|
|
private $commitsForLinks = array();
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2012-05-22 02:55:35 +02:00
|
|
|
public function setDiffs(array $diffs) {
|
|
|
|
assert_instances_of($diffs, 'DifferentialDiff');
|
2011-01-27 23:55:52 +01:00
|
|
|
$this->diffs = $diffs;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-02-03 22:20:43 +01:00
|
|
|
public function setSelectedVersusDiffID($id) {
|
|
|
|
$this->selectedVersusDiffID = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setSelectedDiffID($id) {
|
|
|
|
$this->selectedDiffID = $id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-04-18 22:38:54 +02:00
|
|
|
public function setSelectedWhitespace($whitespace) {
|
|
|
|
$this->selectedWhitespace = $whitespace;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-04-02 22:18:11 +02:00
|
|
|
public function setCommitsForLinks(array $commits) {
|
|
|
|
assert_instances_of($commits, 'PhabricatorRepositoryCommit');
|
|
|
|
$this->commitsForLinks = $commits;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-01-27 23:55:52 +01:00
|
|
|
public function render() {
|
|
|
|
|
2014-01-02 20:59:35 +01:00
|
|
|
$this->requireResource('differential-core-view-css');
|
|
|
|
$this->requireResource('differential-revision-history-css');
|
2011-01-27 23:55:52 +01:00
|
|
|
|
|
|
|
$data = array(
|
|
|
|
array(
|
|
|
|
'name' => 'Base',
|
|
|
|
'id' => null,
|
|
|
|
'desc' => 'Base',
|
|
|
|
'age' => null,
|
2011-02-05 02:53:14 +01:00
|
|
|
'obj' => null,
|
2011-01-27 23:55:52 +01:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
$seq = 0;
|
|
|
|
foreach ($this->diffs as $diff) {
|
|
|
|
$data[] = array(
|
|
|
|
'name' => 'Diff '.(++$seq),
|
|
|
|
'id' => $diff->getID(),
|
2011-02-05 02:53:14 +01:00
|
|
|
'desc' => $diff->getDescription(),
|
2011-01-27 23:55:52 +01:00
|
|
|
'age' => $diff->getDateCreated(),
|
2011-02-05 02:53:14 +01:00
|
|
|
'obj' => $diff,
|
2011-01-27 23:55:52 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-02-03 22:20:43 +01:00
|
|
|
$max_id = $diff->getID();
|
|
|
|
|
2011-01-27 23:55:52 +01:00
|
|
|
$idx = 0;
|
|
|
|
$rows = array();
|
2011-02-04 00:41:58 +01:00
|
|
|
$disable = false;
|
|
|
|
$radios = array();
|
2011-07-17 03:44:48 +02:00
|
|
|
$last_base = null;
|
2014-03-12 19:39:43 +01:00
|
|
|
$rowc = array();
|
2011-01-27 23:55:52 +01:00
|
|
|
foreach ($data as $row) {
|
|
|
|
|
2012-01-31 21:07:41 +01:00
|
|
|
$diff = $row['obj'];
|
2012-02-06 19:55:55 +01:00
|
|
|
$name = $row['name'];
|
|
|
|
$id = $row['id'];
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2014-03-12 19:39:43 +01:00
|
|
|
$old_class = false;
|
|
|
|
$new_class = false;
|
2011-02-03 22:20:43 +01:00
|
|
|
|
2011-02-04 00:41:58 +01:00
|
|
|
if ($id) {
|
|
|
|
$new_checked = ($this->selectedDiffID == $id);
|
2013-01-25 21:57:17 +01:00
|
|
|
$new = javelin_tag(
|
2011-02-04 00:41:58 +01:00
|
|
|
'input',
|
|
|
|
array(
|
|
|
|
'type' => 'radio',
|
|
|
|
'name' => 'id',
|
|
|
|
'value' => $id,
|
|
|
|
'checked' => $new_checked ? 'checked' : null,
|
|
|
|
'sigil' => 'differential-new-radio',
|
|
|
|
));
|
|
|
|
if ($new_checked) {
|
2014-03-12 19:39:43 +01:00
|
|
|
$new_class = true;
|
2011-02-04 00:41:58 +01:00
|
|
|
$disable = true;
|
|
|
|
}
|
2014-03-12 19:39:43 +01:00
|
|
|
$new = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-update-history-radio',
|
|
|
|
),
|
|
|
|
$new);
|
2011-02-04 00:41:58 +01:00
|
|
|
} else {
|
|
|
|
$new = null;
|
|
|
|
}
|
|
|
|
|
2011-02-03 22:20:43 +01:00
|
|
|
if ($max_id != $id) {
|
|
|
|
$uniq = celerity_generate_unique_node_id();
|
|
|
|
$old_checked = ($this->selectedVersusDiffID == $id);
|
2013-01-18 03:39:02 +01:00
|
|
|
$old = phutil_tag(
|
2011-02-03 22:20:43 +01:00
|
|
|
'input',
|
|
|
|
array(
|
|
|
|
'type' => 'radio',
|
|
|
|
'name' => 'vs',
|
2011-02-04 00:41:58 +01:00
|
|
|
'value' => $id,
|
2011-02-03 22:20:43 +01:00
|
|
|
'id' => $uniq,
|
|
|
|
'checked' => $old_checked ? 'checked' : null,
|
2011-02-04 00:41:58 +01:00
|
|
|
'disabled' => $disable ? 'disabled' : null,
|
2011-02-03 22:20:43 +01:00
|
|
|
));
|
|
|
|
$radios[] = $uniq;
|
|
|
|
if ($old_checked) {
|
2014-03-12 19:39:43 +01:00
|
|
|
$old_class = true;
|
2011-02-03 22:20:43 +01:00
|
|
|
}
|
2014-03-12 19:39:43 +01:00
|
|
|
$old = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-update-history-radio',
|
|
|
|
),
|
|
|
|
$old);
|
2011-02-03 22:20:43 +01:00
|
|
|
} else {
|
|
|
|
$old = null;
|
|
|
|
}
|
|
|
|
|
2011-07-17 03:44:48 +02:00
|
|
|
$desc = $row['desc'];
|
|
|
|
|
2011-02-05 02:53:14 +01:00
|
|
|
if ($row['age']) {
|
2011-12-04 01:36:19 +01:00
|
|
|
$age = phabricator_datetime($row['age'], $this->getUser());
|
2011-02-05 02:53:14 +01:00
|
|
|
} else {
|
|
|
|
$age = null;
|
|
|
|
}
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2012-01-31 21:07:41 +01:00
|
|
|
if ($diff) {
|
2011-02-05 02:53:14 +01:00
|
|
|
$lint = self::renderDiffLintStar($row['obj']);
|
2014-03-12 19:39:43 +01:00
|
|
|
$lint = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'lintunit-star',
|
|
|
|
'title' => self::getDiffLintMessage($diff),
|
|
|
|
),
|
|
|
|
$lint);
|
|
|
|
|
2011-02-05 02:53:14 +01:00
|
|
|
$unit = self::renderDiffUnitStar($row['obj']);
|
2014-03-12 19:39:43 +01:00
|
|
|
$unit = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'lintunit-star',
|
|
|
|
'title' => self::getDiffUnitMessage($diff),
|
|
|
|
),
|
|
|
|
$unit);
|
|
|
|
|
2012-01-31 21:07:41 +01:00
|
|
|
$base = $this->renderBaseRevision($diff);
|
2011-02-05 02:53:14 +01:00
|
|
|
} else {
|
|
|
|
$lint = null;
|
|
|
|
$unit = null;
|
2012-01-31 21:07:41 +01:00
|
|
|
$base = null;
|
2011-02-05 02:53:14 +01:00
|
|
|
}
|
|
|
|
|
2011-07-17 03:44:48 +02:00
|
|
|
if ($last_base !== null && $base !== $last_base) {
|
|
|
|
// TODO: Render some kind of notice about rebases.
|
|
|
|
}
|
|
|
|
$last_base = $base;
|
|
|
|
|
2013-01-18 03:43:35 +01:00
|
|
|
$id_link = phutil_tag(
|
2012-11-16 20:48:17 +01:00
|
|
|
'a',
|
2013-02-08 21:07:44 +01:00
|
|
|
array(
|
2014-03-12 19:39:43 +01:00
|
|
|
'href' => '/differential/diff/'.$id.'/',
|
|
|
|
),
|
|
|
|
$id);
|
|
|
|
|
|
|
|
$rows[] = array(
|
|
|
|
$name,
|
|
|
|
$id_link,
|
|
|
|
$base,
|
|
|
|
$desc,
|
|
|
|
$age,
|
|
|
|
$lint,
|
|
|
|
$unit,
|
|
|
|
$old,
|
|
|
|
$new,
|
|
|
|
);
|
|
|
|
|
|
|
|
$classes = array();
|
|
|
|
if ($old_class) {
|
|
|
|
$classes[] = 'differential-update-history-old-now';
|
|
|
|
}
|
|
|
|
if ($new_class) {
|
|
|
|
$classes[] = 'differential-update-history-new-now';
|
|
|
|
}
|
|
|
|
$rowc[] = nonempty(implode(' ', $classes), null);
|
2011-01-27 23:55:52 +01:00
|
|
|
}
|
|
|
|
|
2011-07-17 03:44:48 +02:00
|
|
|
Javelin::initBehavior(
|
|
|
|
'differential-diff-radios',
|
|
|
|
array(
|
|
|
|
'radios' => $radios,
|
|
|
|
));
|
2011-02-04 00:41:58 +01:00
|
|
|
|
2011-07-17 03:44:48 +02:00
|
|
|
$options = array(
|
2012-03-13 01:06:36 +01:00
|
|
|
DifferentialChangesetParser::WHITESPACE_IGNORE_FORCE => 'Ignore All',
|
2015-02-10 08:34:43 +01:00
|
|
|
DifferentialChangesetParser::WHITESPACE_IGNORE_MOST => 'Ignore Most',
|
2012-02-06 20:13:45 +01:00
|
|
|
DifferentialChangesetParser::WHITESPACE_IGNORE_TRAILING =>
|
|
|
|
'Ignore Trailing',
|
|
|
|
DifferentialChangesetParser::WHITESPACE_SHOW_ALL => 'Show All',
|
2011-07-17 03:44:48 +02:00
|
|
|
);
|
2011-04-18 22:38:54 +02:00
|
|
|
|
2011-07-17 03:44:48 +02:00
|
|
|
foreach ($options as $value => $label) {
|
2013-02-13 23:50:15 +01:00
|
|
|
$options[$value] = phutil_tag(
|
2011-07-17 03:44:48 +02:00
|
|
|
'option',
|
|
|
|
array(
|
|
|
|
'value' => $value,
|
|
|
|
'selected' => ($value == $this->selectedWhitespace)
|
|
|
|
? 'selected'
|
|
|
|
: null,
|
|
|
|
),
|
2013-01-18 03:43:35 +01:00
|
|
|
$label);
|
2011-07-17 03:44:48 +02:00
|
|
|
}
|
2013-02-13 23:50:15 +01:00
|
|
|
$select = phutil_tag('select', array('name' => 'whitespace'), $options);
|
|
|
|
|
2014-03-12 19:39:43 +01:00
|
|
|
|
|
|
|
$table = id(new AphrontTableView($rows));
|
|
|
|
$table->setHeaders(
|
|
|
|
array(
|
|
|
|
pht('Diff'),
|
|
|
|
pht('ID'),
|
|
|
|
pht('Base'),
|
|
|
|
pht('Description'),
|
|
|
|
pht('Created'),
|
|
|
|
pht('Lint'),
|
|
|
|
pht('Unit'),
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
));
|
|
|
|
$table->setColumnClasses(
|
|
|
|
array(
|
|
|
|
'pri',
|
|
|
|
'',
|
|
|
|
'',
|
|
|
|
'wide',
|
|
|
|
'date',
|
|
|
|
'center',
|
|
|
|
'center',
|
|
|
|
'center differential-update-history-old',
|
|
|
|
'center differential-update-history-new',
|
|
|
|
));
|
|
|
|
$table->setRowClasses($rowc);
|
|
|
|
$table->setDeviceVisibility(
|
|
|
|
array(
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
));
|
|
|
|
|
|
|
|
$show_diff = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => 'differential-update-history-footer',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
phutil_tag(
|
|
|
|
'label',
|
|
|
|
array(),
|
|
|
|
array(
|
|
|
|
pht('Whitespace Changes:'),
|
|
|
|
$select,
|
|
|
|
)),
|
2013-11-11 18:23:23 +01:00
|
|
|
phutil_tag(
|
2014-03-12 19:39:43 +01:00
|
|
|
'button',
|
|
|
|
array(),
|
|
|
|
pht('Show Diff')),
|
|
|
|
));
|
|
|
|
|
|
|
|
$content = phabricator_form(
|
|
|
|
$this->getUser(),
|
|
|
|
array(
|
|
|
|
'action' => '#toc',
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$table,
|
|
|
|
$show_diff,
|
|
|
|
));
|
2013-09-29 00:55:38 +02:00
|
|
|
|
|
|
|
return id(new PHUIObjectBoxView())
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
->setHeaderText(pht('Revision Update History'))
|
2014-02-14 06:02:19 +01:00
|
|
|
->setFlush(true)
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
->appendChild($content);
|
2011-01-27 23:55:52 +01:00
|
|
|
}
|
2011-02-05 02:53:14 +01:00
|
|
|
|
|
|
|
const STAR_NONE = 'none';
|
|
|
|
const STAR_OKAY = 'okay';
|
|
|
|
const STAR_WARN = 'warn';
|
|
|
|
const STAR_FAIL = 'fail';
|
|
|
|
const STAR_SKIP = 'skip';
|
|
|
|
|
|
|
|
public static function renderDiffLintStar(DifferentialDiff $diff) {
|
|
|
|
static $map = array(
|
|
|
|
DifferentialLintStatus::LINT_NONE => self::STAR_NONE,
|
|
|
|
DifferentialLintStatus::LINT_OKAY => self::STAR_OKAY,
|
|
|
|
DifferentialLintStatus::LINT_WARN => self::STAR_WARN,
|
|
|
|
DifferentialLintStatus::LINT_FAIL => self::STAR_FAIL,
|
|
|
|
DifferentialLintStatus::LINT_SKIP => self::STAR_SKIP,
|
2014-09-16 21:11:54 +02:00
|
|
|
DifferentialLintStatus::LINT_AUTO_SKIP => self::STAR_SKIP,
|
2014-10-07 15:01:04 +02:00
|
|
|
DifferentialLintStatus::LINT_POSTPONED => self::STAR_SKIP,
|
2011-02-05 02:53:14 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$star = idx($map, $diff->getLintStatus(), self::STAR_FAIL);
|
|
|
|
|
|
|
|
return self::renderDiffStar($star);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function renderDiffUnitStar(DifferentialDiff $diff) {
|
|
|
|
static $map = array(
|
|
|
|
DifferentialUnitStatus::UNIT_NONE => self::STAR_NONE,
|
|
|
|
DifferentialUnitStatus::UNIT_OKAY => self::STAR_OKAY,
|
|
|
|
DifferentialUnitStatus::UNIT_WARN => self::STAR_WARN,
|
|
|
|
DifferentialUnitStatus::UNIT_FAIL => self::STAR_FAIL,
|
|
|
|
DifferentialUnitStatus::UNIT_SKIP => self::STAR_SKIP,
|
2014-09-16 21:11:54 +02:00
|
|
|
DifferentialUnitStatus::UNIT_AUTO_SKIP => self::STAR_SKIP,
|
2011-06-09 01:16:59 +02:00
|
|
|
DifferentialUnitStatus::UNIT_POSTPONED => self::STAR_SKIP,
|
2011-02-05 02:53:14 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
$star = idx($map, $diff->getUnitStatus(), self::STAR_FAIL);
|
|
|
|
|
|
|
|
return self::renderDiffStar($star);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getDiffLintMessage(DifferentialDiff $diff) {
|
|
|
|
switch ($diff->getLintStatus()) {
|
|
|
|
case DifferentialLintStatus::LINT_NONE:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('No Linters Available');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialLintStatus::LINT_OKAY:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Lint OK');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialLintStatus::LINT_WARN:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Lint Warnings');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialLintStatus::LINT_FAIL:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Lint Errors');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialLintStatus::LINT_SKIP:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Lint Skipped');
|
|
|
|
case DifferentialLintStatus::LINT_AUTO_SKIP:
|
|
|
|
return pht('Automatic diff as part of commit; lint not applicable.');
|
2012-06-15 02:09:24 +02:00
|
|
|
case DifferentialLintStatus::LINT_POSTPONED:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Lint Postponed');
|
2011-02-05 02:53:14 +01:00
|
|
|
}
|
|
|
|
return '???';
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getDiffUnitMessage(DifferentialDiff $diff) {
|
|
|
|
switch ($diff->getUnitStatus()) {
|
|
|
|
case DifferentialUnitStatus::UNIT_NONE:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('No Unit Test Coverage');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialUnitStatus::UNIT_OKAY:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Unit Tests OK');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialUnitStatus::UNIT_WARN:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Unit Test Warnings');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialUnitStatus::UNIT_FAIL:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Unit Test Errors');
|
2011-02-05 02:53:14 +01:00
|
|
|
case DifferentialUnitStatus::UNIT_SKIP:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Unit Tests Skipped');
|
|
|
|
case DifferentialUnitStatus::UNIT_AUTO_SKIP:
|
|
|
|
return pht(
|
|
|
|
'Automatic diff as part of commit; unit tests not applicable.');
|
2011-06-09 01:16:59 +02:00
|
|
|
case DifferentialUnitStatus::UNIT_POSTPONED:
|
2014-09-16 21:11:54 +02:00
|
|
|
return pht('Unit Tests Postponed');
|
2011-02-05 02:53:14 +01:00
|
|
|
}
|
|
|
|
return '???';
|
|
|
|
}
|
|
|
|
|
|
|
|
private static function renderDiffStar($star) {
|
|
|
|
$class = 'diff-star-'.$star;
|
2013-02-06 00:14:18 +01:00
|
|
|
return phutil_tag(
|
|
|
|
'span',
|
|
|
|
array('class' => $class),
|
|
|
|
"\xE2\x98\x85");
|
2011-02-05 02:53:14 +01:00
|
|
|
}
|
|
|
|
|
2011-07-17 03:44:48 +02:00
|
|
|
private function renderBaseRevision(DifferentialDiff $diff) {
|
|
|
|
switch ($diff->getSourceControlSystem()) {
|
|
|
|
case 'git':
|
2012-01-08 10:39:35 +01:00
|
|
|
$base = $diff->getSourceControlBaseRevision();
|
|
|
|
if (strpos($base, '@') === false) {
|
2014-04-02 22:18:11 +02:00
|
|
|
$label = substr($base, 0, 7);
|
2012-01-08 10:39:35 +01:00
|
|
|
} else {
|
|
|
|
// The diff is from git-svn
|
|
|
|
$base = explode('@', $base);
|
|
|
|
$base = last($base);
|
2014-04-02 22:18:11 +02:00
|
|
|
$label = $base;
|
2012-01-08 10:39:35 +01:00
|
|
|
}
|
2014-04-02 22:18:11 +02:00
|
|
|
break;
|
2011-07-17 03:44:48 +02:00
|
|
|
case 'svn':
|
|
|
|
$base = $diff->getSourceControlBaseRevision();
|
|
|
|
$base = explode('@', $base);
|
2012-01-08 10:39:35 +01:00
|
|
|
$base = last($base);
|
2014-04-02 22:18:11 +02:00
|
|
|
$label = $base;
|
|
|
|
break;
|
2011-07-17 03:44:48 +02:00
|
|
|
default:
|
2014-04-02 22:18:11 +02:00
|
|
|
$label = null;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$link = null;
|
|
|
|
if ($label) {
|
|
|
|
$commit_for_link = idx(
|
|
|
|
$this->commitsForLinks,
|
|
|
|
$diff->getSourceControlBaseRevision());
|
|
|
|
if ($commit_for_link) {
|
|
|
|
$link = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array('href' => $commit_for_link->getURI()),
|
|
|
|
$label);
|
|
|
|
} else {
|
|
|
|
$link = $label;
|
|
|
|
}
|
2011-07-17 03:44:48 +02:00
|
|
|
}
|
2014-04-02 22:18:11 +02:00
|
|
|
return $link;
|
2011-07-17 03:44:48 +02:00
|
|
|
}
|
2011-01-27 23:55:52 +01:00
|
|
|
}
|