##// END OF EJS Templates
revset: add pattern matching to the 'user' revset expression
Simon King -
r16823:b23bacb2 default
parent child Browse files
Show More
@@ -279,7 +279,8 b' def author(repo, subset, x):'
279 279 """
280 280 # i18n: "author" is a keyword
281 281 n = encoding.lower(getstring(x, _("author requires a string")))
282 return [r for r in subset if n in encoding.lower(repo[r].user())]
282 kind, pattern, matcher = _substringmatcher(n)
283 return [r for r in subset if matcher(encoding.lower(repo[r].user()))]
283 284
284 285 def bisect(repo, subset, x):
285 286 """``bisect(string)``
@@ -1188,6 +1189,11 b' def _stringmatcher(pattern):'
1188 1189 pattern = pattern[8:]
1189 1190 return 'literal', pattern, pattern.__eq__
1190 1191
1192 def _substringmatcher(pattern):
1193 kind, pattern, matcher = _stringmatcher(pattern)
1194 if kind == 'literal':
1195 matcher = lambda s: pattern in s
1196 return kind, pattern, matcher
1191 1197
1192 1198 def tag(repo, subset, x):
1193 1199 """``tag([name])``
@@ -1219,6 +1225,10 b' def tagged(repo, subset, x):'
1219 1225 def user(repo, subset, x):
1220 1226 """``user(string)``
1221 1227 User name contains string. The match is case-insensitive.
1228
1229 If `string` starts with `re:`, the remainder of the string is treated as
1230 a regular expression. To match a user that actually contains `re:`, use
1231 the prefix `literal:`.
1222 1232 """
1223 1233 return author(repo, subset, x)
1224 1234
@@ -230,6 +230,17 b' quoting needed'
230 230 5
231 231 $ log 'author(bob)'
232 232 2
233 $ log 'author("re:bob|test")'
234 0
235 1
236 2
237 3
238 4
239 5
240 6
241 7
242 8
243 9
233 244 $ log 'branch(é)'
234 245 8
235 246 9
General Comments 0
You need to be logged in to leave comments. Login now