[PATCH 2 of 4] merge: use file context objects instead of acting directly on localrepo

Sean Farley sean.michael.farley at gmail.com
Tue Aug 19 01:08:05 CDT 2014


Pierre-Yves David writes:

> On 08/18/2014 07:42 PM, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean.michael.farley at gmail.com>
>> # Date 1406339242 18000
>> #      Fri Jul 25 20:47:22 2014 -0500
>> # Node ID d1a21cc0bc4ba5764a1f8760fd041a91939b4d00
>> # Parent  594d00e49cea6cd2ebb92c0570e7502f8797e232
>> merge: use file context objects instead of acting directly on localrepo
>
> Can you remind me what is the motivation behind have those methods 
> (write/removes) on the filectx instead of the changectx itself?

Merge (and friends) need a way to change the data for a filectx.
Currently, this is done by actually writing merged data onto disk, then
having localrepo.commit read that off of disk.

If we want to do a merge in memory, then we need a way to change this
data in a filectx. That's why the previous patch needs to cache the
filectx in __getitem__ (so that the changed data is not thrown away).

This kind of refactoring will greatly help alleviate the pain of
localrepo.commit having to read off of disk directly (but that's another
patch series or two away).

> Given the potential cycle between filectx and changectx, I'm not sure 
> the "methods on filectx" way can fly easily.

I don't quite know what you're getting at but I see no other semantic
way than something like:

ctx[filename].data = newdata


More information about the Mercurial-devel mailing list