Differential D21518 Diff 51218 src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
Show First 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | foreach ($ref_groups as $name => $refs) { | ||||
$new_position = id(new PhabricatorRepositoryRefPosition()) | $new_position = id(new PhabricatorRepositoryRefPosition()) | ||||
->setCursorID($ref_cursor->getID()) | ->setCursorID($ref_cursor->getID()) | ||||
->setCommitIdentifier($identifier) | ->setCommitIdentifier($identifier) | ||||
->setIsClosed(0); | ->setIsClosed(0); | ||||
$this->markPositionNew($new_position); | $this->markPositionNew($new_position); | ||||
} | } | ||||
$diffusion_ref = head($refs)->newDiffusionRepositoryRef(); | if ($publisher->isPermanentRef(head($refs))) { | ||||
if ($publisher->isPermanentRef($diffusion_ref)) { | |||||
// See T13284. If this cursor was already marked as permanent, we | // See T13284. If this cursor was already marked as permanent, we | ||||
// only need to publish the newly created ref positions. However, if | // only need to publish the newly created ref positions. However, if | ||||
// this cursor was not previously permanent but has become permanent, | // this cursor was not previously permanent but has become permanent, | ||||
// we need to publish all the ref positions. | // we need to publish all the ref positions. | ||||
// This corresponds to users reconfiguring a branch to make it | // This corresponds to users reconfiguring a branch to make it | ||||
// permanent without pushing any new commits to it. | // permanent without pushing any new commits to it. | ||||
▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | private function setPermanentFlagOnCommits(array $identifiers) { | ||||
return $this; | return $this; | ||||
} | } | ||||
private function newRefCursor( | private function newRefCursor( | ||||
PhabricatorRepository $repository, | PhabricatorRepository $repository, | ||||
$ref_type, | $ref_type, | ||||
$ref_name) { | $ref_name) { | ||||
$is_permanent = $this->isPermanentRef($ref_type, $ref_name); | |||||
$cursor = id(new PhabricatorRepositoryRefCursor()) | $cursor = id(new PhabricatorRepositoryRefCursor()) | ||||
->setRepositoryPHID($repository->getPHID()) | ->setRepositoryPHID($repository->getPHID()) | ||||
->setRefType($ref_type) | ->setRefType($ref_type) | ||||
->setRefName($ref_name) | ->setRefName($ref_name); | ||||
->setIsPermanent((int)$is_permanent); | |||||
$publisher = $repository->newPublisher(); | |||||
$diffusion_ref = $cursor->newDiffusionRepositoryRef(); | |||||
$is_permanent = $publisher->isPermanentRef($diffusion_ref); | |||||
$cursor->setIsPermanent((int)$is_permanent); | |||||
try { | try { | ||||
return $cursor->save(); | return $cursor->save(); | ||||
} catch (AphrontDuplicateKeyQueryException $ex) { | } catch (AphrontDuplicateKeyQueryException $ex) { | ||||
// If we raced another daemon to create this position and lost the race, | // If we raced another daemon to create this position and lost the race, | ||||
// load the cursor the other daemon created instead. | // load the cursor the other daemon created instead. | ||||
} | } | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |