[PATCH 3 of 4] dirstate: skip step 3 in walk if nothing new will match

Matt Mackall mpm at selenic.com
Tue May 19 11:03:57 CDT 2009


On Tue, May 19, 2009 at 07:27:41AM +0000, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe at besonet.ch>
> # Date 1242323666 -7200
> # Node ID 19a134f738f5ac0720bc08fbe6507f4eb4769fd9
> # Parent  4095d02302b74f9ce2c90fe283d84ad31ce2da83
> dirstate: skip step 3 in walk if nothing new will match
> 
> nothing will ever match on match.never
> nothing new will match on match.exact (all found in step 1)
> nothing new will match on match.match when
>   there is no pattern and
>   there is no direcory in pats
> 
> diff -r 4095d02302b7 -r 19a134f738f5 mercurial/dirstate.py
> --- a/mercurial/dirstate.py	Don Mai 14 10:50:45 2009 +0200
> +++ b/mercurial/dirstate.py	Don Mai 14 19:54:26 2009 +0200
> @@ -460,6 +460,11 @@
>          join = self._join
>          work = []
>          wadd = work.append
> +        dostep3 = match.anypats() or match.__class__.__name__ == 'always'
> +        nomatches = not dostep3 and match.__class__.__name__ in 'never exact'.split()

Yuck!

Perhaps we can do a test like:

if not match.anypats() and not match.files():
   # it's not a general or exact match, it must be always/never
   always = match(None)
   never = not always

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list