##// END OF EJS Templates
namespaces: add revset for 'named(namespace)'...
Sean Farley -
r23836:3fb61fcb default
parent child Browse files
Show More
@@ -1177,6 +1177,42 b' def modifies(repo, subset, x):'
1177 1177 pat = getstring(x, _("modifies requires a pattern"))
1178 1178 return checkstatus(repo, subset, pat, 0)
1179 1179
1180 def named(repo, subset, x):
1181 """``named(namespace)``
1182 The changesets in a given namespace.
1183
1184 If `namespace` starts with `re:`, the remainder of the string is treated as
1185 a regular expression. To match a namespace that actually starts with `re:`,
1186 use the prefix `literal:`.
1187 """
1188 # i18n: "named" is a keyword
1189 args = getargs(x, 1, 1, _('named requires a namespace argument'))
1190
1191 ns = getstring(args[0],
1192 # i18n: "named" is a keyword
1193 _('the argument to named must be a string'))
1194 kind, pattern, matcher = _stringmatcher(ns)
1195 namespaces = set()
1196 if kind == 'literal':
1197 if pattern not in repo.names:
1198 raise util.Abort(_("namespace '%s' does not exist") % ns)
1199 namespaces.add(repo.names[pattern])
1200 else:
1201 for name, ns in repo.names.iteritems():
1202 if matcher(name):
1203 namespaces.add(ns)
1204 if not namespaces:
1205 raise util.Abort(_("no namespace exists that match '%s'")
1206 % pattern)
1207
1208 names = set()
1209 for ns in namespaces:
1210 for name in ns.listnames(repo):
1211 names.update(ns.nodes(repo, name))
1212
1213 names -= set([node.nullrev])
1214 return subset & names
1215
1180 1216 def node_(repo, subset, x):
1181 1217 """``id(string)``
1182 1218 Revision non-ambiguously specified by the given hex string prefix.
@@ -1817,6 +1853,7 b' symbols = {'
1817 1853 "merge": merge,
1818 1854 "min": minrev,
1819 1855 "modifies": modifies,
1856 "named": named,
1820 1857 "obsolete": obsolete,
1821 1858 "only": only,
1822 1859 "origin": origin,
General Comments 0
You need to be logged in to leave comments. Login now