revset: avoid full repo scan in children revset

Summary:
The children revset iterated over everything in the subset, which in
many cases was the entire repo. This can take hundreds of milliseconds. Let's
use the new _makerangeset to only iterate over descendants of the parentset.

Reviewed By: quark-zju

Differential Revision: D23794344

fbshipit-source-id: 9ac9bc014d56a95b5ac65534769389167b0f4508
This commit is contained in:
Durham Goode 2020-09-20 21:42:01 -07:00 committed by Facebook GitHub Bot
parent b78115f4e8
commit 7b4bbc2f64

View File

@ -853,14 +853,16 @@ def _children(repo, subset, parentset):
def isvisible(rev):
return True
for r in subset:
if r <= minrev:
continue
p1, p2 = pr(r)
if p1 in parentset and isvisible(r):
cs.add(r)
if p2 != nullrev and p2 in parentset and isvisible(r):
cs.add(r)
if minrev is not None:
for r in _makerangeset(repo, subset, minrev, smartset.maxrev, anyorder):
if r == nullrev:
continue
p1, p2 = pr(r)
if p1 in parentset and isvisible(r):
cs.add(r)
if p2 != nullrev and p2 in parentset and isvisible(r):
cs.add(r)
return baseset(cs)