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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Aug 19 01:29:03 CDT 2014


So, reply to patch 1 failed to be sent so you got reply to patch 2 
without reply to patch one, lacking some useful context.

On 08/18/2014 11:08 PM, Sean Farley wrote:
>
> 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.

Why does it especially needs to be from a filectx? Why can't it be from 
a changectx?

> 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).

I know we need a was to store the data. but why can't this be done in 
changectx?

> 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

The cycle issue is covered in the reply to patch 1. It should have made 
it to the rest interweb by now. (sorry about that)

> but I see no other semantic
> way than something like:
>
> ctx[filename].data = newdata

What about:

   ctx.setcontent(filename, content)


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list