From patchwork Sat Apr 15 09:41:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,2,V2] revsetlang: add a getboolean helper function From: Denis Laxalde X-Patchwork-Id: 20210 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sat, 15 Apr 2017 11:41:51 +0200 # HG changeset patch # User Denis Laxalde # Date 1492248369 -7200 # Sat Apr 15 11:26:09 2017 +0200 # Node ID b7086dbbff268161576bd62a374eec531bdabd7d # Parent 4c2c30bc38b4f84ce8f215146bbf158e299065b3 revsetlang: add a getboolean helper function This will be used to parse followlines's "descend" argument. diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -199,6 +199,12 @@ def getinteger(x, err, default=_notset): 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 []