Mercurial > hg > mercurial-source
changeset 23563:f08f6a7d4d5f
namespaces: add a function to turn single results into lists
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Sun, 14 Dec 2014 15:04:40 -0800 (2014-12-14) |
parents | 75f9643cab1b |
children | 7e1da5d004eb |
files | mercurial/namespaces.py |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -1,5 +1,14 @@ from mercurial import util +def tolist(val): + """ + a convenience method to return an empty list instead of None + """ + if val is None: + return [] + else: + return [val] + class namespaces(object): """ provides an interface to register a generic many-to-many mapping between