@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+10
+10
src/applications/differential/parser/DifferentialChangesetParser.php
··· 90 90 const ATTR_DELETED = 'attr:deleted'; 91 91 const ATTR_UNCHANGED = 'attr:unchanged'; 92 92 const ATTR_WHITELINES = 'attr:white'; 93 + const ATTR_MOVEAWAY = 'attr:moveaway'; 93 94 94 95 const LINES_CONTEXT = 8; 95 96 ··· 438 439 return idx($this->specialAttributes, self::ATTR_WHITELINES, false); 439 440 } 440 441 442 + public function isMoveAway() { 443 + return idx($this->specialAttributes, self::ATTR_MOVEAWAY, false); 444 + } 445 + 441 446 private function applyIntraline(&$render, $intra, $corpus) { 442 447 443 448 foreach ($render as $key => $text) { ··· 594 599 } 595 600 } 596 601 602 + $moveaway = false; 597 603 $changetype = $this->changeset->getChangeType(); 598 604 if ($changetype == DifferentialChangeType::TYPE_MOVE_AWAY) { 599 605 // sometimes we show moved files as unchanged, sometimes deleted, ··· 601 607 // destination of the move. Rather than make a false claim, 602 608 // omit the 'not changed' notice if this is the source of a move 603 609 $unchanged = false; 610 + $moveaway = true; 604 611 } 605 612 606 613 $this->setSpecialAttributes(array( 607 614 self::ATTR_UNCHANGED => $unchanged, 608 615 self::ATTR_DELETED => $hunk_parser->getIsDeleted(), 609 616 self::ATTR_WHITELINES => !$hunk_parser->getHasTextChanges(), 617 + self::ATTR_MOVEAWAY => $moveaway, 610 618 )); 611 619 612 620 $hunk_parser->generateIntraLineDiffs(); ··· 775 783 $shield = $renderer->renderShield( 776 784 pht('The contents of this file were not changed.'), 777 785 $type); 786 + } else if ($this->isMoveAway()) { 787 + $shield = null; 778 788 } else if ($this->isWhitespaceOnly()) { 779 789 $shield = $renderer->renderShield( 780 790 pht('This file was changed only by adding or removing whitespace.'),