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

Merge branch 'master' into redesign-2015

+244 -60
+2 -2
src/applications/differential/config/PhabricatorDifferentialConfigOptions.php
··· 34 34 new DifferentialReviewedByField(), 35 35 new DifferentialSubscribersField(), 36 36 new DifferentialRepositoryField(), 37 - new DifferentialLintField(), 38 37 new DifferentialProjectsField(), 39 - new DifferentialUnitField(), 40 38 new DifferentialViewPolicyField(), 41 39 new DifferentialEditPolicyField(), 42 40 ··· 54 52 new DifferentialBlameRevisionField(), 55 53 new DifferentialPathField(), 56 54 new DifferentialHostField(), 55 + new DifferentialLintField(), 56 + new DifferentialUnitField(), 57 57 new DifferentialRevertPlanField(), 58 58 59 59 new DifferentialApplyPatchField(),
+87 -21
src/applications/differential/controller/DifferentialRevisionViewController.php
··· 206 206 $visible_changesets = $changesets; 207 207 } 208 208 209 - 210 - // TODO: This should be in a DiffQuery or similar. 211 - $need_props = array(); 212 - foreach ($field_list->getFields() as $field) { 213 - foreach ($field->getRequiredDiffPropertiesForRevisionView() as $prop) { 214 - $need_props[$prop] = $prop; 215 - } 216 - } 217 - 218 - if ($need_props) { 219 - $prop_diff = $revision->getActiveDiff(); 220 - $load_props = id(new DifferentialDiffProperty())->loadAllWhere( 221 - 'diffID = %d AND name IN (%Ls)', 222 - $prop_diff->getID(), 223 - $need_props); 224 - $load_props = mpull($load_props, 'getData', 'getName'); 225 - foreach ($need_props as $need) { 226 - $prop_diff->attachProperty($need, idx($load_props, $need)); 227 - } 228 - } 229 - 230 209 $commit_hashes = mpull($diffs, 'getSourceControlBaseRevision'); 231 210 $local_commits = idx($props, 'local:commits', array()); 232 211 foreach ($local_commits as $local_commit) { ··· 285 264 ->setErrors($revision_warnings); 286 265 $revision_detail_box->setInfoView($revision_warnings); 287 266 } 267 + 268 + $diff_detail_box = $this->buildDiffDetailView( 269 + array_select_keys($diffs, array($diff_vs, $target->getID())), 270 + $revision, 271 + $field_list); 288 272 289 273 $comment_view = $this->buildTransactions( 290 274 $revision, ··· 486 470 487 471 $content = array( 488 472 $revision_detail_box, 473 + $diff_detail_box, 489 474 $page_pane, 490 475 ); 491 476 ··· 971 956 972 957 return $warnings; 973 958 } 959 + 960 + private function buildDiffDetailView( 961 + array $diffs, 962 + DifferentialRevision $revision, 963 + PhabricatorCustomFieldList $field_list) { 964 + $viewer = $this->getViewer(); 965 + 966 + $fields = array(); 967 + foreach ($field_list->getFields() as $field) { 968 + if ($field->shouldAppearInDiffPropertyView()) { 969 + $fields[] = $field; 970 + } 971 + } 972 + 973 + if (!$fields) { 974 + return null; 975 + } 976 + 977 + // Make sure we're only going to render unique diffs. 978 + $diffs = mpull($diffs, null, 'getID'); 979 + $labels = array(pht('Left'), pht('Right')); 980 + 981 + $property_lists = array(); 982 + foreach ($diffs as $diff) { 983 + if (count($diffs) == 2) { 984 + $label = array_shift($labels); 985 + $label = pht('%s (Diff %d)', $label, $diff->getID()); 986 + } else { 987 + $label = pht('Diff %d', $diff->getID()); 988 + } 989 + 990 + $property_lists[] = array( 991 + $label, 992 + $this->buildDiffPropertyList($diff, $revision, $fields), 993 + ); 994 + } 995 + 996 + $box = id(new PHUIObjectBoxView()) 997 + ->setHeaderText(pht('Diff Detail')) 998 + ->setUser($viewer); 999 + 1000 + $last_tab = null; 1001 + foreach ($property_lists as $key => $property_list) { 1002 + list($tab_name, $list_view) = $property_list; 1003 + 1004 + $tab = id(new PHUIListItemView()) 1005 + ->setKey($key) 1006 + ->setName($tab_name); 1007 + 1008 + $box->addPropertyList($list_view, $tab); 1009 + $last_tab = $tab; 1010 + } 1011 + 1012 + if ($last_tab) { 1013 + $last_tab->setSelected(true); 1014 + } 1015 + 1016 + return $box; 1017 + } 1018 + 1019 + private function buildDiffPropertyList( 1020 + DifferentialDiff $diff, 1021 + DifferentialRevision $revision, 1022 + array $fields) { 1023 + $viewer = $this->getViewer(); 1024 + 1025 + $view = id(new PHUIPropertyListView()) 1026 + ->setUser($viewer) 1027 + ->setObject($diff); 1028 + 1029 + foreach ($fields as $field) { 1030 + $label = $field->renderDiffPropertyViewLabel($diff); 1031 + $value = $field->renderDiffPropertyViewValue($diff); 1032 + if ($value !== null) { 1033 + $view->addProperty($label, $value); 1034 + } 1035 + } 1036 + 1037 + return $view; 1038 + } 1039 + 974 1040 975 1041 }
+11 -3
src/applications/differential/customfield/DifferentialBranchField.php
··· 19 19 return true; 20 20 } 21 21 22 - public function renderPropertyViewLabel() { 22 + public function renderPropertyViewValue(array $handles) { 23 + return null; 24 + } 25 + 26 + public function shouldAppearInDiffPropertyView() { 27 + return true; 28 + } 29 + 30 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 23 31 return $this->getFieldName(); 24 32 } 25 33 26 - public function renderPropertyViewValue(array $handles) { 27 - return $this->getBranchDescription($this->getObject()->getActiveDiff()); 34 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 35 + return $this->getBranchDescription($diff); 28 36 } 29 37 30 38 private function getBranchDescription(DifferentialDiff $diff) {
+38 -7
src/applications/differential/customfield/DifferentialCustomField.php
··· 2 2 3 3 /** 4 4 * @task commitmessage Integration with Commit Messages 5 + * @task diff Integration with Diff Properties 5 6 */ 6 7 abstract class DifferentialCustomField 7 8 extends PhabricatorCustomField { ··· 29 30 } 30 31 31 32 return parent::shouldEnableForRole($role); 32 - } 33 - 34 - public function getRequiredDiffPropertiesForRevisionView() { 35 - if ($this->getProxy()) { 36 - return $this->getProxy()->getRequiredDiffPropertiesForRevisionView(); 37 - } 38 - return array(); 39 33 } 40 34 41 35 protected function parseObjectList( ··· 81 75 public function getWarningsForRevisionHeader(array $handles) { 82 76 return array(); 83 77 } 78 + 84 79 85 80 /* -( Integration with Commit Messages )----------------------------------- */ 86 81 ··· 215 210 return $this->getProxy()->validateCommitMessageValue($value); 216 211 } 217 212 return; 213 + } 214 + 215 + 216 + /* -( Integration with Diff Properties )----------------------------------- */ 217 + 218 + 219 + /** 220 + * @task diff 221 + */ 222 + public function shouldAppearInDiffPropertyView() { 223 + if ($this->getProxy()) { 224 + return $this->getProxy()->shouldAppearInDiffPropertyView(); 225 + } 226 + return false; 227 + } 228 + 229 + 230 + /** 231 + * @task diff 232 + */ 233 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 234 + if ($this->proxy) { 235 + return $this->proxy->renderDiffPropertyViewLabel($diff); 236 + } 237 + return $this->getFieldName(); 238 + } 239 + 240 + 241 + /** 242 + * @task diff 243 + */ 244 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 245 + if ($this->proxy) { 246 + return $this->proxy->renderDiffPropertyViewValue($diff); 247 + } 248 + throw new PhabricatorCustomFieldImplementationIncompleteException($this); 218 249 } 219 250 220 251 }
+11 -3
src/applications/differential/customfield/DifferentialHostField.php
··· 23 23 return true; 24 24 } 25 25 26 - public function renderPropertyViewLabel() { 26 + public function renderPropertyViewValue(array $handles) { 27 + return null; 28 + } 29 + 30 + public function shouldAppearInDiffPropertyView() { 31 + return true; 32 + } 33 + 34 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 27 35 return $this->getFieldName(); 28 36 } 29 37 30 - public function renderPropertyViewValue(array $handles) { 31 - $host = $this->getObject()->getActiveDiff()->getSourceMachine(); 38 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 39 + $host = $diff->getSourceMachine(); 32 40 if (!$host) { 33 41 return null; 34 42 }
+23 -6
src/applications/differential/customfield/DifferentialLintField.php
··· 19 19 return true; 20 20 } 21 21 22 - public function renderPropertyViewLabel() { 22 + public function renderPropertyViewValue(array $handles) { 23 + return null; 24 + } 25 + 26 + public function shouldAppearInDiffPropertyView() { 27 + return true; 28 + } 29 + 30 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 23 31 return $this->getFieldName(); 24 32 } 25 33 26 - public function getRequiredDiffPropertiesForRevisionView() { 27 - return array( 34 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 35 + // TODO: This load is slightly inefficient, but most of this is moving 36 + // to Harbormaster and this simplifies the transition. Eat 1-2 extra 37 + // queries for now. 38 + $keys = array( 28 39 'arc:lint', 29 40 'arc:lint-excuse', 30 41 'arc:lint-postponed', 31 42 ); 32 - } 33 43 34 - public function renderPropertyViewValue(array $handles) { 35 - $diff = $this->getObject()->getActiveDiff(); 44 + $properties = id(new DifferentialDiffProperty())->loadAllWhere( 45 + 'diffID = %d AND name IN (%Ls)', 46 + $diff->getID(), 47 + $keys); 48 + $properties = mpull($properties, 'getData', 'getName'); 49 + 50 + foreach ($keys as $key) { 51 + $diff->attachProperty($key, idx($properties, $key)); 52 + } 36 53 37 54 $path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename'); 38 55
+11 -3
src/applications/differential/customfield/DifferentialPathField.php
··· 23 23 return true; 24 24 } 25 25 26 - public function renderPropertyViewLabel() { 26 + public function renderPropertyViewValue(array $handles) { 27 + return null; 28 + } 29 + 30 + public function shouldAppearInDiffPropertyView() { 31 + return true; 32 + } 33 + 34 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 27 35 return $this->getFieldName(); 28 36 } 29 37 30 - public function renderPropertyViewValue(array $handles) { 31 - $path = $this->getObject()->getActiveDiff()->getSourcePath(); 38 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 39 + $path = $diff->getSourcePath(); 32 40 if (!$path) { 33 41 return null; 34 42 }
+13 -9
src/applications/differential/customfield/DifferentialRepositoryField.php
··· 125 125 return true; 126 126 } 127 127 128 - public function renderPropertyViewLabel() { 128 + public function renderPropertyViewValue(array $handles) { 129 + return null; 130 + } 131 + 132 + public function shouldAppearInDiffPropertyView() { 133 + return true; 134 + } 135 + 136 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 129 137 return $this->getFieldName(); 130 138 } 131 139 132 - public function getRequiredHandlePHIDsForPropertyView() { 133 - $repository_phid = $this->getObject()->getRepositoryPHID(); 134 - if ($repository_phid) { 135 - return array($repository_phid); 140 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 141 + if (!$diff->getRepositoryPHID()) { 142 + return null; 136 143 } 137 - return array(); 138 - } 139 144 140 - public function renderPropertyViewValue(array $handles) { 141 - return $this->renderHandleList($handles); 145 + return $this->getViewer()->renderHandle($diff->getRepositoryPHID()); 142 146 } 143 147 144 148 public function shouldAppearInTransactionMail() {
+21 -6
src/applications/differential/customfield/DifferentialUnitField.php
··· 19 19 return true; 20 20 } 21 21 22 - public function renderPropertyViewLabel() { 22 + public function renderPropertyViewValue(array $handles) { 23 + return null; 24 + } 25 + 26 + public function shouldAppearInDiffPropertyView() { 27 + return true; 28 + } 29 + 30 + public function renderDiffPropertyViewLabel(DifferentialDiff $diff) { 23 31 return $this->getFieldName(); 24 32 } 25 33 26 - public function getRequiredDiffPropertiesForRevisionView() { 27 - return array( 34 + public function renderDiffPropertyViewValue(DifferentialDiff $diff) { 35 + // TODO: See DifferentialLintField. 36 + $keys = array( 28 37 'arc:unit', 29 38 'arc:unit-excuse', 30 39 ); 31 - } 40 + 41 + $properties = id(new DifferentialDiffProperty())->loadAllWhere( 42 + 'diffID = %d AND name IN (%Ls)', 43 + $diff->getID(), 44 + $keys); 45 + $properties = mpull($properties, 'getData', 'getName'); 32 46 33 - public function renderPropertyViewValue(array $handles) { 34 - $diff = $this->getObject()->getActiveDiff(); 47 + foreach ($keys as $key) { 48 + $diff->attachProperty($key, idx($properties, $key)); 49 + } 35 50 36 51 $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff); 37 52 $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
+7
src/applications/harbormaster/event/HarbormasterUIEventListener.php
··· 31 31 return; 32 32 } 33 33 34 + if ($object instanceof DifferentialRevision) { 35 + // TODO: This is a bit hacky and we could probably find a cleaner fix 36 + // eventually, but we show build status on each diff, immediately below 37 + // this property list, so it's redundant to show it on the revision view. 38 + return; 39 + } 40 + 34 41 if (!($object instanceof HarbormasterBuildableInterface)) { 35 42 return; 36 43 }
+20
src/applications/policy/controller/PhabricatorPolicyExplainController.php
··· 69 69 $capability_name = $capobj->getCapabilityName(); 70 70 } 71 71 72 + $space_info = null; 73 + if ($object instanceof PhabricatorSpacesInterface) { 74 + if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) { 75 + $space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID( 76 + $object); 77 + 78 + $handles = $viewer->loadHandles(array($space_phid)); 79 + 80 + $space_info = array( 81 + pht( 82 + 'This object is in %s, and can only be seen by users with '. 83 + 'access to that space.', 84 + $handles[$space_phid]->renderLink()), 85 + phutil_tag('br'), 86 + phutil_tag('br'), 87 + ); 88 + } 89 + } 90 + 72 91 $content = array( 92 + $space_info, 73 93 pht('Users with the "%s" capability:', $capability_name), 74 94 $auto_info, 75 95 );