[PATCH 3 of 3 v4] store: enable native fncache encoding by default

Adrian Buehlmann adrian at cadifra.com
Thu Sep 6 18:41:15 CDT 2012


On 2012-09-07 01:31, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1346971160 25200
> # Node ID caac8df592d7c2c9ef3a61379a5fd6f8af1400f6
> # Parent  4a87c26bd06144d628ae6b160309d47e0754dc5d
> store: enable native fncache encoding by default
> 
> diff --git a/mercurial/store.py b/mercurial/store.py
> --- a/mercurial/store.py
> +++ b/mercurial/store.py
> @@ -6,7 +6,7 @@
>  # GNU General Public License version 2 or any later version.
>  
>  from i18n import _
> -import osutil, scmutil, util
> +import osutil, scmutil, util, parsers
>  import os, stat, errno
>  
>  _sha = util.sha1
> @@ -425,8 +425,11 @@
>  def store(requirements, path, openertype):
>      if 'store' in requirements:
>          if 'fncache' in requirements:
> -            auxencode = lambda f: _auxencode(f, 'dotencode' in requirements)
> -            encode = lambda f: _hybridencode(f, auxencode)
> +            dotreq = 'dotencode' in requirements
> +            encode = dotreq and getattr(parsers, 'pathencode')

raises AttributeError if pathencode does not exist

You probably want a default for the getattr call?

> +            if not encode:
> +                auxencode = lambda f: _auxencode(f, dotreq)
> +                encode = lambda f: _hybridencode(f, auxencode)
>              return fncachestore(path, openertype, encode)
>          return encodedstore(path, openertype)
>      return basicstore(path, openertype)


More information about the Mercurial-devel mailing list