##// END OF EJS Templates
revset: add regular expression support to 'desc'...
Matt Harbison -
r30783:931a6088 default
parent child Browse files
Show More
@@ -814,15 +814,18 b' def date(repo, subset, x):'
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)
@@ -912,6 +912,9 b' test ancestors'
912 5
912 5
913 $ log 'desc(B)'
913 $ log 'desc(B)'
914 5
914 5
915 $ hg log -r 'desc(r"re:S?u")' --template "{rev} {desc|firstline}\n"
916 5 5 bug
917 6 6 issue619
915 $ log 'descendants(2 or 3)'
918 $ log 'descendants(2 or 3)'
916 2
919 2
917 3
920 3
General Comments 0
You need to be logged in to leave comments. Login now