setdiscovery: use a revset instead of dagutil.descendantset()
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 17 Aug 2018 17:13:26 +0000
changeset 39166 484c9fe570a7
parent 39165 860e83cd97de
child 39167 136ed75bbe12
setdiscovery: use a revset instead of dagutil.descendantset() This is the only use of descendantset() in the repo. Strictly speaking, the revset behaves slightly differently than dagutil. The reason is that dagutil is using revlog.index for DAG traversal and this data structure isn't aware of visibility / filtering. So it can operate on revisions it shouldn't operate on. But our test coverage of this code is pretty comprehensive and this change causes no tests to fail. So I think we are good. Also, the revset parser failed to parse `%ld:: - %ld::`, hence the use of descendants(). I'm not sure if that is a feature or a bug. Differential Revision: https://phab.mercurial-scm.org/D4314
mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py	Thu Aug 16 20:23:10 2018 +0000
+++ b/mercurial/setdiscovery.py	Fri Aug 17 17:13:26 2018 +0000
@@ -215,7 +215,12 @@
 
         if sample:
             missinginsample = [n for i, n in enumerate(sample) if not yesno[i]]
-            missing.update(dag.descendantset(missinginsample, missing))
+
+            if missing:
+                missing.update(local.revs('descendants(%ld) - descendants(%ld)',
+                                          missinginsample, missing))
+            else:
+                missing.update(local.revs('descendants(%ld)', missinginsample))
 
             undecided.difference_update(missing)