Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14040537
D8374.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8374.diff
View Options
Index: src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
===================================================================
--- src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
+++ src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php
@@ -12,6 +12,8 @@
private $repairMode;
private $commitCache = array();
+ private $workingSet = array();
+
const MAX_COMMIT_CACHE_SIZE = 2048;
@@ -50,6 +52,9 @@
throw new Exception("Unknown VCS '{$vcs}'!");
}
+ // Clear the working set cache.
+ $this->workingSet = array();
+
// Record discovered commits and mark them in the cache.
foreach ($refs as $ref) {
$this->recordCommit(
@@ -113,10 +118,14 @@
$this->log(pht("Looking for new commits."));
- $refs[] = $this->discoverStreamAncestry(
+ $branch_refs = $this->discoverStreamAncestry(
new PhabricatorGitGraphStream($repository, $commit),
$commit,
$repository->shouldAutocloseBranch($name));
+
+ $this->didDiscoverRefs($branch_refs);
+
+ $refs[] = $branch_refs;
}
return array_mergev($refs);
@@ -289,6 +298,8 @@
}
$refs = array_reverse($refs);
+ $this->didDiscoverRefs($refs);
+
return $refs;
}
@@ -363,10 +374,14 @@
$this->log(pht("Looking for new commits."));
- $refs[] = $this->discoverStreamAncestry(
+ $branch_refs = $this->discoverStreamAncestry(
new PhabricatorMercurialGraphStream($repository, $commit),
$commit,
$close_immediately = true);
+
+ $this->didDiscoverRefs($branch_refs);
+
+ $refs[] = $branch_refs;
}
return array_mergev($refs);
@@ -447,6 +462,10 @@
return true;
}
+ if (isset($this->workingSet[$identifier])) {
+ return true;
+ }
+
if ($this->repairMode) {
// In repair mode, rediscover the entire repository, ignoring the
// database state. We can hit the local cache above, but if we miss it
@@ -563,6 +582,12 @@
}
}
+ private function didDiscoverRefs(array $refs) {
+ foreach ($refs as $ref) {
+ $this->workingSet[$ref->getIdentifier()] = true;
+ }
+ }
+
private function insertTask(
PhabricatorRepository $repository,
PhabricatorRepositoryCommit $commit,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 12, 10:59 AM (1 w, 6 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728070
Default Alt Text
D8374.diff (2 KB)
Attached To
Mode
D8374: Reduce initial discovery from O(branches * commits) to O(commits)
Attached
Detach File
Event Timeline
Log In to Comment