Mercurial > hg
changeset 24448:55c449345b10
match: add isexact() method to hide internals
Comparing a function reference seems bad.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 29 Oct 2014 08:43:39 -0700 |
parents | d44d53bc9a1e |
children | bab983bb6fd1 |
files | mercurial/dirstate.py mercurial/manifest.py mercurial/match.py |
diffstat | 3 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Wed Nov 19 15:56:58 2014 -0800 +++ b/mercurial/dirstate.py Wed Oct 29 08:43:39 2014 -0700 @@ -611,7 +611,7 @@ dirsnotfound = [] notfoundadd = dirsnotfound.append - if match.matchfn != match.exact and self._checkcase: + if not match.isexact() and self._checkcase: normalize = self._normalize else: normalize = None @@ -711,7 +711,7 @@ join = self._join exact = skipstep3 = False - if matchfn == match.exact: # match.exact + if match.isexact(): # match.exact exact = True dirignore = util.always # skip step 2 elif match.files() and not match.anypats(): # match.match, no patterns @@ -912,7 +912,7 @@ if match.always(): return dmap.keys() files = match.files() - if match.matchfn == match.exact: + if match.isexact(): # fast path -- filter the other way around, since typically files is # much smaller than dmap return [f for f in files if f in dmap]
--- a/mercurial/manifest.py Wed Nov 19 15:56:58 2014 -0800 +++ b/mercurial/manifest.py Wed Oct 29 08:43:39 2014 -0700 @@ -164,7 +164,7 @@ return self.copy() files = match.files() - if (len(files) < 100 and (match.matchfn == match.exact or + if (len(files) < 100 and (match.isexact() or (not match.anypats() and util.all(fn in self for fn in files)))): return self.intersectfiles(files) @@ -519,7 +519,7 @@ return self.copy() files = match.files() - if (match.matchfn == match.exact or + if (match.isexact() or (not match.anypats() and util.all(fn in self for fn in files))): return self.intersectfiles(files)
--- a/mercurial/match.py Wed Nov 19 15:56:58 2014 -0800 +++ b/mercurial/match.py Wed Oct 29 08:43:39 2014 -0700 @@ -171,6 +171,9 @@ - optimization might be possible and necessary.''' return self._always + def isexact(self): + return self.matchfn == self.exact + def exact(root, cwd, files): return match(root, cwd, files, exact=True)