[Q][Monticello] snipet for saving a mcz file
Avi Bryant
avi at beta4.com
Wed Aug 4 17:46:23 UTC 2004
On Aug 2, 2004, at 11:19 AM, Hernan Tylim wrote:
> Hi,
>
> I have a question for the Monticello gurus on the list.
>
> I am trying to programatically write the last comitted version of a
> package
> to a mcz file and I made the following code snipet for that purpose:
>
> | package version |
> package := MCPackage named: 'Monticello'.
> version := MCVersion
> package: package
> info: package workingCopy currentVersionInfo.
> file := FileStream newFileNamed: (FileDirectory default fullNameFor:
> version
> fileName).
> version fileOutOn: file.
> file close.
>
> This do-it seems to work but what I would like to know if this is the
> right
> way of doing it.
That will work, although note that if the package has been modified
since the last committed version, this will create a new version
instead of writing out the old one. What's odd about it, however, is
that you're creating a new MCVersion instance rather than using an
existing one. In some rare cases (for example, the package gets
changed but somehow the modified flag isn't set) this could end up with
two version files with the same UUID but slightly different contents.
So you're bettter to look for the old version instance:
version := package workingCopy repositoryGroup versionWithInfo: package
workingCopy currentVersionInfo.
Avi
More information about the Squeak-dev
mailing list
|