Show More
@@ -41,7 +41,8 b' class namespaces(object):' | |||||
41 | # i18n: column positioning for "hg log" |
|
41 | # i18n: column positioning for "hg log" | |
42 | logfmt=_("tag: %s\n"), |
|
42 | logfmt=_("tag: %s\n"), | |
43 | listnames=tagnames, |
|
43 | listnames=tagnames, | |
44 |
namemap=tagnamemap, nodemap=tagnodemap |
|
44 | namemap=tagnamemap, nodemap=tagnodemap, | |
|
45 | deprecated=set(['tip'])) | |||
45 | self.addnamespace(n) |
|
46 | self.addnamespace(n) | |
46 |
|
47 | |||
47 | bnames = lambda repo: repo.branchmap().keys() |
|
48 | bnames = lambda repo: repo.branchmap().keys() | |
@@ -126,11 +127,13 b' class namespace(object):' | |||||
126 | dictionary) |
|
127 | dictionary) | |
127 | 'namemap': function that takes a name and returns a list of nodes |
|
128 | 'namemap': function that takes a name and returns a list of nodes | |
128 | 'nodemap': function that takes a node and returns a list of names |
|
129 | 'nodemap': function that takes a node and returns a list of names | |
|
130 | 'deprecated': set of names to be masked for ordinary use | |||
129 |
|
131 | |||
130 | """ |
|
132 | """ | |
131 |
|
133 | |||
132 | def __init__(self, name, templatename=None, logname=None, colorname=None, |
|
134 | def __init__(self, name, templatename=None, logname=None, colorname=None, | |
133 |
logfmt=None, listnames=None, namemap=None, nodemap=None |
|
135 | logfmt=None, listnames=None, namemap=None, nodemap=None, | |
|
136 | deprecated=None): | |||
134 | """create a namespace |
|
137 | """create a namespace | |
135 |
|
138 | |||
136 | name: the namespace to be registered (in plural form) |
|
139 | name: the namespace to be registered (in plural form) | |
@@ -144,6 +147,7 b' class namespace(object):' | |||||
144 | listnames: function to list all names |
|
147 | listnames: function to list all names | |
145 | namemap: function that inputs a node, output name(s) |
|
148 | namemap: function that inputs a node, output name(s) | |
146 | nodemap: function that inputs a name, output node(s) |
|
149 | nodemap: function that inputs a name, output node(s) | |
|
150 | deprecated: set of names to be masked for ordinary use | |||
147 |
|
151 | |||
148 | """ |
|
152 | """ | |
149 | self.name = name |
|
153 | self.name = name | |
@@ -168,6 +172,11 b' class namespace(object):' | |||||
168 | # i18n: column positioning for "hg log" |
|
172 | # i18n: column positioning for "hg log" | |
169 | self.logfmt = ("%s:" % self.logname).ljust(13) + "%s\n" |
|
173 | self.logfmt = ("%s:" % self.logname).ljust(13) + "%s\n" | |
170 |
|
174 | |||
|
175 | if deprecated is None: | |||
|
176 | self.deprecated = set() | |||
|
177 | else: | |||
|
178 | self.deprecated = deprecated | |||
|
179 | ||||
171 | def names(self, repo, node): |
|
180 | def names(self, repo, node): | |
172 | """method that returns a (sorted) list of names in a namespace that |
|
181 | """method that returns a (sorted) list of names in a namespace that | |
173 | match a given node""" |
|
182 | match a given node""" |
@@ -1277,6 +1277,7 b' def named(repo, subset, x):' | |||||
1277 | names = set() |
|
1277 | names = set() | |
1278 | for ns in namespaces: |
|
1278 | for ns in namespaces: | |
1279 | for name in ns.listnames(repo): |
|
1279 | for name in ns.listnames(repo): | |
|
1280 | if name not in ns.deprecated: | |||
1280 | names.update(repo[n].rev() for n in ns.nodes(repo, name)) |
|
1281 | names.update(repo[n].rev() for n in ns.nodes(repo, name)) | |
1281 |
|
1282 | |||
1282 | names -= set([node.nullrev]) |
|
1283 | names -= set([node.nullrev]) |
General Comments 0
You need to be logged in to leave comments.
Login now