Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14376995
D8781.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8781.diff
View Options
diff --git a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
--- a/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
@@ -102,6 +102,8 @@
'Discovering commits in repository %s.',
$repository->getCallsign()));
+ $this->fillCommitCache(array_values($branches));
+
$refs = array();
foreach ($branches as $name => $commit) {
$this->log(pht('Examining branch "%s", at "%s".', $name, $commit));
@@ -354,6 +356,8 @@
->setRepository($repository)
->execute();
+ $this->fillCommitCache(mpull($branches, 'getCommitIdentifier'));
+
$refs = array();
foreach ($branches as $branch) {
// NOTE: Mercurial branches may have multiple heads, so the names may
@@ -473,24 +477,30 @@
return false;
}
- $commit = id(new PhabricatorRepositoryCommit())->loadOneWhere(
- 'repositoryID = %d AND commitIdentifier = %s',
+ $this->fillCommitCache(array($identifier));
+
+ return isset($this->commitCache[$identifier]);
+ }
+
+ private function fillCommitCache(array $identifiers) {
+ if (!$identifiers) {
+ return;
+ }
+
+ $commits = id(new PhabricatorRepositoryCommit())->loadAllWhere(
+ 'repositoryID = %d AND commitIdentifier IN (%Ls)',
$this->getRepository()->getID(),
- $identifier);
+ $identifiers);
- if (!$commit) {
- return false;
+ foreach ($commits as $commit) {
+ $this->commitCache[$commit->getCommitIdentifier()] = true;
}
- $this->commitCache[$identifier] = true;
while (count($this->commitCache) > self::MAX_COMMIT_CACHE_SIZE) {
array_shift($this->commitCache);
}
-
- return true;
}
-
/**
* Sort branches so we process closeable branches first. This makes the
* whole import process a little cheaper, since we can close these commits
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 12:36 AM (21 h, 34 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6916748
Default Alt Text
D8781.diff (1 KB)
Attached To
Mode
D8781: Make discovery slightly cheaper in the common case
Attached
Detach File
Event Timeline
Log In to Comment