# HG changeset patch # User Denis Laxalde # Date 1554632483 -7200 # Node ID f3db5c805a67b50bafe2720cae1630dd7d23588d # Parent fcd7a91dec23a09e9e23a2bbae47c5de2a6a4295 match: add doctest examples for exactmatcher Make the docstring raw, since it now includes escape characters. diff -r fcd7a91dec23 -r f3db5c805a67 mercurial/match.py --- a/mercurial/match.py Fri Apr 05 11:24:00 2019 -0700 +++ b/mercurial/match.py Sun Apr 07 12:21:23 2019 +0200 @@ -568,8 +568,24 @@ return ('' % pycompat.bytestr(self._pats)) class exactmatcher(basematcher): - '''Matches the input files exactly. They are interpreted as paths, not + r'''Matches the input files exactly. They are interpreted as paths, not patterns (so no kind-prefixes). + + >>> m = exactmatcher(['a.txt', 're:.*\.c$']) + >>> m('a.txt') + True + >>> m('b.txt') + False + + Input files that would be matched are exactly those returned by .files() + >>> m.files() + ['a.txt', 're:.*\\.c$'] + + So pattern 're:.*\.c$' is not considered as a regex, but as a file name + >>> m('main.c') + False + >>> m('re:.*\.c$') + True ''' def __init__(self, files, badfn=None):