Differential D21515 Diff 51209 src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
| Show First 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | foreach ($heads as $ref) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $this->log(pht('Looking for new commits.')); | $this->log(pht('Looking for new commits.')); | ||||
| $head_refs = $this->discoverStreamAncestry( | $head_refs = $this->discoverStreamAncestry( | ||||
| new PhabricatorGitGraphStream($repository, $commit), | new PhabricatorGitGraphStream($repository, $commit), | ||||
| $commit, | $commit, | ||||
| $publisher->shouldPublishRef($ref)); | $publisher->isPermanentRef($ref)); | ||||
| $this->didDiscoverRefs($head_refs); | $this->didDiscoverRefs($head_refs); | ||||
| $refs[] = $head_refs; | $refs[] = $head_refs; | ||||
| } | } | ||||
| return array_mergev($refs); | return array_mergev($refs); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 301 Lines • ▼ Show 20 Lines | private function fillCommitCache(array $identifiers) { | ||||
| } | } | ||||
| while (count($this->commitCache) > $max_size) { | while (count($this->commitCache) > $max_size) { | ||||
| array_shift($this->commitCache); | array_shift($this->commitCache); | ||||
| } | } | ||||
| } | } | ||||
| /** | /** | ||||
| * Sort branches so we process permanent branches first. This makes the | * Sort refs so we process permanent refs first. This makes the whole import | ||||
| * whole import process a little cheaper, since we can publish these commits | * process a little cheaper, since we can publish these commits the first | ||||
| * the first time through rather than catching them in the refs step. | * time through rather than catching them in the refs step. | ||||
| * | * | ||||
| * @task internal | * @task internal | ||||
| * | * | ||||
| * @param list<DiffusionRepositoryRef> List of refs. | * @param list<DiffusionRepositoryRef> List of refs. | ||||
| * @return list<DiffusionRepositoryRef> Sorted list of refs. | * @return list<DiffusionRepositoryRef> Sorted list of refs. | ||||
| */ | */ | ||||
| private function sortRefs(array $refs) { | private function sortRefs(array $refs) { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $publisher = $repository->newPublisher(); | $publisher = $repository->newPublisher(); | ||||
| $head_refs = array(); | $head_refs = array(); | ||||
| $tail_refs = array(); | $tail_refs = array(); | ||||
| foreach ($refs as $ref) { | foreach ($refs as $ref) { | ||||
| if ($publisher->shouldPublishRef($ref)) { | if ($publisher->isPermanentRef($ref)) { | ||||
| $head_refs[] = $ref; | $head_refs[] = $ref; | ||||
| } else { | } else { | ||||
| $tail_refs[] = $ref; | $tail_refs[] = $ref; | ||||
| } | } | ||||
| } | } | ||||
| return array_merge($head_refs, $tail_refs); | return array_merge($head_refs, $tail_refs); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 462 Lines • Show Last 20 Lines | |||||