[PATCH] duplicated path in cache r547

John A Meinel john at arbash-meinel.com
Wed May 25 15:33:22 BST 2005


John A Meinel wrote:

> William Dodé wrote:
>
>> Hi,
>>
>> There is a bug if we add and remove a file AND use bzr
>> status before commit :
>>
>> $ bzr init
>> $ touch a
>> $ bzr add a
>> $ bzr remove a
>> $ bzr add a
>> $ bzr status
>> added:
>>  a
>> $ bzr commit -m "a"
>> bzr: error: duplicated path in cache: u'a'
>>  at /vrac/python/bazaar-ng/bzrlib/statcache.py:169 in load_cache()
>>  see ~/.bzr.log for debug information
>>
>> It doesn't scratch if we don't do bzr status
>

The attached patch seems to fix the problem for me. It seems to me that 
a cache of stat values should be keyed off of the file paths, not the 
file ids, since that is what we are 'stat' ing. The file-id exists only 
in bzr, stat knows nothing about them.

This patch simply builds a dictionary of path -> id, and if the new id 
is different from the old id, it removes the old entry from the cache. I 
don't think building up the dictionary will be terribly difficult in 
large trees, though if we found it problematic, we could build it up at 
the same time that we are building up the original dictionary. It just 
changed the interface of a function (load_cache) which I didn't want to do.

John
=:->


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: stat-cache-update-by-path.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20050525/580e5f4b/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050525/580e5f4b/attachment.pgp 


More information about the bazaar mailing list