namespaces: add a function to turn single results into lists
authorSean Farley <sean.michael.farley@gmail.com>
Sun, 14 Dec 2014 15:04:40 -0800
changeset 23555 f08f6a7d4d5f
parent 23554 75f9643cab1b
child 23556 7e1da5d004eb
namespaces: add a function to turn single results into lists
mercurial/namespaces.py
--- a/mercurial/namespaces.py	Fri Oct 17 11:25:51 2014 -0700
+++ b/mercurial/namespaces.py	Sun Dec 14 15:04:40 2014 -0800
@@ -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