[PATCH 2 of 5 evolve-ext-V2] evolve: optimize the computation of the troubled() revset

Laurent Charignon lcharignon at fb.com
Tue May 5 19:42:33 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1430871306 25200
#      Tue May 05 17:15:06 2015 -0700
# Node ID ced767d4eeff2d68680cdd60ed36139f3087eaf2
# Parent  1dd10a7e485b881c472ead204407e85e9b64fa54
evolve: optimize the computation of the troubled() revset

We take the implementation from _counttroubles() and rely on the more
efficient & operation for revset instead of laying down the entire set with %ld.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -439,9 +439,11 @@
     Changesets with troubles.
     """
     revset.getargs(x, 0, 0, 'troubled takes no arguments')
-    return repo.revs('%ld and (unstable() + bumped() + divergent())',
-                     subset)
-
+    troubled = set()
+    troubled.update(getrevs(repo, 'unstable'))
+    troubled.update(getrevs(repo, 'bumped'))
+    troubled.update(getrevs(repo, 'divergent'))
+    return subset & revset.baseset(troubled)
 
 ### Obsolescence graph
 


More information about the Mercurial-devel mailing list