@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.

Remove all whitespace options/configuration everywhere

Summary:
Depends on D20181. Depends on D20182. Fixes T3498. Ref T13161. My claim, at least, is that D20181 can be tweaked to be good enough to throw away this "feature" completely.

I think this feature was sort of a mistake, where the ease of access to `diff -bw` shaped behavior a very long time ago and then the train just ran a long way down the tracks in the same direction.

Test Plan: Grepped for `whitespace`, deleted almost everything. Poked around the UI a bit. I'm expecting the whitespace changes to get some more iteration this week so I not being hugely pedantic about testing this stuff exhaustively.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13161, T3498

Differential Revision: https://secure.phabricator.com/D20185

+33 -375
+14 -14
resources/celerity/map.php
··· 12 12 'core.pkg.css' => '261ee8cf', 13 13 'core.pkg.js' => '5ace8a1e', 14 14 'differential.pkg.css' => 'c3f15714', 15 - 'differential.pkg.js' => '67c9ea4c', 15 + 'differential.pkg.js' => 'be031567', 16 16 'diffusion.pkg.css' => '42c75c37', 17 17 'diffusion.pkg.js' => '91192d85', 18 18 'maniphest.pkg.css' => '35995d6d', ··· 374 374 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '076bd092', 375 375 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9', 376 376 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '9b1cbd76', 377 - 'rsrc/js/application/diff/DiffChangeset.js' => 'e7cf10d6', 377 + 'rsrc/js/application/diff/DiffChangeset.js' => 'd0a85a85', 378 378 'rsrc/js/application/diff/DiffChangesetList.js' => 'b91204e9', 379 379 'rsrc/js/application/diff/DiffInline.js' => 'a4a14a94', 380 380 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', ··· 753 753 'phabricator-darklog' => '3b869402', 754 754 'phabricator-darkmessage' => '26cd4b73', 755 755 'phabricator-dashboard-css' => '4267d6c6', 756 - 'phabricator-diff-changeset' => 'e7cf10d6', 756 + 'phabricator-diff-changeset' => 'd0a85a85', 757 757 'phabricator-diff-changeset-list' => 'b91204e9', 758 758 'phabricator-diff-inline' => 'a4a14a94', 759 759 'phabricator-drag-and-drop-file-upload' => '4370900d', ··· 1973 1973 'javelin-stratcom', 1974 1974 'javelin-util', 1975 1975 ), 1976 + 'd0a85a85' => array( 1977 + 'javelin-dom', 1978 + 'javelin-util', 1979 + 'javelin-stratcom', 1980 + 'javelin-install', 1981 + 'javelin-workflow', 1982 + 'javelin-router', 1983 + 'javelin-behavior-device', 1984 + 'javelin-vector', 1985 + 'phabricator-diff-inline', 1986 + ), 1976 1987 'd12d214f' => array( 1977 1988 'javelin-install', 1978 1989 'javelin-dom', ··· 2037 2048 'javelin-workflow', 2038 2049 'javelin-dom', 2039 2050 'phabricator-draggable-list', 2040 - ), 2041 - 'e7cf10d6' => array( 2042 - 'javelin-dom', 2043 - 'javelin-util', 2044 - 'javelin-stratcom', 2045 - 'javelin-install', 2046 - 'javelin-workflow', 2047 - 'javelin-router', 2048 - 'javelin-behavior-device', 2049 - 'javelin-vector', 2050 - 'phabricator-diff-inline', 2051 2051 ), 2052 2052 'e8240b50' => array( 2053 2053 'javelin-behavior',
+2
src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
··· 533 533 'This ancient extension point has been replaced with other '. 534 534 'mechanisms, including "AphrontSite".'), 535 535 536 + 'differential.whitespace-matters' => pht( 537 + 'Whitespace rendering is now handled automatically.'), 536 538 ); 537 539 538 540 return $ancient_config;
+2 -13
src/applications/differential/__tests__/DifferentialParseRenderTestCase.php
··· 31 31 foreach (array('one', 'two') as $type) { 32 32 $this->runParser($type, $data, $file, 'expect'); 33 33 $this->runParser($type, $data, $file, 'unshielded'); 34 - $this->runParser($type, $data, $file, 'whitespace'); 35 34 } 36 35 } 37 36 } ··· 44 43 } 45 44 46 45 $unshielded = false; 47 - $whitespace = false; 48 46 switch ($extension) { 49 47 case 'unshielded': 50 48 $unshielded = true; 51 49 break; 52 - case 'whitespace'; 53 - $unshielded = true; 54 - $whitespace = true; 55 - break; 56 50 } 57 51 58 52 $parsers = $this->buildChangesetParsers($type, $data, $file); 59 - $actual = $this->renderParsers($parsers, $unshielded, $whitespace); 53 + $actual = $this->renderParsers($parsers, $unshielded); 60 54 $expect = Filesystem::readFile($test_file); 61 55 62 56 $this->assertEqual($expect, $actual, basename($test_file)); 63 57 } 64 58 65 - private function renderParsers(array $parsers, $unshield, $whitespace) { 59 + private function renderParsers(array $parsers, $unshield) { 66 60 $result = array(); 67 61 foreach ($parsers as $parser) { 68 62 if ($unshield) { ··· 71 65 } else { 72 66 $s_range = null; 73 67 $e_range = null; 74 - } 75 - 76 - if ($whitespace) { 77 - $parser->setWhitespaceMode( 78 - DifferentialChangesetParser::WHITESPACE_SHOW_ALL); 79 68 } 80 69 81 70 $result[] = $parser->render($s_range, $e_range, array());
+1 -2
src/applications/differential/__tests__/data/generated.diff.one.unshielded
··· 1 1 N 1 . @generated\n~ 2 - O 2 - \n~ 2 + N 2 . \n~ 3 3 O 3 - This is a generated file.\n~ 4 - N 2 + \n~ 5 4 N 3 + This is a generated file{(, full of generated code)}.\n~ 6 5 N 4 . \n~
+2 -2
src/applications/differential/__tests__/data/generated.diff.two.unshielded
··· 1 1 O 1 . @generated\n~ 2 2 N 1 . @generated\n~ 3 - O 2 - \n~ 4 - N 2 + \n~ 3 + O 2 . \n~ 4 + N 2 . \n~ 5 5 O 3 - This is a generated file.\n~ 6 6 N 3 + This is a generated file{(, full of generated code)}.\n~ 7 7 O 4 . \n~
+2 -1
src/applications/differential/__tests__/data/whitespace.diff.one.expect
··· 2 2 WHITESPACE 3 3 WHITESPACE 4 4 - 5 - SHIELD (whitespace) This file was changed only by adding or removing whitespace. 5 + O 1 - -=[-Rocket-Ship>\n~ 6 + N 1 + {> )}-=[-Rocket-Ship>\n~
+2 -1
src/applications/differential/__tests__/data/whitespace.diff.two.expect
··· 2 2 WHITESPACE 3 3 WHITESPACE 4 4 - 5 - SHIELD (whitespace) This file was changed only by adding or removing whitespace. 5 + O 1 - -=[-Rocket-Ship>\n~ 6 + N 1 + {> )}-=[-Rocket-Ship>\n~
-12
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 80 80 "Select and reorder revision fields.\n\n". 81 81 "NOTE: This feature is under active development and subject ". 82 82 "to change.")), 83 - $this->newOption( 84 - 'differential.whitespace-matters', 85 - 'list<regex>', 86 - array( 87 - '/\.py$/', 88 - '/\.l?hs$/', 89 - '/\.ya?ml$/', 90 - )) 91 - ->setDescription( 92 - pht( 93 - "List of file regexps where whitespace is meaningful and should ". 94 - "not use 'ignore-all' by default")), 95 83 $this->newOption('differential.require-test-plan-field', 'bool', true) 96 84 ->setBoolOptions( 97 85 array(
+1 -7
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 305 305 $details = $this->buildDetails($revision, $field_list); 306 306 $curtain = $this->buildCurtain($revision); 307 307 308 - $whitespace = $request->getStr( 309 - 'whitespace', 310 - DifferentialChangesetParser::WHITESPACE_IGNORE_MOST); 311 - 312 308 $repository = $revision->getRepository(); 313 309 if ($repository) { 314 310 $symbol_indexes = $this->buildSymbolIndexes( ··· 383 379 ->setDiff($target) 384 380 ->setRenderingReferences($rendering_references) 385 381 ->setVsMap($vs_map) 386 - ->setWhitespace($whitespace) 387 382 ->setSymbolIndexes($symbol_indexes) 388 383 ->setTitle(pht('Diff %s', $target->getID())) 389 384 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); ··· 412 407 ->setDiffUnitStatuses($broken_diffs) 413 408 ->setSelectedVersusDiffID($diff_vs) 414 409 ->setSelectedDiffID($target->getID()) 415 - ->setSelectedWhitespace($whitespace) 416 410 ->setCommitsForLinks($commits_for_links); 417 411 418 412 $local_table = id(new DifferentialLocalCommitsView()) ··· 1095 1089 // this ends up being something like 1096 1090 // D123.diff 1097 1091 // or the verbose 1098 - // D123.vs123.id123.whitespaceignore-all.diff 1092 + // D123.vs123.id123.highlightjs.diff 1099 1093 // lame but nice to include these options 1100 1094 $file_name = ltrim($request_uri->getPath(), '/').'.'; 1101 1095 foreach ($request_uri->getQueryParamsAsPairList() as $pair) {
+2 -97
src/applications/differential/parser/DifferentialChangesetParser.php
··· 19 19 protected $specialAttributes = array(); 20 20 21 21 protected $changeset; 22 - protected $whitespaceMode = null; 23 22 24 23 protected $renderCacheKey = null; 25 24 ··· 163 162 } 164 163 165 164 public function readParametersFromRequest(AphrontRequest $request) { 166 - $this->setWhitespaceMode($request->getStr('whitespace')); 167 165 $this->setCharacterEncoding($request->getStr('encoding')); 168 166 $this->setHighlightAs($request->getStr('highlight')); 169 167 ··· 191 189 return $this; 192 190 } 193 191 194 - const CACHE_VERSION = 12; 192 + const CACHE_VERSION = 13; 195 193 const CACHE_MAX_SIZE = 8e6; 196 194 197 195 const ATTR_GENERATED = 'attr:generated'; 198 196 const ATTR_DELETED = 'attr:deleted'; 199 197 const ATTR_UNCHANGED = 'attr:unchanged'; 200 - const ATTR_WHITELINES = 'attr:white'; 201 198 const ATTR_MOVEAWAY = 'attr:moveaway'; 202 199 203 - const WHITESPACE_SHOW_ALL = 'show-all'; 204 - const WHITESPACE_IGNORE_TRAILING = 'ignore-trailing'; 205 - const WHITESPACE_IGNORE_MOST = 'ignore-most'; 206 - const WHITESPACE_IGNORE_ALL = 'ignore-all'; 207 - 208 200 public function setOldLines(array $lines) { 209 201 $this->old = $lines; 210 202 return $this; ··· 336 328 return $this; 337 329 } 338 330 339 - public function setWhitespaceMode($whitespace_mode) { 340 - $this->whitespaceMode = $whitespace_mode; 341 - return $this; 342 - } 343 - 344 331 public function setRenderingReference($ref) { 345 332 $this->renderingReference = $ref; 346 333 return $this; ··· 574 561 return idx($this->specialAttributes, self::ATTR_UNCHANGED, false); 575 562 } 576 563 577 - public function isWhitespaceOnly() { 578 - return idx($this->specialAttributes, self::ATTR_WHITELINES, false); 579 - } 580 - 581 564 public function isMoveAway() { 582 565 return idx($this->specialAttributes, self::ATTR_MOVEAWAY, false); 583 566 } ··· 624 607 } 625 608 626 609 private function tryCacheStuff() { 627 - $whitespace_mode = $this->whitespaceMode; 628 - switch ($whitespace_mode) { 629 - case self::WHITESPACE_SHOW_ALL: 630 - case self::WHITESPACE_IGNORE_TRAILING: 631 - case self::WHITESPACE_IGNORE_ALL: 632 - break; 633 - default: 634 - $whitespace_mode = self::WHITESPACE_IGNORE_MOST; 635 - break; 636 - } 610 + $skip_cache = false; 637 611 638 - $skip_cache = ($whitespace_mode != self::WHITESPACE_IGNORE_MOST); 639 612 if ($this->disableCache) { 640 613 $skip_cache = true; 641 614 } ··· 648 621 $skip_cache = true; 649 622 } 650 623 651 - $this->whitespaceMode = $whitespace_mode; 652 - 653 624 $changeset = $this->changeset; 654 625 655 626 if ($changeset->getFileType() != DifferentialChangeType::FILE_TEXT && ··· 668 639 } 669 640 670 641 private function process() { 671 - $whitespace_mode = $this->whitespaceMode; 672 642 $changeset = $this->changeset; 673 643 674 - $ignore_all = (($whitespace_mode == self::WHITESPACE_IGNORE_MOST) || 675 - ($whitespace_mode == self::WHITESPACE_IGNORE_ALL)); 676 - 677 - $force_ignore = ($whitespace_mode == self::WHITESPACE_IGNORE_ALL); 678 - 679 - if (!$force_ignore) { 680 - if ($ignore_all && $changeset->getWhitespaceMatters()) { 681 - $ignore_all = false; 682 - } 683 - } 684 - 685 - // The "ignore all whitespace" algorithm depends on rediffing the 686 - // files, and we currently need complete representations of both 687 - // files to do anything reasonable. If we only have parts of the files, 688 - // don't use the "ignore all" algorithm. 689 - if ($ignore_all) { 690 - $hunks = $changeset->getHunks(); 691 - if (count($hunks) !== 1) { 692 - $ignore_all = false; 693 - } else { 694 - $first_hunk = reset($hunks); 695 - if ($first_hunk->getOldOffset() != 1 || 696 - $first_hunk->getNewOffset() != 1) { 697 - $ignore_all = false; 698 - } 699 - } 700 - } 701 - 702 - if ($ignore_all) { 703 - $old_file = $changeset->makeOldFile(); 704 - $new_file = $changeset->makeNewFile(); 705 - if ($old_file == $new_file) { 706 - // If the old and new files are exactly identical, the synthetic 707 - // diff below will give us nonsense and whitespace modes are 708 - // irrelevant anyway. This occurs when you, e.g., copy a file onto 709 - // itself in Subversion (see T271). 710 - $ignore_all = false; 711 - } 712 - } 713 - 714 644 $hunk_parser = new DifferentialHunkParser(); 715 - $hunk_parser->setWhitespaceMode($whitespace_mode); 716 645 $hunk_parser->parseHunksForLineData($changeset->getHunks()); 717 - 718 - // Depending on the whitespace mode, we may need to compute a different 719 - // set of changes than the set of changes in the hunk data (specifically, 720 - // we might want to consider changed lines which have only whitespace 721 - // changes as unchanged). 722 - if ($ignore_all) { 723 - $engine = new PhabricatorDifferenceEngine(); 724 - $engine->setIgnoreWhitespace(true); 725 - $no_whitespace_changeset = $engine->generateChangesetFromFileContent( 726 - $old_file, 727 - $new_file); 728 - 729 - $type_parser = new DifferentialHunkParser(); 730 - $type_parser->parseHunksForLineData($no_whitespace_changeset->getHunks()); 731 - 732 - $hunk_parser->setOldLineTypeMap($type_parser->getOldLineTypeMap()); 733 - $hunk_parser->setNewLineTypeMap($type_parser->getNewLineTypeMap()); 734 - } 735 - 736 646 $hunk_parser->reparseHunksForSpecialAttributes(); 737 647 738 648 $unchanged = false; ··· 753 663 $this->setSpecialAttributes(array( 754 664 self::ATTR_UNCHANGED => $unchanged, 755 665 self::ATTR_DELETED => $hunk_parser->getIsDeleted(), 756 - self::ATTR_WHITELINES => !$hunk_parser->getHasTextChanges(), 757 666 self::ATTR_MOVEAWAY => $moveaway, 758 667 )); 759 668 ··· 971 880 pht('The contents of this file were not changed.'), 972 881 $type); 973 882 } 974 - } else if ($this->isWhitespaceOnly()) { 975 - $shield = $renderer->renderShield( 976 - pht('This file was changed only by adding or removing whitespace.'), 977 - 'whitespace'); 978 883 } else if ($this->isDeleted()) { 979 884 $shield = $renderer->renderShield( 980 885 pht('This file was completely deleted.'));
-83
src/applications/differential/parser/DifferentialHunkParser.php
··· 7 7 private $intraLineDiffs; 8 8 private $depthOnlyLines; 9 9 private $visibleLinesMask; 10 - private $whitespaceMode; 11 10 12 11 /** 13 12 * Get a map of lines on which hunks start, other than line 1. This ··· 125 124 return $this->depthOnlyLines; 126 125 } 127 126 128 - public function setWhitespaceMode($white_space_mode) { 129 - $this->whitespaceMode = $white_space_mode; 130 - return $this; 131 - } 132 - 133 - private function getWhitespaceMode() { 134 - if ($this->whitespaceMode === null) { 135 - throw new Exception( 136 - pht( 137 - 'You must %s before accessing this data.', 138 - 'setWhitespaceMode')); 139 - } 140 - return $this->whitespaceMode; 141 - } 142 - 143 127 public function getIsDeleted() { 144 128 foreach ($this->getNewLines() as $line) { 145 129 if ($line) { ··· 160 144 } 161 145 162 146 /** 163 - * Returns true if the hunks change any text, not just whitespace. 164 - */ 165 - public function getHasTextChanges() { 166 - return $this->getHasChanges('text'); 167 - } 168 - 169 - /** 170 147 * Returns true if the hunks change anything, including whitespace. 171 148 */ 172 149 public function getHasAnyChanges() { ··· 193 170 } 194 171 195 172 if ($o['type'] !== $n['type']) { 196 - // The types are different, so either the underlying text is actually 197 - // different or whatever whitespace rules we're using consider them 198 - // different. 199 173 return true; 200 174 } 201 175 ··· 277 251 278 252 $this->setOldLines($rebuild_old); 279 253 $this->setNewLines($rebuild_new); 280 - 281 - $this->updateChangeTypesForWhitespaceMode(); 282 - 283 - return $this; 284 - } 285 - 286 - private function updateChangeTypesForWhitespaceMode() { 287 - $mode = $this->getWhitespaceMode(); 288 - 289 - $mode_show_all = DifferentialChangesetParser::WHITESPACE_SHOW_ALL; 290 - if ($mode === $mode_show_all) { 291 - // If we're showing all whitespace, we don't need to perform any updates. 292 - return; 293 - } 294 - 295 - $mode_trailing = DifferentialChangesetParser::WHITESPACE_IGNORE_TRAILING; 296 - $is_trailing = ($mode === $mode_trailing); 297 - 298 - $new = $this->getNewLines(); 299 - $old = $this->getOldLines(); 300 - foreach ($old as $key => $o) { 301 - $n = $new[$key]; 302 - 303 - if (!$o || !$n) { 304 - continue; 305 - } 306 - 307 - if ($is_trailing) { 308 - // In "trailing" mode, we need to identify lines which are marked 309 - // changed but differ only by trailing whitespace. We mark these lines 310 - // unchanged. 311 - if ($o['type'] != $n['type']) { 312 - if (rtrim($o['text']) === rtrim($n['text'])) { 313 - $old[$key]['type'] = null; 314 - $new[$key]['type'] = null; 315 - } 316 - } 317 - } else { 318 - // In "ignore most" and "ignore all" modes, we need to identify lines 319 - // which are marked unchanged but have internal whitespace changes. 320 - // We want to ignore leading and trailing whitespace changes only, not 321 - // internal whitespace changes (`diff` doesn't have a mode for this, so 322 - // we have to fix it here). If the text is marked unchanged but the 323 - // old and new text differs by internal space, mark the lines changed. 324 - if ($o['type'] === null && $n['type'] === null) { 325 - if ($o['text'] !== $n['text']) { 326 - if (trim($o['text']) !== trim($n['text'])) { 327 - $old[$key]['type'] = '-'; 328 - $new[$key]['type'] = '+'; 329 - } 330 - } 331 - } 332 - } 333 - } 334 - 335 - $this->setOldLines($old); 336 - $this->setNewLines($new); 337 254 338 255 return $this; 339 256 }
-1
src/applications/differential/parser/DifferentialLineAdjustmentMap.php
··· 359 359 } 360 360 361 361 $changeset = id(new PhabricatorDifferenceEngine()) 362 - ->setIgnoreWhitespace(true) 363 362 ->generateChangesetFromFileContent($u_old, $v_old); 364 363 365 364 $results[$u][$v] = self::newFromHunks(
-5
src/applications/differential/render/DifferentialChangesetHTMLRenderer.php
··· 367 367 $reference = $this->getRenderingReference(); 368 368 369 369 if ($force !== 'text' && 370 - $force !== 'whitespace' && 371 370 $force !== 'none' && 372 371 $force !== 'default') { 373 372 throw new Exception( ··· 387 386 'ref' => $reference, 388 387 'range' => $range, 389 388 ); 390 - 391 - if ($force == 'whitespace') { 392 - $meta['whitespace'] = DifferentialChangesetParser::WHITESPACE_SHOW_ALL; 393 - } 394 389 395 390 $content = array(); 396 391 $content[] = $message;
-3
src/applications/differential/render/DifferentialChangesetRenderer.php
··· 406 406 * important (e.g., generated code). 407 407 * - `"text"`: Force the text to be shown. This is probably only relevant 408 408 * when a file is not changed. 409 - * - `"whitespace"`: Force the text to be shown, and the diff to be 410 - * rendered with all whitespace shown. This is probably only relevant 411 - * when a file is changed only by altering whitespace. 412 409 * - `"none"`: Don't show the link (e.g., text not available). 413 410 * 414 411 * @param string Message explaining why the diff is hidden.
-11
src/applications/differential/storage/DifferentialChangeset.php
··· 249 249 return $path; 250 250 } 251 251 252 - public function getWhitespaceMatters() { 253 - $config = PhabricatorEnv::getEnvConfig('differential.whitespace-matters'); 254 - foreach ($config as $regexp) { 255 - if (preg_match($regexp, $this->getFilename())) { 256 - return true; 257 - } 258 - } 259 - 260 - return false; 261 - } 262 - 263 252 public function attachDiff(DifferentialDiff $diff) { 264 253 $this->diff = $diff; 265 254 return $this;
-11
src/applications/differential/view/DifferentialChangesetDetailView.php
··· 9 9 private $id; 10 10 private $vsChangesetID; 11 11 private $renderURI; 12 - private $whitespace; 13 12 private $renderingRef; 14 13 private $autoload; 15 14 private $loaded; ··· 40 39 41 40 public function getRenderingRef() { 42 41 return $this->renderingRef; 43 - } 44 - 45 - public function setWhitespace($whitespace) { 46 - $this->whitespace = $whitespace; 47 - return $this; 48 - } 49 - 50 - public function getWhitespace() { 51 - return $this->whitespace; 52 42 } 53 43 54 44 public function setRenderURI($render_uri) { ··· 196 186 'left' => $left_id, 197 187 'right' => $right_id, 198 188 'renderURI' => $this->getRenderURI(), 199 - 'whitespace' => $this->getWhitespace(), 200 189 'highlight' => null, 201 190 'renderer' => $this->getRenderer(), 202 191 'ref' => $this->getRenderingRef(),
+1 -9
src/applications/differential/view/DifferentialChangesetListView.php
··· 7 7 private $references = array(); 8 8 private $inlineURI; 9 9 private $renderURI = '/differential/changeset/'; 10 - private $whitespace; 11 10 private $background; 12 11 private $header; 13 12 private $isStandalone; ··· 100 99 return $this; 101 100 } 102 101 103 - public function setWhitespace($whitespace) { 104 - $this->whitespace = $whitespace; 105 - return $this; 106 - } 107 - 108 102 public function setVsMap(array $vs_map) { 109 103 $this->vsMap = $vs_map; 110 104 return $this; ··· 180 174 $detail->setRenderingRef($ref); 181 175 182 176 $detail->setRenderURI($this->renderURI); 183 - $detail->setWhitespace($this->whitespace); 184 177 $detail->setRenderer($renderer); 185 178 186 179 if ($this->getParser()) { ··· 352 345 $meta = array(); 353 346 354 347 $qparams = array( 355 - 'ref' => $ref, 356 - 'whitespace' => $this->whitespace, 348 + 'ref' => $ref, 357 349 ); 358 350 359 351 if ($this->standaloneURI) {
-35
src/applications/differential/view/DifferentialRevisionUpdateHistoryView.php
··· 5 5 private $diffs = array(); 6 6 private $selectedVersusDiffID; 7 7 private $selectedDiffID; 8 - private $selectedWhitespace; 9 8 private $commitsForLinks = array(); 10 9 private $unitStatus = array(); 11 10 ··· 22 21 23 22 public function setSelectedDiffID($id) { 24 23 $this->selectedDiffID = $id; 25 - return $this; 26 - } 27 - 28 - public function setSelectedWhitespace($whitespace) { 29 - $this->selectedWhitespace = $whitespace; 30 24 return $this; 31 25 } 32 26 ··· 224 218 'radios' => $radios, 225 219 )); 226 220 227 - $options = array( 228 - DifferentialChangesetParser::WHITESPACE_IGNORE_ALL => pht('Ignore All'), 229 - DifferentialChangesetParser::WHITESPACE_IGNORE_MOST => pht('Ignore Most'), 230 - DifferentialChangesetParser::WHITESPACE_IGNORE_TRAILING => 231 - pht('Ignore Trailing'), 232 - DifferentialChangesetParser::WHITESPACE_SHOW_ALL => pht('Show All'), 233 - ); 234 - 235 - foreach ($options as $value => $label) { 236 - $options[$value] = phutil_tag( 237 - 'option', 238 - array( 239 - 'value' => $value, 240 - 'selected' => ($value == $this->selectedWhitespace) 241 - ? 'selected' 242 - : null, 243 - ), 244 - $label); 245 - } 246 - $select = phutil_tag('select', array('name' => 'whitespace'), $options); 247 - 248 - 249 221 $table = id(new AphrontTableView($rows)); 250 222 $table->setHeaders( 251 223 array( ··· 291 263 'class' => 'differential-update-history-footer', 292 264 ), 293 265 array( 294 - phutil_tag( 295 - 'label', 296 - array(), 297 - array( 298 - pht('Whitespace Changes:'), 299 - $select, 300 - )), 301 266 phutil_tag( 302 267 'button', 303 268 array(),
-3
src/applications/diffusion/controller/DiffusionChangeController.php
··· 64 64 $changeset_view->setRawFileURIs($left_uri, $right_uri); 65 65 66 66 $changeset_view->setRenderURI($repository->getPathURI('diff/')); 67 - 68 - $changeset_view->setWhitespace( 69 - DifferentialChangesetParser::WHITESPACE_SHOW_ALL); 70 67 $changeset_view->setUser($viewer); 71 68 $changeset_view->setHeader($changeset_header); 72 69
-3
src/applications/diffusion/controller/DiffusionDiffController.php
··· 88 88 ($viewer->getPHID() == $commit->getAuthorPHID())); 89 89 $parser->setObjectOwnerPHID($commit->getAuthorPHID()); 90 90 91 - $parser->setWhitespaceMode( 92 - DifferentialChangesetParser::WHITESPACE_SHOW_ALL); 93 - 94 91 $inlines = PhabricatorAuditInlineComment::loadDraftAndPublishedComments( 95 92 $viewer, 96 93 $commit->getPHID(),
-16
src/docs/user/userguide/differential_faq.diviner
··· 51 51 PHP. See the `pygments.enabled` configuration setting. 52 52 53 53 54 - = What do the whitespace options mean? = 55 - 56 - Most of these are pretty straightforward, but "Ignore Most" is not: 57 - 58 - - **Show All**: Show all whitespace. 59 - - **Ignore Trailing**: Ignore changes which only affect trailing whitespace. 60 - - **Ignore Most**: Ignore changes which only affect leading or trailing 61 - whitespace (but not whitespace changes between non-whitespace characters) 62 - in files which are not marked as having significant whitespace. 63 - In those files, show whitespace changes. By default, Python (.py) and 64 - Haskell (.lhs, .hs) are marked as having significant whitespace, but this 65 - can be changed in the `differential.whitespace-matters` configuration 66 - setting. 67 - - **Ignore All**: Ignore all whitespace changes in all files. 68 - 69 - 70 54 = What do the very light green and red backgrounds mean? = 71 55 72 56 Differential uses these colors to mark changes coming from rebase: they are
+4 -43
src/infrastructure/diff/PhabricatorDifferenceEngine.php
··· 10 10 final class PhabricatorDifferenceEngine extends Phobject { 11 11 12 12 13 - private $ignoreWhitespace; 14 13 private $oldName; 15 14 private $newName; 16 15 ··· 19 18 20 19 21 20 /** 22 - * If true, ignore whitespace when computing differences. 23 - * 24 - * @param bool Ignore whitespace? 25 - * @return this 26 - * @task config 27 - */ 28 - public function setIgnoreWhitespace($ignore_whitespace) { 29 - $this->ignoreWhitespace = $ignore_whitespace; 30 - return $this; 31 - } 32 - 33 - 34 - /** 35 21 * Set the name to identify the old file with. Primarily cosmetic. 36 22 * 37 23 * @param string Old file name. ··· 73 59 public function generateRawDiffFromFileContent($old, $new) { 74 60 75 61 $options = array(); 76 - if ($this->ignoreWhitespace) { 77 - $options[] = '-bw'; 78 - } 79 62 80 63 // Generate diffs with full context. 81 64 $options[] = '-U65535'; ··· 100 83 $new_tmp); 101 84 102 85 if (!$err) { 103 - // This indicates that the two files are the same (or, possibly, the 104 - // same modulo whitespace differences, which is why we can't do this 105 - // check trivially before running `diff`). Build a synthetic, changeless 106 - // diff so that we can still render the raw, unchanged file instead of 107 - // being forced to just say "this file didn't change" since we don't have 108 - // the content. 86 + // This indicates that the two files are the same. Build a synthetic, 87 + // changeless diff so that we can still render the raw, unchanged file 88 + // instead of being forced to just say "this file didn't change" since we 89 + // don't have the content. 109 90 110 91 $entire_file = explode("\n", $old); 111 92 foreach ($entire_file as $k => $line) { ··· 123 104 "+++ {$new_name}\n". 124 105 "@@ -1,{$len} +1,{$len} @@\n". 125 106 $entire_file."\n"; 126 - } else { 127 - if ($this->ignoreWhitespace) { 128 - 129 - // Under "-bw", `diff` is inconsistent about emitting "\ No newline 130 - // at end of file". For instance, a long file with a change in the 131 - // middle will emit a contextless "\ No newline..." at the end if a 132 - // newline is removed, but not if one is added. A file with a change 133 - // at the end will emit the "old" "\ No newline..." block only, even 134 - // if the newline was not removed. Since we're ostensibly ignoring 135 - // whitespace changes, just drop these lines if they appear anywhere 136 - // in the diff. 137 - 138 - $lines = explode("\n", $diff); 139 - foreach ($lines as $key => $line) { 140 - if (isset($line[0]) && $line[0] == '\\') { 141 - unset($lines[$key]); 142 - } 143 - } 144 - $diff = implode("\n", $lines); 145 - } 146 107 } 147 108 148 109 return $diff;
-3
webroot/rsrc/js/application/diff/DiffChangeset.js
··· 22 22 23 23 this._renderURI = data.renderURI; 24 24 this._ref = data.ref; 25 - this._whitespace = data.whitespace; 26 25 this._renderer = data.renderer; 27 26 this._highlight = data.highlight; 28 27 this._encoding = data.encoding; ··· 46 45 47 46 _renderURI: null, 48 47 _ref: null, 49 - _whitespace: null, 50 48 _renderer: null, 51 49 _highlight: null, 52 50 _encoding: null, ··· 310 308 _getViewParameters: function() { 311 309 return { 312 310 ref: this._ref, 313 - whitespace: this._whitespace || '', 314 311 renderer: this.getRenderer() || '', 315 312 highlight: this._highlight || '', 316 313 encoding: this._encoding || ''