Commits

Pierre-Yves David  committed 2a2b8c9

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.

  • Participants
  • Parent commits 789acc1
  • Branches default

Comments (0)

Files changed (1)

File hgext/evolve.py

 @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: