Mercurial > hg
changeset 33378:adf95bfb423a
match: make nevermatcher an exact matcher and a prefix matcher
The m.isexact() and m.prefix() methods are used by callers to
determine whether m.files() can be used for fast paths. It seems safe
to let callers to any fast paths it can that rely on the empty
m.files().
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 09 Jul 2017 15:19:27 -0700 |
parents | 5d63e5f40bea |
children | 7ddb2aa2b7af |
files | mercurial/match.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/match.py Mon Jul 10 10:56:40 2017 -0700 +++ b/mercurial/match.py Sun Jul 09 15:19:27 2017 -0700 @@ -347,6 +347,17 @@ def __init__(self, root, cwd, badfn=None): super(nevermatcher, self).__init__(root, cwd, badfn) + # It's a little weird to say that the nevermatcher is an exact matcher + # or a prefix matcher, but it seems to make sense to let callers take + # fast paths based on either. There will be no exact matches, nor any + # prefixes (files() returns []), so fast paths iterating over them should + # be efficient (and correct). + def isexact(self): + return True + + def prefix(self): + return True + def __repr__(self): return '<nevermatcher>'