Skip to content

Commit dc1106a

Browse files
committedNov 17, 2014
Differential - stop showing the shield for "move away" operations
Summary: The shield is just confusing. In one case it doesn't work, and in the other case it just shows you a copy of the file you can see just below except in red. Fixes T4599, T1211. Note T1211 proposed not showing the "move away" file **at all** but I think removing the shield fixes the source of confusion. The code here is a bit if / else if / else if... heavy but this is logically sound. Test Plan: made a diff where i moved a file then edited it in the new location. viewed diff, saw confusing shield, dropped caches, applied patch, viewed diff and saw no shield. made a diff where I moved a file and didn't edit in new location and saw similar shield disappearness. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T1211, T4599 Differential Revision: https://secure.phabricator.com/D10865
1 parent e7b6d33 commit dc1106a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
 

‎src/applications/differential/parser/DifferentialChangesetParser.php

+10
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function getDisableCache() {
9090
const ATTR_DELETED = 'attr:deleted';
9191
const ATTR_UNCHANGED = 'attr:unchanged';
9292
const ATTR_WHITELINES = 'attr:white';
93+
const ATTR_MOVEAWAY = 'attr:moveaway';
9394

9495
const LINES_CONTEXT = 8;
9596

@@ -438,6 +439,10 @@ public function isWhitespaceOnly() {
438439
return idx($this->specialAttributes, self::ATTR_WHITELINES, false);
439440
}
440441

442+
public function isMoveAway() {
443+
return idx($this->specialAttributes, self::ATTR_MOVEAWAY, false);
444+
}
445+
441446
private function applyIntraline(&$render, $intra, $corpus) {
442447

443448
foreach ($render as $key => $text) {
@@ -594,19 +599,22 @@ private function process() {
594599
}
595600
}
596601

602+
$moveaway = false;
597603
$changetype = $this->changeset->getChangeType();
598604
if ($changetype == DifferentialChangeType::TYPE_MOVE_AWAY) {
599605
// sometimes we show moved files as unchanged, sometimes deleted,
600606
// and sometimes inconsistent with what actually happened at the
601607
// destination of the move. Rather than make a false claim,
602608
// omit the 'not changed' notice if this is the source of a move
603609
$unchanged = false;
610+
$moveaway = true;
604611
}
605612

606613
$this->setSpecialAttributes(array(
607614
self::ATTR_UNCHANGED => $unchanged,
608615
self::ATTR_DELETED => $hunk_parser->getIsDeleted(),
609616
self::ATTR_WHITELINES => !$hunk_parser->getHasTextChanges(),
617+
self::ATTR_MOVEAWAY => $moveaway,
610618
));
611619

612620
$hunk_parser->generateIntraLineDiffs();
@@ -775,6 +783,8 @@ public function render(
775783
$shield = $renderer->renderShield(
776784
pht('The contents of this file were not changed.'),
777785
$type);
786+
} else if ($this->isMoveAway()) {
787+
$shield = null;
778788
} else if ($this->isWhitespaceOnly()) {
779789
$shield = $renderer->renderShield(
780790
pht('This file was changed only by adding or removing whitespace.'),

0 commit comments

Comments
 (0)
Failed to load comments.