diff mercurial/debugcommands.py @ 33336:4672db164c98

revset: make repo.anyrevs accept customized alias override (API) Previously repo.anyrevs only expand aliases in [revsetalias] config. This patch makes it more flexible to accept a customized dict defining aliases without having to couple with ui. revsetlang.expandaliases now has the signature (tree, aliases, warn=None) which is more consistent with templater.expandaliases. revsetlang.py is now free from "ui", which seems to be a good thing.
author Jun Wu <quark@fb.com>
date Sat, 24 Jun 2017 15:29:42 -0700
parents 68f3e819d41d
children 8056481caa81
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Fri Jul 07 01:05:20 2017 -0400
+++ b/mercurial/debugcommands.py	Sat Jun 24 15:29:42 2017 -0700
@@ -1960,9 +1960,11 @@
     one. Returns 1 if the optimized result differs.
     """
     opts = pycompat.byteskwargs(opts)
+    aliases = ui.configitems('revsetalias')
     stages = [
         ('parsed', lambda tree: tree),
-        ('expanded', lambda tree: revsetlang.expandaliases(ui, tree)),
+        ('expanded', lambda tree: revsetlang.expandaliases(tree, aliases,
+                                                           ui.warn)),
         ('concatenated', revsetlang.foldconcat),
         ('analyzed', revsetlang.analyze),
         ('optimized', revsetlang.optimize),