[PATCH] dirstate: batch calls to statfiles (issue4878)

Augie Fackler raf at durin42.com
Mon Oct 12 09:11:08 CDT 2015


On Sun, Oct 11, 2015 at 04:29:10PM -0500, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1444166780 18000
> #      Tue Oct 06 16:26:20 2015 -0500
> # Node ID 109083f503a8c778e3f8fd3a1aeb9eeacd4ebc47
> # Parent  3f234db6fe8d7cc3d39083f7e7523444bc21e5a2
> dirstate: batch calls to statfiles (issue4878)
>

queued, thanks

>
> This makes it more interruptible.
>
> diff -r 3f234db6fe8d -r 109083f503a8 mercurial/dirstate.py
> --- a/mercurial/dirstate.py	Thu Sep 24 13:58:18 2015 -0400
> +++ b/mercurial/dirstate.py	Tue Oct 06 16:26:20 2015 -0500
> @@ -928,8 +928,14 @@
>                  # We may not have walked the full directory tree above,
>                  # so stat and check everything we missed.
>                  nf = iter(visit).next
> -                for st in util.statfiles([join(i) for i in visit]):
> -                    results[nf()] = st
> +                pos = 0
> +                while pos < len(visit):
> +                    # visit in mid-sized batches so that we don't
> +                    # block signals indefinitely
> +                    xr = xrange(pos, min(len(visit), pos + 1000))
> +                    for st in util.statfiles([join(visit[n]) for n in xr]):
> +                        results[nf()] = st
> +                    pos += 1000
>          return results
>
>      def status(self, match, subrepos, ignored, clean, unknown):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list