[PATCH 1 of 4] basectx: cache filectx generation for all contexts

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Aug 20 15:16:07 CDT 2014



On 08/20/2014 12:41 PM, Sean Farley wrote:
>> Also, the filectx object keep a reference to the changectx. So you
>> >cannot hold a reference from the changectx to the filectx without
>> >introducing a cycle
> Would this be a real problem now? Or are you saying that there's another way?

Not sure I understand your question.

There is already a filectx → relation relation. So you -can-not- 
introduce a changectx → filectx.

However you could be storing the content of file on memctx directly:


   # filename → content mapping
   #
   # holds new data for files whom content have been overwritten
   # None mean the file have been removed
   memctx._filecontent =  {}

The memctx.setcontent(filename, data) and memctx.remove(filename) would 
touch this data directly.

The memfilectx (who know its memctx parent) would look into this 
dictionnary for potential content.

The mechanism could be later extended to store data in temporary file if 
size becomes an issue.


extra note: I made this up in 10 secondes so it likely has some flaw

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list