Mercurial > public > mercurial-scm > hg
comparison mercurial/namespaces.py @ 23872:9f48242929a9
namespaces: make the constructor into named args
None of the arguments are truly optional but this makes adding future arguments
more robust and perhaps optional.
author | Sean Farley <sean.michael.farley@gmail.com> |
---|---|
date | Wed, 14 Jan 2015 19:39:13 -0800 |
parents | 885c0290f7d5 |
children | 9ef234021667 |
comparison
equal
deleted
inserted
replaced
23871:b2d8f3685b06 | 23872:9f48242929a9 |
---|---|
118 'namemap': function that takes a name and returns a list of nodes | 118 'namemap': function that takes a name and returns a list of nodes |
119 'nodemap': function that takes a node and returns a list of names | 119 'nodemap': function that takes a node and returns a list of names |
120 | 120 |
121 """ | 121 """ |
122 | 122 |
123 def __init__(self, name, templatename, listnames, namemap, nodemap): | 123 def __init__(self, name, templatename=None, listnames=None, namemap=None, |
124 nodemap=None): | |
124 """create a namespace | 125 """create a namespace |
125 | 126 |
126 name: the namespace to be registered (in plural form) | 127 name: the namespace to be registered (in plural form) |
128 templatename: the name to use for templating | |
127 listnames: function to list all names | 129 listnames: function to list all names |
128 templatename: the name to use for templating | |
129 namemap: function that inputs a node, output name(s) | 130 namemap: function that inputs a node, output name(s) |
130 nodemap: function that inputs a name, output node(s) | 131 nodemap: function that inputs a name, output node(s) |
131 | 132 |
132 """ | 133 """ |
133 self.name = name | 134 self.name = name |