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

Expose repository ref rules via "diffusion.repository.search"

Summary:
Depends on D20425. Ref T13277. See PHI1067. There's currently no way to retrieve branch/ref rules over the API, which makes some management operations against a large number of repositories difficult.

Expose these rules to the API.

Test Plan: Called `diffusion.repository.search`, got rules in the result set.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13277

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

+34
+34
src/applications/repository/storage/PhabricatorRepository.php
··· 2834 2834 pht( 2835 2835 'The Almanac Service that hosts this repository, if the '. 2836 2836 'repository is clustered.')), 2837 + id(new PhabricatorConduitSearchFieldSpecification()) 2838 + ->setKey('refRules') 2839 + ->setType('map<string, list<string>>') 2840 + ->setDescription( 2841 + pht( 2842 + 'The "Fetch" and "Permanent Ref" rules for this repository.')), 2837 2843 ); 2838 2844 } 2839 2845 2840 2846 public function getFieldValuesForConduit() { 2847 + $fetch_rules = $this->getFetchRules(); 2848 + $track_rules = $this->getTrackOnlyRules(); 2849 + $permanent_rules = $this->getAutocloseOnlyRules(); 2850 + 2851 + $fetch_rules = $this->getStringListForConduit($fetch_rules); 2852 + $track_rules = $this->getStringListForConduit($track_rules); 2853 + $permanent_rules = $this->getStringListForConduit($permanent_rules); 2854 + 2841 2855 return array( 2842 2856 'name' => $this->getName(), 2843 2857 'vcs' => $this->getVersionControlSystem(), ··· 2846 2860 'status' => $this->getStatus(), 2847 2861 'isImporting' => (bool)$this->isImporting(), 2848 2862 'almanacServicePHID' => $this->getAlmanacServicePHID(), 2863 + 'refRules' => array( 2864 + 'fetchRules' => $fetch_rules, 2865 + 'trackRules' => $track_rules, 2866 + 'permanentRefRules' => $permanent_rules, 2867 + ), 2849 2868 ); 2869 + } 2870 + 2871 + private function getStringListForConduit($list) { 2872 + if (!is_array($list)) { 2873 + $list = array(); 2874 + } 2875 + 2876 + foreach ($list as $key => $value) { 2877 + $value = (string)$value; 2878 + if (!strlen($value)) { 2879 + unset($list[$key]); 2880 + } 2881 + } 2882 + 2883 + return array_values($list); 2850 2884 } 2851 2885 2852 2886 public function getConduitSearchAttachments() {