mercurial/parser.py
changeset 28893 ee11167fe1da
parent 28892 0c135f37c6f8
child 28895 4bf9ed7a260e
--- a/mercurial/parser.py	Mon Feb 29 18:33:30 2016 +0900
+++ b/mercurial/parser.py	Mon Feb 29 19:24:15 2016 +0900
@@ -462,3 +462,13 @@
         if err:
             err = efmt % {'section': cls._section, 'name': name, 'error': err}
         return alias(name, tree, args, err, repl)
+
+    @classmethod
+    def buildmap(cls, items):
+        """Parse a list of alias (name, replacement) pairs into a dict of
+        alias objects"""
+        aliases = {}
+        for decl, defn in items:
+            a = cls.build(decl, defn)
+            aliases[a.name] = a
+        return aliases