Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13965867
D12549.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
D12549.diff
View Options
diff --git a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
--- a/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
+++ b/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php
@@ -262,15 +262,36 @@
switch ($vcs) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
if ($all_closing_heads) {
- $escheads = array();
+ $parts = array();
foreach ($all_closing_heads as $head) {
- $escheads[] = hgsprintf('%s', $head);
+ $parts[] = hgsprintf('%s', $head);
}
- $escheads = implode(' or ', $escheads);
+
+ // See T5896. Mercurial can not parse an "X or Y or ..." rev list
+ // with more than about 300 items, because it exceeds the maximum
+ // allowed recursion depth. Split all the heads into chunks of
+ // 256, and build a query like this:
+ //
+ // ((1 or 2 or ... or 255) or (256 or 257 or ... 511))
+ //
+ // If we have more than 65535 heads, we'll do that again:
+ //
+ // (((1 or ...) or ...) or ((65536 or ...) or ...))
+
+ $chunk_size = 256;
+ while (count($parts) > $chunk_size) {
+ $chunks = array_chunk($parts, $chunk_size);
+ foreach ($chunks as $key => $chunk) {
+ $chunks[$key] = '('.implode(' or ', $chunk).')';
+ }
+ $parts = array_values($chunks);
+ }
+ $parts = '('.implode(' or ', $parts).')';
+
list($stdout) = $this->getRepository()->execxLocalCommand(
'log --template %s --rev %s',
'{node}\n',
- hgsprintf('%s', $new_head).' - ('.$escheads.')');
+ hgsprintf('%s', $new_head).' - '.$parts);
} else {
list($stdout) = $this->getRepository()->execxLocalCommand(
'log --template %s --rev %s',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 17 2024, 4:45 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6711602
Default Alt Text
D12549.diff (1 KB)
Attached To
Mode
D12549: Help Mercurial build a parse trees with a few hundred items
Attached
Detach File
Event Timeline
Log In to Comment