Design of persistent tag cache
Greg Ward
greg at gerg.ca
Wed Jul 8 11:33:20 CDT 2009
[me, on Matt's tag cache design]
>> <headnode> <headrev> <tagnode>
>> [...repeat: 1 line per head...]
>>
>> <node> <tag>
>> [...repeat: 1 line per tag...]
>>
>> Good things about this design:
>> * it's easy to detect if the entire cache is still valid: if the set
>> of heads in the cache == the current repo heads, the cache is all good
>> and we don't have to read any .hgtags files
[Matt reminds me]
> We can do better. If the tip is stored correctly in the cache, we can
> assume all the other heads are correct.
Sure, but that's a second-order optimization. Given the proposed
structure of the cache file, we still have to read the whole thing.
Comparing tips just means we can test "cacheheads[0] ==
currentheads[0]" and possibly skip comparing the whole lists. And we
don't have to store all the cached heads in a list anywhere. Compared
the cost of what we're *really* trying to avoid, this is small change.
> This ignores mq/strip, which
> will have to invalidate/update the cache for all the rules it breaks.
On reflection, I think that rollback is equivalent to strip from the
POV of tag caching. They can both destroy one or more changesets, they
both remove a head, and they can possibly expose older heads.
So I think that whatever I do to handle strip also needs to be done
for rollback.
Greg
More information about the Mercurial-devel
mailing list