@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 `commit` from DiffusionRequest

Summary: Ref T2683. This field is //almost// entirely redundant with `symbolicCommit`. Improve how some of the diff query stuff works a bit, then remove it.

Test Plan: Browsed around in all interfaces, looked at a bunch of diffs, etc.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2683

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

+40 -23
+4 -4
src/applications/diffusion/conduit/ConduitAPI_diffusion_diffquery_Method.php
··· 168 168 $drequest, 169 169 'diffusion.lastmodifiedquery', 170 170 array( 171 - 'paths' => array($path => $drequest->getCommit()), 171 + 'paths' => array($path => $drequest->getStableCommit()), 172 172 )); 173 173 174 174 $this->effectiveCommit = idx($result, $path); ··· 199 199 if (!$effective_commit) { 200 200 return $this->getEmptyResult(1); 201 201 } 202 - // TODO: This side effect is kind of sketchy. 203 - $drequest->setCommit($effective_commit); 204 202 205 - $raw_query = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest); 203 + $raw_query = DiffusionRawDiffQuery::newFromDiffusionRequest($drequest) 204 + ->setAnchorCommit($effective_commit); 205 + 206 206 $raw_diff = $raw_query->loadRawDiff(); 207 207 if (!$raw_diff) { 208 208 return $this->getEmptyResult(2);
+3 -2
src/applications/diffusion/controller/DiffusionChangeController.php
··· 18 18 'commit' => $drequest->getCommit(), 19 19 'path' => $drequest->getPath(), 20 20 )); 21 - $drequest->setCommit($data['effectiveCommit']); 21 + 22 + $drequest->updateSymbolicCommit($data['effectiveCommit']); 23 + 22 24 $raw_changes = ArcanistDiffChange::newFromConduit($data['changes']); 23 25 $diff = DifferentialDiff::newFromRawChanges($raw_changes); 24 26 $changesets = $diff->getChangesets(); ··· 31 33 32 34 $repository = $drequest->getRepository(); 33 35 $callsign = $repository->getCallsign(); 34 - $commit = $drequest->getSymbolicCommit(); 35 36 $changesets = array( 36 37 0 => $changeset, 37 38 );
+1 -1
src/applications/diffusion/controller/DiffusionDiffController.php
··· 51 51 array( 52 52 'commit' => $drequest->getCommit(), 53 53 'path' => $drequest->getPath())); 54 - $drequest->setCommit($data['effectiveCommit']); 54 + $drequest->updateSymbolicCommit($data['effectiveCommit']); 55 55 $raw_changes = ArcanistDiffChange::newFromConduit($data['changes']); 56 56 $diff = DifferentialDiff::newFromRawChanges($raw_changes); 57 57 $changesets = $diff->getChangesets();
+1 -1
src/applications/diffusion/controller/DiffusionHistoryController.php
··· 152 152 ->setUser($viewer) 153 153 ->setActionList($actions); 154 154 155 - $stable_commit = $drequest->getStableCommitName(); 155 + $stable_commit = $drequest->getStableCommit(); 156 156 $callsign = $drequest->getRepository()->getCallsign(); 157 157 158 158 $view->addProperty(
+1 -1
src/applications/diffusion/query/rawdiff/DiffusionGitRawDiffQuery.php
··· 6 6 $drequest = $this->getRequest(); 7 7 $repository = $drequest->getRepository(); 8 8 9 - $commit = $drequest->getCommit(); 9 + $commit = $this->getAnchorCommit(); 10 10 11 11 $options = array( 12 12 '-M',
+1 -1
src/applications/diffusion/query/rawdiff/DiffusionMercurialRawDiffQuery.php
··· 10 10 $drequest = $this->getRequest(); 11 11 $repository = $drequest->getRepository(); 12 12 13 - $commit = $drequest->getCommit(); 13 + $commit = $this->getAnchorCommit(); 14 14 15 15 // If there's no path, get the entire raw diff. 16 16 $path = nonempty($drequest->getPath(), '.');
+14 -1
src/applications/diffusion/query/rawdiff/DiffusionRawDiffQuery.php
··· 2 2 3 3 abstract class DiffusionRawDiffQuery extends DiffusionQuery { 4 4 5 - private $request; 6 5 private $timeout; 7 6 private $linesOfContext = 65535; 7 + private $anchorCommit; 8 8 private $againstCommit; 9 9 private $byteLimit; 10 10 ··· 51 51 52 52 final public function getAgainstCommit() { 53 53 return $this->againstCommit; 54 + } 55 + 56 + public function setAnchorCommit($anchor_commit) { 57 + $this->anchorCommit = $anchor_commit; 58 + return $this; 59 + } 60 + 61 + public function getAnchorCommit() { 62 + if ($this->anchorCommit) { 63 + return $this->anchorCommit; 64 + } 65 + 66 + return $this->getRequest()->getStableCommit(); 54 67 } 55 68 56 69 protected function configureFuture(ExecFuture $future) {
+1 -1
src/applications/diffusion/query/rawdiff/DiffusionSvnRawDiffQuery.php
··· 6 6 $drequest = $this->getRequest(); 7 7 $repository = $drequest->getRepository(); 8 8 9 - $commit = $drequest->getCommit(); 9 + $commit = $this->getAnchorCommit(); 10 10 $arc_root = phutil_get_library_root('arcanist'); 11 11 12 12 $against = $this->getAgainstCommit();
+14 -11
src/applications/diffusion/request/DiffusionRequest.php
··· 12 12 protected $callsign; 13 13 protected $path; 14 14 protected $line; 15 - protected $commit; 16 15 protected $branch; 17 16 protected $lint; 18 17 ··· 241 240 242 241 // TODO: Probably remove all of this. 243 242 244 - // Required for sketchy sins that `diffusion.diffquery` commits. 245 - if ($this->commit) { 246 - return $this->commit; 247 - } 248 - 249 243 if ($this->getSymbolicCommit() !== null) { 250 244 return $this->getSymbolicCommit(); 251 245 } ··· 269 263 */ 270 264 public function getSymbolicCommit() { 271 265 return $this->symbolicCommit; 266 + } 267 + 268 + 269 + /** 270 + * Modify the request to move the symbolic commit elsewhere. 271 + * 272 + * @param string New symbolic commit. 273 + * @return this 274 + */ 275 + public function updateSymbolicCommit($symbol) { 276 + $this->symbolicCommit = $symbol; 277 + $this->symbolicType = null; 278 + $this->stableCommit = null; 279 + return $this; 272 280 } 273 281 274 282 ··· 378 386 $this->repositoryCommitData = $data; 379 387 } 380 388 return $this->repositoryCommitData; 381 - } 382 - 383 - public function setCommit($commit) { 384 - $this->commit = $commit; 385 - return $this; 386 389 } 387 390 388 391 /* -( Managing Diffusion URIs )-------------------------------------------- */