After a bit of work, I just sent my first attempt to get diff working with a memory context. My basic idea was as follows:
- make
memctx
inherit fromworkingctx
so that it gets all the goodness of a regular context, like so
- add any minimal number of methods to
memctx
to make diff work
It was pretty straight-forward but as I wrote this series I learned a few things. For one thing,
I should have split up the patch series into two series: one for add ipdb
debugging
and one for the memctx
changes. Another potential pitfall (noticed in patch 12), is
the discrepancy of memctx
with its other siblings. memctx
has a different
__init__
signature which suggests that a bigger refactoring might be needed.
Finally, as Kevin pointed out, having memctx
inherit from a workingctx
seems a little forced. For example, isinstance(workingctx, obj)
vs.
isinstance(memctx, obj)
doesn’t quite read the same way. I think the only way around
this would be for total context.py refactoring as such,
Off to my next round of patches!