Submitter | Martin von Zweigbergk |
---|---|
Date | March 25, 2015, 6:23 p.m. |
Message ID | <4f9bf395f7ab9c15dc52.1427307839@martinvonz.mtv.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/8265/ |
State | Superseded |
Delegated to: | Pierre-Yves David |
Headers | show |
Comments
On Wed, Mar 25, 2015 at 11:23:59AM -0700, Martin von Zweigbergk wrote: > # HG changeset patch > # User Martin von Zweigbergk <martinvonz@google.com> > # Date 1414597419 25200 > # Wed Oct 29 08:43:39 2014 -0700 > # Node ID 4f9bf395f7ab9c15dc5265fe299750f8f614cbe5 > # Parent 5b85a5bc5bbb9d8365953609d98e4dce7110e9b0 > match: add matchesexact() method to hide internals > > Comparing a function reference seems bad. Do you still want this? It looks good to me, I'm happy to take it or you can push it... > > diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/dirstate.py > --- a/mercurial/dirstate.py Mon Mar 23 23:04:51 2015 -0700 > +++ 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.matchesexact() 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.matchesexact(): # 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.matchesexact(): > # 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] > diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/manifest.py > --- a/mercurial/manifest.py Mon Mar 23 23:04:51 2015 -0700 > +++ 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.matchesexact() or > (not match.anypats() and util.all(fn in self for fn in files)))): > return self.intersectfiles(files) > > diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/match.py > --- a/mercurial/match.py Mon Mar 23 23:04:51 2015 -0700 > +++ b/mercurial/match.py Wed Oct 29 08:43:39 2014 -0700 > @@ -161,6 +161,9 @@ > - optimization might be possible and necessary.''' > return self._always > > + def matchesexact(self): > + return self.matchfn == self.exact > + > def exact(root, cwd, files): > return match(root, cwd, files, exact=True) > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Nope, please drop it. Several people misinterpretation the name, so I sent a V2 that got accepted. Thanks. On Apr 3, 2015 7:54 AM, "Augie Fackler" <raf@durin42.com> wrote: > On Wed, Mar 25, 2015 at 11:23:59AM -0700, Martin von Zweigbergk wrote: > > # HG changeset patch > > # User Martin von Zweigbergk <martinvonz@google.com> > > # Date 1414597419 25200 > > # Wed Oct 29 08:43:39 2014 -0700 > > # Node ID 4f9bf395f7ab9c15dc5265fe299750f8f614cbe5 > > # Parent 5b85a5bc5bbb9d8365953609d98e4dce7110e9b0 > > match: add matchesexact() method to hide internals > > > > Comparing a function reference seems bad. > > Do you still want this? It looks good to me, I'm happy to take it or > you can push it... > > > > > diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/dirstate.py > > --- a/mercurial/dirstate.py Mon Mar 23 23:04:51 2015 -0700 > > +++ 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.matchesexact() 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.matchesexact(): # 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.matchesexact(): > > # 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] > > diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/manifest.py > > --- a/mercurial/manifest.py Mon Mar 23 23:04:51 2015 -0700 > > +++ 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.matchesexact() or > > (not match.anypats() and util.all(fn in self for fn in > files)))): > > return self.intersectfiles(files) > > > > diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/match.py > > --- a/mercurial/match.py Mon Mar 23 23:04:51 2015 -0700 > > +++ b/mercurial/match.py Wed Oct 29 08:43:39 2014 -0700 > > @@ -161,6 +161,9 @@ > > - optimization might be possible and necessary.''' > > return self._always > > > > + def matchesexact(self): > > + return self.matchfn == self.exact > > + > > def exact(root, cwd, files): > > return match(root, cwd, files, exact=True) > > > > _______________________________________________ > > Mercurial-devel mailing list > > Mercurial-devel@selenic.com > > http://selenic.com/mailman/listinfo/mercurial-devel >
On Fri, Apr 3, 2015 at 11:04 AM, Martin von Zweigbergk <martinvonz@google.com> wrote: > Nope, please drop it. Several people misinterpretation the name, so I sent a > V2 that got accepted. Thanks. Okay, thanks.
Patch
diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/dirstate.py --- a/mercurial/dirstate.py Mon Mar 23 23:04:51 2015 -0700 +++ 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.matchesexact() 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.matchesexact(): # 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.matchesexact(): # 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] diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/manifest.py --- a/mercurial/manifest.py Mon Mar 23 23:04:51 2015 -0700 +++ 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.matchesexact() or (not match.anypats() and util.all(fn in self for fn in files)))): return self.intersectfiles(files) diff -r 5b85a5bc5bbb -r 4f9bf395f7ab mercurial/match.py --- a/mercurial/match.py Mon Mar 23 23:04:51 2015 -0700 +++ b/mercurial/match.py Wed Oct 29 08:43:39 2014 -0700 @@ -161,6 +161,9 @@ - optimization might be possible and necessary.''' return self._always + def matchesexact(self): + return self.matchfn == self.exact + def exact(root, cwd, files): return match(root, cwd, files, exact=True)