mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +01:00
Fixed whitespace options in Differential.
Summary: Whitespace options could not be selected and the 'ignore_all' was not working. Test Plan: Made sure that whitespace is ignored correctly and selected option is handled correctly. Reviewed By: jungejason Reviewers: jungejason CC: epriestley, jungejason, tuomaspelkonen Differential Revision: 149
This commit is contained in:
parent
01844087cd
commit
a6c770217d
5 changed files with 38 additions and 6 deletions
|
@ -132,6 +132,7 @@ class DifferentialChangesetViewController extends DifferentialController {
|
|||
$parser->setChangeset($changeset);
|
||||
$parser->setRightSideCommentMapping($right_source, $right_new);
|
||||
$parser->setLeftSideCommentMapping($left_source, $left_new);
|
||||
$parser->setWhitespaceMode($request->getStr('whitespace'));
|
||||
|
||||
$phids = array();
|
||||
$inlines = $this->loadInlineComments($id, $author_phid);
|
||||
|
|
|
@ -173,6 +173,7 @@ class DifferentialRevisionViewController extends DifferentialController {
|
|||
$diff_history->setDiffs($diffs);
|
||||
$diff_history->setSelectedVersusDiffID($diff_vs);
|
||||
$diff_history->setSelectedDiffID($target->getID());
|
||||
$diff_history->setSelectedWhitespace($request->getStr('whitespace'));
|
||||
|
||||
$toc_view = new DifferentialDiffTableOfContentsView();
|
||||
$toc_view->setChangesets($changesets);
|
||||
|
@ -185,6 +186,7 @@ class DifferentialRevisionViewController extends DifferentialController {
|
|||
$changeset_view->setEditable(true);
|
||||
$changeset_view->setRevision($revision);
|
||||
$changeset_view->setVsMap($vs_map);
|
||||
$changeset_view->setWhitespace($request->getStr('whitespace'));
|
||||
|
||||
$draft = id(new PhabricatorDraft())->loadOneWhere(
|
||||
'authorPHID = %s AND draftKey = %s',
|
||||
|
|
|
@ -675,10 +675,10 @@ EOSYNTHETIC;
|
|||
|
||||
$diff = DifferentialDiff::newFromRawChanges($changes);
|
||||
$changesets = $diff->getChangesets();
|
||||
$alt_changeset = reset($changesets);
|
||||
$changeset = reset($changesets);
|
||||
|
||||
$this->subparser = new DifferentialChangesetParser();
|
||||
$this->subparser->setChangeset($alt_changeset);
|
||||
$this->subparser->setChangeset($changeset);
|
||||
$this->subparser->setWhitespaceMode(self::WHITESPACE_IGNORE_TRAILING);
|
||||
}
|
||||
foreach ($changeset->getHunks() as $hunk) {
|
||||
|
|
|
@ -23,6 +23,7 @@ class DifferentialChangesetListView extends AphrontView {
|
|||
private $revision;
|
||||
private $renderURI = '/differential/changeset/';
|
||||
private $vsMap = array();
|
||||
private $whitespace = null;
|
||||
|
||||
public function setChangesets($changesets) {
|
||||
$this->changesets = $changesets;
|
||||
|
@ -49,6 +50,11 @@ class DifferentialChangesetListView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setWhitespace($whitespace) {
|
||||
$this->whitespace = $whitespace;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
require_celerity_resource('differential-changeset-view-css');
|
||||
|
||||
|
@ -77,7 +83,7 @@ class DifferentialChangesetListView extends AphrontView {
|
|||
array(
|
||||
'id' => $ref,
|
||||
'vs' => $vs_id,
|
||||
'whitespace' => 'TODO',
|
||||
'whitespace' => $this->whitespace,
|
||||
));
|
||||
|
||||
$detail_button = phutil_render_tag(
|
||||
|
@ -109,10 +115,9 @@ class DifferentialChangesetListView extends AphrontView {
|
|||
$vs_id);
|
||||
}
|
||||
|
||||
$whitespace = null;
|
||||
Javelin::initBehavior('differential-populate', array(
|
||||
'registry' => $mapping,
|
||||
'whitespace' => $whitespace,
|
||||
'whitespace' => $this->whitespace,
|
||||
'uri' => $this->renderURI,
|
||||
));
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|||
private $diffs = array();
|
||||
private $selectedVersusDiffID;
|
||||
private $selectedDiffID;
|
||||
private $selectedWhitespace;
|
||||
|
||||
public function setDiffs($diffs) {
|
||||
$this->diffs = $diffs;
|
||||
|
@ -37,6 +38,11 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setSelectedWhitespace($whitespace) {
|
||||
$this->selectedWhitespace = $whitespace;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
require_celerity_resource('differential-core-view-css');
|
||||
|
@ -157,7 +163,25 @@ final class DifferentialRevisionUpdateHistoryView extends AphrontView {
|
|||
'radios' => $radios,
|
||||
));
|
||||
|
||||
$select = '<select><option>Ignore All</option></select>';
|
||||
$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>';
|
||||
|
||||
return
|
||||
'<div class="differential-revision-history differential-panel">'.
|
||||
|
|
Loading…
Reference in a new issue