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

Show revision sizes using a perplexing, inexplicable symbol code

Summary: Ref T13110. See PHI230. Show revision sizes on a roughly logarithmic scale from 1-7 stars. See D16322 for theorycrafting on this element.

Test Plan: Looked at some revisions, saw plausible-looking size markers.

Maniphest Tasks: T13110

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

+136 -6
+5 -5
resources/celerity/map.php
··· 9 9 'names' => array( 10 10 'conpherence.pkg.css' => 'e68cf1fa', 11 11 'conpherence.pkg.js' => '15191c65', 12 - 'core.pkg.css' => '1dd5fa4b', 12 + 'core.pkg.css' => '49b87886', 13 13 'core.pkg.js' => '1ea38af8', 14 14 'differential.pkg.css' => '113e692c', 15 15 'differential.pkg.js' => 'f6d809c0', ··· 132 132 'rsrc/css/phui/object-item/phui-oi-color.css' => 'cd2b9b77', 133 133 'rsrc/css/phui/object-item/phui-oi-drag-ui.css' => '08f4ccc3', 134 134 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '9d9685d6', 135 - 'rsrc/css/phui/object-item/phui-oi-list-view.css' => '6ae18df0', 135 + 'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'ae1404ba', 136 136 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea', 137 137 'rsrc/css/phui/phui-action-list.css' => '0bcd9a45', 138 138 'rsrc/css/phui/phui-action-panel.css' => 'b4798122', ··· 158 158 'rsrc/css/phui/phui-header-view.css' => '31dc6c72', 159 159 'rsrc/css/phui/phui-hovercard.css' => 'f0592bcf', 160 160 'rsrc/css/phui/phui-icon-set-selector.css' => '87db8fee', 161 - 'rsrc/css/phui/phui-icon.css' => '5c4a5de6', 161 + 'rsrc/css/phui/phui-icon.css' => 'cf24ceec', 162 162 'rsrc/css/phui/phui-image-mask.css' => 'a8498f9c', 163 163 'rsrc/css/phui/phui-info-view.css' => 'e929f98c', 164 164 'rsrc/css/phui/phui-invisible-character-view.css' => '6993d9f0', ··· 833 833 'phui-hovercard' => '1bd28176', 834 834 'phui-hovercard-view-css' => 'f0592bcf', 835 835 'phui-icon-set-selector-css' => '87db8fee', 836 - 'phui-icon-view-css' => '5c4a5de6', 836 + 'phui-icon-view-css' => 'cf24ceec', 837 837 'phui-image-mask-css' => 'a8498f9c', 838 838 'phui-info-view-css' => 'e929f98c', 839 839 'phui-inline-comment-view-css' => '65ae3bc2', ··· 846 846 'phui-oi-color-css' => 'cd2b9b77', 847 847 'phui-oi-drag-ui-css' => '08f4ccc3', 848 848 'phui-oi-flush-ui-css' => '9d9685d6', 849 - 'phui-oi-list-view-css' => '6ae18df0', 849 + 'phui-oi-list-view-css' => 'ae1404ba', 850 850 'phui-oi-simple-ui-css' => 'a8beebea', 851 851 'phui-pager-css' => 'edcbc226', 852 852 'phui-pinboard-view-css' => '2495140e',
+1 -1
src/applications/differential/editor/DifferentialTransactionEditor.php
··· 568 568 569 569 if ($show_lines) { 570 570 $count = new PhutilNumber($object->getLineCount()); 571 - $action = pht('%s, %s line(s)', $action, $count); 571 + $action = pht('%s] [%s', $action, $object->getRevisionScaleGlyphs()); 572 572 } 573 573 574 574 return $action;
+44
src/applications/differential/storage/DifferentialRevision.php
··· 742 742 return $this->getProperty(self::PROPERTY_LINES_REMOVED); 743 743 } 744 744 745 + public function getRevisionScaleGlyphs() { 746 + $add = $this->getAddedLineCount(); 747 + $rem = $this->getRemovedLineCount(); 748 + $all = ($add + $rem); 749 + 750 + if (!$all) { 751 + return ' '; 752 + } 753 + 754 + $map = array( 755 + 20 => 2, 756 + 50 => 3, 757 + 150 => 4, 758 + 375 => 5, 759 + 1000 => 6, 760 + 2500 => 7, 761 + ); 762 + 763 + $n = 1; 764 + foreach ($map as $size => $count) { 765 + if ($size <= $all) { 766 + $n = $count; 767 + } else { 768 + break; 769 + } 770 + } 771 + 772 + $add_n = (int)ceil(($add / $all) * $n); 773 + $rem_n = (int)ceil(($rem / $all) * $n); 774 + 775 + while ($add_n + $rem_n > $n) { 776 + if ($add_n > 1) { 777 + $add_n--; 778 + } else { 779 + $rem_n--; 780 + } 781 + } 782 + 783 + return 784 + str_repeat('+', $add_n). 785 + str_repeat('-', $rem_n). 786 + str_repeat(' ', (7 - $n)); 787 + } 788 + 745 789 public function getBuildableStatus($phid) { 746 790 $buildables = $this->getProperty(self::PROPERTY_BUILDABLES); 747 791 if (!is_array($buildables)) {
+53
src/applications/differential/view/DifferentialRevisionListView.php
··· 109 109 $item->setHeader($revision->getTitle()); 110 110 $item->setHref($revision->getURI()); 111 111 112 + $item->addAttribute($this->renderRevisionSize($revision)); 113 + 112 114 if ($revision->getHasDraft($viewer)) { 113 115 $draft = id(new PHUIIconView()) 114 116 ->setIcon('fa-comment yellow') ··· 188 190 } 189 191 190 192 return $list; 193 + } 194 + 195 + private function renderRevisionSize(DifferentialRevision $revision) { 196 + $size = array(); 197 + 198 + $glyphs = $revision->getRevisionScaleGlyphs(); 199 + $plus_count = 0; 200 + for ($ii = 0; $ii < 7; $ii++) { 201 + $c = $glyphs[$ii]; 202 + 203 + switch ($c) { 204 + case '+': 205 + $size[] = id(new PHUIIconView()) 206 + ->setIcon('fa-plus'); 207 + $plus_count++; 208 + break; 209 + case '-': 210 + $size[] = id(new PHUIIconView()) 211 + ->setIcon('fa-minus'); 212 + break; 213 + default: 214 + $size[] = id(new PHUIIconView()) 215 + ->setIcon('fa-square-o invisible'); 216 + break; 217 + } 218 + } 219 + 220 + $n = $revision->getAddedLineCount() + $revision->getRemovedLineCount(); 221 + 222 + $classes = array(); 223 + $classes[] = 'differential-revision-size'; 224 + 225 + if ($plus_count <= 1) { 226 + $classes[] = 'differential-revision-small'; 227 + } 228 + 229 + if ($plus_count >= 4) { 230 + $classes[] = 'differential-revision-large'; 231 + } 232 + 233 + return javelin_tag( 234 + 'span', 235 + array( 236 + 'class' => implode(' ', $classes), 237 + 'sigil' => 'has-tooltip', 238 + 'meta' => array( 239 + 'tip' => pht('%s Lines', new PhutilNumber($n)), 240 + 'align' => 'E', 241 + ), 242 + ), 243 + $size); 191 244 } 192 245 193 246 }
+29
webroot/rsrc/css/phui/object-item/phui-oi-list-view.css
··· 687 687 .phui-oi-frame { 688 688 border-color: {$blueborder}; 689 689 } 690 + 691 + .differential-revision-size { 692 + padding: 0 4px; 693 + border-radius: 4px; 694 + background: {$lightgreybackground}; 695 + cursor: pointer; 696 + } 697 + 698 + .differential-revision-size .phui-icon-view { 699 + margin: 0 1px 0 1px; 700 + font-size: smaller; 701 + color: {$blueborder}; 702 + } 703 + 704 + .differential-revision-large { 705 + background: {$sh-redbackground}; 706 + } 707 + 708 + .differential-revision-large .phui-icon-view { 709 + color: {$red}; 710 + } 711 + 712 + .differential-revision-small { 713 + background: {$sh-greenbackground}; 714 + } 715 + 716 + .differential-revision-small .phui-icon-view { 717 + color: {$green}; 718 + }
+4
webroot/rsrc/css/phui/phui-icon.css
··· 49 49 color: {$bluetext}; 50 50 } 51 51 52 + .phui-icon-view.invisible { 53 + visibility: hidden; 54 + } 55 + 52 56 /* - Icon in a Circle ------------------------------------------------------- */ 53 57 54 58 .phui-icon-circle {