Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/namespaces.py @ 23555: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 |
parents | 75f9643cab1b |
children | 7e1da5d004eb |
comparison
equal
deleted
inserted
replaced
23554:75f9643cab1b | 23555:f08f6a7d4d5f |
---|---|
1 from mercurial import util | 1 from mercurial import util |
2 | |
3 def tolist(val): | |
4 """ | |
5 a convenience method to return an empty list instead of None | |
6 """ | |
7 if val is None: | |
8 return [] | |
9 else: | |
10 return [val] | |
2 | 11 |
3 class namespaces(object): | 12 class namespaces(object): |
4 """ | 13 """ |
5 provides an interface to register a generic many-to-many mapping between | 14 provides an interface to register a generic many-to-many mapping between |
6 some (namespaced) names and nodes. The goal here is to control the | 15 some (namespaced) names and nodes. The goal here is to control the |