inhibit: use dirty revset trick to speedup the inhibit search space.
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 17 Nov 2015 20:25:15 -0800
changeset 1535 f6d10432499d
parent 1534 9a78ed4b9765
child 1536 9afe9e0191a1
inhibit: use dirty revset trick to speedup the inhibit search space. See documentation for details. I'm a bit sad about this changesets.
hgext/inhibit.py
--- a/hgext/inhibit.py	Tue Nov 17 20:19:32 2015 -0800
+++ b/hgext/inhibit.py	Tue Nov 17 20:25:15 2015 -0800
@@ -129,7 +129,15 @@
     if not _inhibitenabled(repo):
         return
 
-    newinhibit = repo.revs('::%ln and obsolete()', nodes)
+    # we add (non public()) as a lower boundary to
+    # - use the C code in 3.6 (no ancestors in C as this is written)
+    # - restrict the search space. Otherwise, the ancestors can spend a lot of
+    #   time iterating if you have a check very low in the repo. We do not need
+    #   to iterate over tens of thousand of public revisions with higher
+    #   revision number
+    #
+    # In addition, the revset logic could be made significantly smarter here.
+    newinhibit = repo.revs('(not public())::%ln and obsolete()', nodes)
     if newinhibit:
         node = repo.changelog.node
         lock = tr = None