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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jan 1 16:12:13 CST 2013


On 1 janv. 2013, at 01:19, Augie Fackler wrote:

> 
> 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?

I'm ok with them, but I'll send a V3 with no %%

-- 
Pierre-Yves


More information about the Mercurial-devel mailing list