changeset 29922:ae933e3e2226

revset: remove showwarning option from expandaliases() Now all callers pass showwarning=ui.warn, so we no longer need the option to suppress warnings.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 08 Sep 2016 22:44:10 +0900
parents a82e138d5249
children 429fd2747d9a
files mercurial/commands.py mercurial/revset.py
diffstat 2 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Aug 21 12:45:43 2016 +0900
+++ b/mercurial/commands.py	Thu Sep 08 22:44:10 2016 +0900
@@ -3525,8 +3525,7 @@
     """
     stages = [
         ('parsed', lambda tree: tree),
-        ('expanded',
-         lambda tree: revset.expandaliases(ui, tree, showwarning=ui.warn)),
+        ('expanded', lambda tree: revset.expandaliases(ui, tree)),
         ('concatenated', revset.foldconcat),
         ('analyzed', revset.analyze),
         ('optimized', revset.optimize),
--- a/mercurial/revset.py	Sun Aug 21 12:45:43 2016 +0900
+++ b/mercurial/revset.py	Thu Sep 08 22:44:10 2016 +0900
@@ -2556,15 +2556,14 @@
         if tree[0] == 'func' and tree[1][0] == 'symbol':
             return tree[1][1], getlist(tree[2])
 
-def expandaliases(ui, tree, showwarning=None):
+def expandaliases(ui, tree):
     aliases = _aliasrules.buildmap(ui.configitems('revsetalias'))
     tree = _aliasrules.expand(aliases, tree)
-    if showwarning:
-        # warn about problematic (but not referred) aliases
-        for name, alias in sorted(aliases.iteritems()):
-            if alias.error and not alias.warned:
-                showwarning(_('warning: %s\n') % (alias.error))
-                alias.warned = True
+    # warn about problematic (but not referred) aliases
+    for name, alias in sorted(aliases.iteritems()):
+        if alias.error and not alias.warned:
+            ui.warn(_('warning: %s\n') % (alias.error))
+            alias.warned = True
     return tree
 
 def foldconcat(tree):
@@ -2617,7 +2616,7 @@
         tree = ('or',) + tuple(parse(s, lookup) for s in specs)
 
     if ui:
-        tree = expandaliases(ui, tree, showwarning=ui.warn)
+        tree = expandaliases(ui, tree)
     tree = foldconcat(tree)
     tree = analyze(tree)
     tree = optimize(tree)