# HG changeset patch # User Sean Farley # Date 2014-12-14 23:04:40 # Node ID f08f6a7d4d5fba107a0540138c55d49f85d2d60f # Parent 75f9643cab1bfd3ee76844f5d1168b08763530d2 namespaces: add a function to turn single results into lists diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py --- 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