[PATCH 09 of 10 V2] branchmap: report filtername when read fails

Augie Fackler raf at durin42.com
Mon Dec 31 18:19:30 CST 2012


On Dec 27, 2012, at 7:56 PM, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:

> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
> # Date 1356188217 -3600
> # Node ID cf84b46c2a1a4914ecac9659e15c34111aab6022
> # Parent  427da70a9d079c6ef91408bad67070fc4c1441ff
> branchmap: report filtername when read fails
> 
> Now that we can have multiple one, we need to know which filecache failed to be
> read from disk.
> 
> diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
> --- a/mercurial/branchmap.py
> +++ b/mercurial/branchmap.py
> @@ -46,11 +46,14 @@ def read(repo):
>             partial.setdefault(label, []).append(bin(node))
>     except KeyboardInterrupt:
>         raise
>     except Exception, inst:
>         if repo.ui.debugflag:
> -            repo.ui.warn(('invalid branchheads cache: %s\n') % inst)
> +            msg = 'invalid branchheads cache: %s\n'
> +            if repo.filtername is not None:
> +                msg = 'invalid branchheads cache (%s): %%s\n' % repo.filtername

Double % formatting this weirds me out intensely. Can we do something like this instead?

  extra = ''
  if repo.filtername:
    extra = ' (' + repo.filtername + ')'
  msg % (extra, inst)

or similar?

> +            repo.ui.warn(msg % inst)
>         partial = branchcache()
>     return partial
> 
> 
> 



More information about the Mercurial-devel mailing list