[PATCH 1 of 6] context: let workingctx parents be overriden

Matt Mackall mpm at selenic.com
Mon Jun 16 11:34:51 CDT 2008


On Mon, 2008-06-16 at 09:54 +0200, Patrick Mézard wrote:
> Matt Mackall a écrit :
> > On Sun, 2008-06-15 at 19:21 +0200, Patrick Mezard wrote:
> >> # HG changeset patch
> >> # User Patrick Mezard <pmezard at gmail.com>
> >> # Date 1213549476 -7200
> >> # Node ID 801e6c072d4e787a0929926f9d8e922d58d72867
> >> # Parent  76021ec849c876bde6fc85485e81cc4d835036fd
> >> context: let workingctx parents be overriden
> > 
> > Puzzled. Why don't we just use another class here?
> > 
> > We could, for example, have a memctx class derived from ctx, with
> > workingctx derived from memctx.
> 
> My plan is:
> 1- Refactor localrepo.commit() so we can pass it a changectx like
> object, and ensure there is a simple code path not involving any
> dirstate related operation. This is addressed by the current patch
> series.
> 2- Implement a memctx proposal and use it in convert. It will make
> convert stop using it's working directory as a storage for temporary
> files, and give a concrete example to discuss *ctx refactoring. At
> this point, the memctx support is marked experimental.
> 3- Refactor *ctx classes until we are happy with them.

Ok, that all seems reasonable.

> My mistake is probably to have changed localrepo.workingctx() to
> expose the additional parameters. I should have kept them as internal
> details, I don't think  they are of any use for other people. But it
> was a convenient way of letting workingctx be overriden while limiting
> the changes. Again, I am very careful when dealing with the *ctx
> stuff, the mix of inheritance and lazy initialization makes things
> complicated, and I preferred to defer this until we really need it.
> 
> So providing I remove the changes to localrepo.workingctx() and mark
> the extra parameters as implementation details, what do you think
> about this ? I already have [2] so we can move forward if this
> refactoring is accepted.

I'm a little worried by the patch that splits out a _commitctx function.
Perhaps we should be instead migrating some of the ugly guts of commit
out into commands.py or cmdutil.py. Localrepo really shouldn't bother
itself with editors and such..

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial-devel mailing list