mercurial/revset.py
changeset 30783 931a60880df4
parent 30782 db38cfc7c29d
child 30784 5dd67f0993ce
equal deleted inserted replaced
30782:db38cfc7c29d 30783:931a60880df4
   812                          condrepr=('<date %r>', ds))
   812                          condrepr=('<date %r>', ds))
   813 
   813 
   814 @predicate('desc(string)', safe=True)
   814 @predicate('desc(string)', safe=True)
   815 def desc(repo, subset, x):
   815 def desc(repo, subset, x):
   816     """Search commit message for string. The match is case-insensitive.
   816     """Search commit message for string. The match is case-insensitive.
       
   817 
       
   818     If `string` starts with `re:`, the remainder of the string is treated as
       
   819     a regular expression. To match a substring that actually starts with `re:`,
       
   820     use the prefix `literal:`.
   817     """
   821     """
   818     # i18n: "desc" is a keyword
   822     # i18n: "desc" is a keyword
   819     ds = encoding.lower(getstring(x, _("desc requires a string")))
   823     ds = getstring(x, _("desc requires a string"))
   820 
   824 
   821     def matches(x):
   825     kind, pattern, matcher = _substringmatcher(ds, casesensitive=False)
   822         c = repo[x]
   826 
   823         return ds in encoding.lower(c.description())
   827     return subset.filter(lambda r: matcher(repo[r].description()),
   824 
   828                          condrepr=('<desc %r>', ds))
   825     return subset.filter(matches, condrepr=('<desc %r>', ds))
       
   826 
   829 
   827 def _descendants(repo, subset, x, followfirst=False):
   830 def _descendants(repo, subset, x, followfirst=False):
   828     roots = getset(repo, fullreposet(repo), x)
   831     roots = getset(repo, fullreposet(repo), x)
   829     if not roots:
   832     if not roots:
   830         return baseset()
   833         return baseset()