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

Correct some issues around IMPORTED_PERMANENT in RefEngine

Summary: Ref T13591. Fixes a few issues with the recent updates here discovered in more thorough testing.

Test Plan:
- Stopped the daemons.
- Created a new copy of Phabricator in Diffusion.
- Pulled it with `bin/repository pull ...`.
- Got 17,278 commits on disk with `git log --all --format=%H`.
- Set permanent refs to "master".
- Discovered it with `bin/repository discover ...`.
- This took 31.5s and inserted 17,278 tasks.
- Verified that all tasks have priority 4,000 (PRIORITY_IMPORT).
- Observed that 16,799 commits have IMPORTED_PERMANENT and 479 commits do not.
- This matches `git log master --format=%H` exactly.
- Ran `bin/repository refs ...`. Expected no changes and saw no changes.
- Ran `bin/worker execute --active` for a minute or two. It processed all the impermanent changes first (since `bin/worker` is LIFO and these are supposed to process last).
- Ran `bin/repository refs`. Expected no changes and saw no changes.
- Marked all refs as permanent.
- Starting state: 16,009 message tasks, all at priority 4000.
- Ran `bin/repository refs`, expecting 479 new tasks at priority 4000.
- Saw count rise to 16,488 as expected.
- Saw all the new tasks have priority 4000 and all commits now have the IMPORTED_PERMANENT flag.

Maniphest Tasks: T13591

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

+9 -6
+9 -6
src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
··· 344 344 $this->markPositionNew($new_position); 345 345 } 346 346 347 - $diffusion_ref = head($refs)->newDiffusionRepositoryRef(); 348 - if ($publisher->isPermanentRef($diffusion_ref)) { 347 + if ($publisher->isPermanentRef(head($refs))) { 349 348 350 349 // See T13284. If this cursor was already marked as permanent, we 351 350 // only need to publish the newly created ref positions. However, if ··· 613 612 $ref_type, 614 613 $ref_name) { 615 614 616 - $is_permanent = $this->isPermanentRef($ref_type, $ref_name); 617 - 618 615 $cursor = id(new PhabricatorRepositoryRefCursor()) 619 616 ->setRepositoryPHID($repository->getPHID()) 620 617 ->setRefType($ref_type) 621 - ->setRefName($ref_name) 622 - ->setIsPermanent((int)$is_permanent); 618 + ->setRefName($ref_name); 619 + 620 + $publisher = $repository->newPublisher(); 621 + 622 + $diffusion_ref = $cursor->newDiffusionRepositoryRef(); 623 + $is_permanent = $publisher->isPermanentRef($diffusion_ref); 624 + 625 + $cursor->setIsPermanent((int)$is_permanent); 623 626 624 627 try { 625 628 return $cursor->save();