comparison mercurial/revset.py @ 30782:db38cfc7c29d

revset: stop lowercasing the regex pattern for 'author' It was probably unintentional for regex, as the meaning of some sequences like \S and \s is actually inverted by changing the case. For backward compatibility however, the matching is forced to case insensitive.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 11 Jan 2017 22:42:10 -0500
parents b1012cb1bec3
children 931a60880df4
comparison
equal deleted inserted replaced
30781:f2c069bf78ee 30782:db38cfc7c29d
554 @predicate('author(string)', safe=True) 554 @predicate('author(string)', safe=True)
555 def author(repo, subset, x): 555 def author(repo, subset, x):
556 """Alias for ``user(string)``. 556 """Alias for ``user(string)``.
557 """ 557 """
558 # i18n: "author" is a keyword 558 # i18n: "author" is a keyword
559 n = encoding.lower(getstring(x, _("author requires a string"))) 559 n = getstring(x, _("author requires a string"))
560 kind, pattern, matcher = _substringmatcher(n) 560 kind, pattern, matcher = _substringmatcher(n, casesensitive=False)
561 return subset.filter(lambda x: matcher(encoding.lower(repo[x].user())), 561 return subset.filter(lambda x: matcher(repo[x].user()),
562 condrepr=('<user %r>', n)) 562 condrepr=('<user %r>', n))
563 563
564 @predicate('bisect(string)', safe=True) 564 @predicate('bisect(string)', safe=True)
565 def bisect(repo, subset, x): 565 def bisect(repo, subset, x):
566 """Changesets marked in the specified bisect status: 566 """Changesets marked in the specified bisect status:
2247 2247
2248 return False 2248 return False
2249 2249
2250 return subset.filter(matches, condrepr=('<subrepo %r>', pat)) 2250 return subset.filter(matches, condrepr=('<subrepo %r>', pat))
2251 2251
2252 def _substringmatcher(pattern): 2252 def _substringmatcher(pattern, casesensitive=True):
2253 kind, pattern, matcher = util.stringmatcher(pattern) 2253 kind, pattern, matcher = util.stringmatcher(pattern,
2254 casesensitive=casesensitive)
2254 if kind == 'literal': 2255 if kind == 'literal':
2255 matcher = lambda s: pattern in s 2256 if not casesensitive:
2257 pattern = encoding.lower(pattern)
2258 matcher = lambda s: pattern in encoding.lower(s)
2259 else:
2260 matcher = lambda s: pattern in s
2256 return kind, pattern, matcher 2261 return kind, pattern, matcher
2257 2262
2258 @predicate('tag([name])', safe=True) 2263 @predicate('tag([name])', safe=True)
2259 def tag(repo, subset, x): 2264 def tag(repo, subset, x):
2260 """The specified tag by name, or all tagged revisions if no name is given. 2265 """The specified tag by name, or all tagged revisions if no name is given.