[PATCH 11 of 19 STABLE] largefiles: examine whether specified pattern is a directory in the context

Greg Ward greg at gerg.ca
Mon Feb 27 19:58:02 CST 2012


On 27 February 2012, FUJIWARA Katsunori said:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1330335216 -32400
> # Branch stable
> # Node ID 5c5ac9b4a72636ac865f68227d291a48d3c84206
> # Parent  0317d98735a65b478976579bd10e75315ead234d
> largefiles: examine whether specified pattern is a directory in the context
> 
> this patch adds 'inctxdirs()' which uses 'changectx.dirs()' to
> examine 'directory pattern' correctly.
> 
> in fact, original implementation can show status for largefiles
> specified by 'directory pattern' correctly, because 'set.difference()'
> between unknown files returned by 'localrepository.status()' and all
> largefiles is recognized as unknown files finally.
> 
> so this patch reduces cost of 'set.difference()' in 'working' route.
> 
> diff -r 0317d98735a6 -r 5c5ac9b4a726 hgext/largefiles/reposetup.py
> --- a/hgext/largefiles/reposetup.py	Mon Feb 27 18:33:36 2012 +0900
> +++ b/hgext/largefiles/reposetup.py	Mon Feb 27 18:33:36 2012 +0900
> @@ -111,6 +111,9 @@
>                  def inctx(file, ctx):
>                      return file in ctx
>  
> +                def inctxdirs(f, ctx):
> +                    return f in ctx.dirs()
> +
>                  if match is None:
>                      match = match_.always(self.root, self.getcwd())
>  
> @@ -147,7 +150,7 @@
>                      for f in files:
>                          if not lfutil.isstandin(f):
>                              sf = lfutil.standin(f)
> -                            if inctx(sf, ctx2):
> +                            if inctx(sf, ctx2) or inctxdirs(sf, ctx2):

Why does inctxdirs() need to a be a function at all? It's a one-liner,
called once. Inline it! This *is* supposedly a performance
improvement, after all.

Oh yeah: why does inctx() need to be a function? I would inline it too.

And: does this really need to be done on the stable branch? Is it
actually fixing a bug, or just a minor performance tweak? That's
really not clear.

        Greg
-- 
Greg Ward                                http://www.gerg.ca/
"What do you mean -- a European or an African swallow?"


More information about the Mercurial-devel mailing list