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

Add a "branches" rule for commits

Summary:
Fixes T1353. Also some minor unrelated cleanup:

- `openTransaction()` / `saveTransaction()` exist now, fix TODOs.
- Fix some instructions.
- Make `diffusion.branchquery` return empty for SVN rather than fataling.

Test Plan:
- Added a branches rule.
- Ran a dry run against commits in different VCSes.

{F105574}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, Nopik

Maniphest Tasks: T1353

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

+30 -12
+7
src/applications/diffusion/conduit/ConduitAPI_diffusion_branchquery_Method.php
··· 100 100 return $this->processBranchRefs($request, $refs); 101 101 } 102 102 103 + protected function getSVNResult() { 104 + // Since SVN doesn't have meaningful branches, just return nothing for all 105 + // queries. 106 + return array(); 107 + } 108 + 103 109 private function processBranchRefs(ConduitAPIRequest $request, array $refs) { 104 110 $drequest = $this->getDiffusionRequest(); 105 111 $repository = $drequest->getRepository(); ··· 125 131 126 132 return mpull($refs, 'toDictionary'); 127 133 } 134 + 128 135 }
+15 -1
src/applications/herald/adapter/HeraldCommitAdapter.php
··· 88 88 return array( 89 89 self::FIELD_NEED_AUDIT_FOR_PACKAGE => 90 90 pht('Affected packages that need audit'), 91 - self::FIELD_REPOSITORY_AUTOCLOSE_BRANCH => pht('On autoclose branch'), 91 + self::FIELD_REPOSITORY_AUTOCLOSE_BRANCH 92 + => pht('Commit is on closing branch'), 92 93 ) + parent::getFieldNameMap(); 93 94 } 94 95 ··· 114 115 self::FIELD_DIFFERENTIAL_ACCEPTED, 115 116 self::FIELD_DIFFERENTIAL_REVIEWERS, 116 117 self::FIELD_DIFFERENTIAL_CCS, 118 + self::FIELD_BRANCHES, 117 119 self::FIELD_REPOSITORY_AUTOCLOSE_BRANCH, 118 120 ), 119 121 parent::getFields()); ··· 461 463 return array(); 462 464 } 463 465 return $revision->getCCPHIDs(); 466 + case self::FIELD_BRANCHES: 467 + $params = array( 468 + 'callsign' => $this->repository->getCallsign(), 469 + 'contains' => $this->commit->getCommitIdentifier(), 470 + ); 471 + 472 + $result = id(new ConduitCall('diffusion.branchquery', $params)) 473 + ->setUser(PhabricatorUser::getOmnipotentUser()) 474 + ->execute(); 475 + 476 + $refs = DiffusionRepositoryRef::loadAllFromDictionaries($result); 477 + return mpull($refs, 'getShortName'); 464 478 case self::FIELD_REPOSITORY_AUTOCLOSE_BRANCH: 465 479 return $this->repository->shouldAutocloseCommit( 466 480 $this->commit,
+5 -7
src/applications/herald/controller/HeraldTestConsoleController.php
··· 74 74 } 75 75 } 76 76 77 - $text = pht( 78 - 'Enter an object to test rules for, like a Diffusion commit (e.g., '. 79 - 'rX123) or a Differential revision (e.g., D123). You will be shown '. 80 - 'the results of a dry run on the object.'); 81 - 82 77 $form = id(new AphrontFormView()) 83 78 ->setUser($user) 84 - ->appendChild( 85 - phutil_tag('p', array('class' => 'aphront-form-instructions'), $text)) 79 + ->appendRemarkupInstructions( 80 + pht( 81 + 'Enter an object to test rules for, like a Diffusion commit (e.g., '. 82 + '`rX123`) or a Differential revision (e.g., `D123`). You will be '. 83 + 'shown the results of a dry run on the object.')) 86 84 ->appendChild( 87 85 id(new AphrontFormTextControl()) 88 86 ->setLabel(pht('Object Name'))
+3 -4
src/applications/herald/storage/HeraldRule.php
··· 17 17 protected $isDisabled = 0; 18 18 protected $triggerObjectPHID; 19 19 20 - protected $configVersion = 27; 20 + protected $configVersion = 28; 21 21 22 22 // phids for which this rule has been applied 23 23 private $ruleApplied = self::ATTACHABLE; ··· 134 134 $child->setRuleID($this->getID()); 135 135 } 136 136 137 - // TODO: 138 - // $this->openTransaction(); 137 + $this->openTransaction(); 139 138 queryfx( 140 139 $this->establishConnection('w'), 141 140 'DELETE FROM %T WHERE ruleID = %d', ··· 144 143 foreach ($children as $child) { 145 144 $child->save(); 146 145 } 147 - // $this->saveTransaction(); 146 + $this->saveTransaction(); 148 147 } 149 148 150 149 public function delete() {