[PATCH] purge: avoid full walks when directories aren't purged

Augie Fackler raf at durin42.com
Sat Aug 23 14:26:35 CDT 2014


On Wed, Aug 20, 2014 at 03:15:46PM -0700, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1408572445 25200
> #      Wed Aug 20 15:07:25 2014 -0700
> # Node ID 373d25ae3077814c3c05062ed11f21d5447cacd7
> # Parent  de783f2403c498ef1e20121acf178b32ec27199c
> purge: avoid full walks when directories aren't purged

Appears to have been ninja-queued as fe22d86a8992.

>
> If match.traversedir is not None, we're forced to do full walks. However when
> we aren't purging directories we don't need to set match.traversedir to
> anything.
>
> This speeds up non-full walks such as the one hgwatchman makes possible. For
> mozilla-central with hgwatchman enabled, 'hg purge --files' goes from 0.88
> seconds to 0.22.
>
> diff --git a/hgext/purge.py b/hgext/purge.py
> --- a/hgext/purge.py
> +++ b/hgext/purge.py
> @@ -95,9 +95,10 @@
>          else:
>              ui.write('%s%s' % (name, eol))
>
> -    directories = []
>      match = scmutil.match(repo[None], dirs, opts)
> -    match.explicitdir = match.traversedir = directories.append
> +    if removedirs:
> +        directories = []
> +        match.explicitdir = match.traversedir = directories.append
>      status = repo.status(match=match, ignored=opts['all'], unknown=True)
>
>      if removefiles:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list