revsetlang: add a getboolean helper function
authorDenis Laxalde <denis@laxalde.org>
Sat, 15 Apr 2017 11:26:09 +0200
changeset 31997 11f501f0a213
parent 31996 e6e1884df298
child 31998 83527d9f1f13
revsetlang: add a getboolean helper function This will be used to parse followlines's "descend" argument.
mercurial/revsetlang.py
--- a/mercurial/revsetlang.py	Tue Mar 28 10:15:02 2017 +0200
+++ b/mercurial/revsetlang.py	Sat Apr 15 11:26:09 2017 +0200
@@ -199,6 +199,12 @@
     except ValueError:
         raise error.ParseError(err)
 
+def getboolean(x, err):
+    value = util.parsebool(getsymbol(x))
+    if value is not None:
+        return value
+    raise error.ParseError(err)
+
 def getlist(x):
     if not x:
         return []