evolve: remove revset calls in warnobserror
revset have serious performance impact in several case.
The resulting code is a bit too complicated to my taste. I hope for much simpler
implementation in core anyway.
--- a/hgext/evolve.py Sat Jan 05 18:10:07 2013 +0100
+++ b/hgext/evolve.py Fri Jan 25 16:42:49 2013 +0100
@@ -596,15 +596,19 @@
@eh.wrapcommand("unbundle")
def warnobserrors(orig, ui, repo, *args, **kwargs):
"""display warning is the command resulted in more instable changeset"""
- priorunstables = len(repo.revs('unstable()'))
- priorbumpeds = len(repo.revs('bumped()'))
- priordivergents = len(repo.revs('divergent()'))
+ # part of the troubled stuff may be filtered (stash ?)
+ # This needs a better implementation but will probably wait for core.
+ filtered = repo.changelog.filteredrevs
+ priorunstables = len(set(getrevs(repo, 'unstable')) - filtered)
+ priorbumpeds = len(set(getrevs(repo, 'bumped')) - filtered)
+ priordivergents = len(set(getrevs(repo, 'divergent')) - filtered)
ret = orig(ui, repo, *args, **kwargs)
# workaround phase stupidity
#phases._filterunknown(ui, repo.changelog, repo._phasecache.phaseroots)
- newunstables = len(repo.revs('unstable()')) - priorunstables
- newbumpeds = len(repo.revs('bumped()')) - priorbumpeds
- newdivergents = len(repo.revs('divergent()')) - priordivergents
+ filtered = repo.changelog.filteredrevs
+ newunstables = len(set(getrevs(repo, 'unstable')) - filtered) - priorunstables
+ newbumpeds = len(set(getrevs(repo, 'bumped')) - filtered) - priorbumpeds
+ newdivergents = len(set(getrevs(repo, 'divergent')) - filtered) - priordivergents
if newunstables > 0:
ui.warn(_('%i new unstable changesets\n') % newunstables)
if newbumpeds > 0: