[squeak-dev] Monticello: committing part of a change
frank.shearar at angband.za.org
Tue Feb 15 21:05:16 UTC 2011
On 2011/02/15 03:54, Colin Putney wrote:
> On Mon, Feb 14, 2011 at 2:24 PM, Frank Shearar
> <frank.shearar at angband.za.org> wrote:
>> On 2011/02/07 16:06, Chris Muller wrote:
>> OK, I see that when one hits the Save button, Monticello creates the new
>> version using MCWorkingCopy>>newVersion, which ultimately calls
>> MCPackage>>snapshot. This returns an MCSnapshot containing a collection of
>> MCDefinitions for all the bits& pieces inside a package - class
>> definitions, method definitions, etc.
>> So presumably one could save SOME of the pending changes, by simply saving
>> an MCSnapshot that contains only SOME of the definitions in a package?
> The basic problem here is this: MC works by saving snapshots of
> packages. When it loads a snapshot, it makes the code in the package
> match what's recorded in the snapshot. That includes *removing* code
> that's in the image and part of the package, but not in the snapshot.
> So if you have a snapshot that only includes some of the definitions,
> when you try to load it, everything else will be deleted.
> Now, there's a few ways to work around it, but they all have issues.
> One way is to include all the definitions, but only take some of them
> from the image, and take the rest from the previous version of the
> package. That should get you a complete, but it has a subtler problem:
> the code in the "snapshot" never existed in your image. It may not
> have enough internal consistency to be loadable. It might have methods
> for classes that don't exist, or references to instance variables that
> don't exist etc. Rather than deal with all those issues, Monticello
> just relies on the regular Smalltalk mechanisms for ensuring that the
> system is internally consistent.
> Another way would be to create a sort of custom package definition,
> which would allow the snapshot to contain just the changes you're
> interested in, without wiping out the rest of the package when you
> load it. But then you need a way to manage that package definition, a
> way to load it into the image before you load the snapshot, or a way
> to bundle into the version file. That's pretty non-trivial - if we had
> that, we wouldn't need PackageInfo.
> For what it's worth, you can do it in Monticello 2 by creating a
> change set before you make the fix, then taking a snapshot of the
> change set.
Since we're not using MC2 (I see the thread's spawning a conversation
around that), how about this:
* Let M be the package version number.
* save the current package as a snapshot with version N, where N >= M + 1.
* Roll back the package to version M. Present the user with a list of
changes between N and M.
* Save this new half-package with version M + 1.
* Roll back to M, and load package N. (Rolling back to M might not be
necessary?) _Delete_ version N.
More information about the Squeak-dev