Hi Colin and Avi,
I'm not sure how to load data from a repository into the image. Currently, I have something like: loadFromMemo | snapshot versions | snapshot := selectedMemo getSnapshotFrom: repository. versions := snapshot getVersionsFrom: repository. versions do: [:version | MDWorkingCopy default loadVersion: version] Is that the right way of loading? The problem with this approach is when a class A contain a method m1 in the image, but you are loading a version which does not contain this method because it has been removed. Then, the method is not removed from the image. -- Damien Cassou |
> I'm not sure how to load data from a repository into the image.
>From WAVersionUploader in the Seaside pacakge: | reader version | reader := MCVersionReader readerClassForFileNamed: file fileName. reader ifNil: [self inform: file fileName, ' is not in a known format']. version := reader versionFromStream: file contents asByteArray readStream. version load Lukas -- Lukas Renggli http://www.lukas-renggli.ch |
2007/7/16, Lukas Renggli <[hidden email]>:
>From WAVersionUploader in the Seaside pacakge: > ... Hi Lukas, the subject should have gave you a small advice but I apologize for not having been that clear: I'm asking for Monticello 2 :-). Bye -- Damien Cassou |
> the subject should have gave you a small advice but I apologize for
> not having been that clear: I'm asking for Monticello 2 :-). Aha, I am sorry, I did not read careful enough. Lukas -- Lukas Renggli http://www.lukas-renggli.ch |
In reply to this post by Damien Cassou-3
On Jul 16, 2007, at 8:40 AM, Damien Cassou wrote: > Hi Colin and Avi, > > I'm not sure how to load data from a repository into the image. > > Currently, I have something like: > > loadFromMemo > | snapshot versions | > snapshot := selectedMemo getSnapshotFrom: repository. > versions := snapshot getVersionsFrom: repository. > versions do: [:version | MDWorkingCopy default loadVersion: version] > > Is that the right way of loading? No, you need to have a slice do the loading. Here's some code to save and then reload a snapshot: "Create a working copy and repository" wc := MDWorkingCopy forImageProxy: MDWorkingCopy defaultImageProxy. memory := MDMemoryRepository new. "Create a slice" slice := MDPackageInfoSlice named: 'Refactory'. "Save it" snapshot := slice saveFrom: wc to: memory. "Load it" slice load: snapshot from: memory to: wc. > The problem with this approach is when a class A contain a method m1 > in the image, but you are loading a version which does not contain > this method because it has been removed. Then, the method is not > removed from the image. Right. That's why you need the slice. It knows what elements in the image belong to the slice, so it can compare with the snapshot to see what should be removed. Colin |
Hi Colin,
2007/7/16, Colin Putney <[hidden email]>: > No, you need to have a slice do the loading. Here's some code to save > and then reload a snapshot: > > "Create a working copy and repository" > wc := MDWorkingCopy forImageProxy: MDWorkingCopy defaultImageProxy. > memory := MDMemoryRepository new. > > "Create a slice" > slice := MDPackageInfoSlice named: 'Refactory'. > > "Save it" > snapshot := slice saveFrom: wc to: memory. > > "Load it" > slice load: snapshot from: memory to: wc. How do you load a slice in a new image if it's not a PackageInfo then? -- Damien Cassou |
On Jul 16, 2007, at 11:49 AM, Damien Cassou wrote: > Hi Colin, > > 2007/7/16, Colin Putney <[hidden email]>: >> No, you need to have a slice do the loading. Here's some code to save >> and then reload a snapshot: >> >> "Create a working copy and repository" >> wc := MDWorkingCopy forImageProxy: MDWorkingCopy defaultImageProxy. >> memory := MDMemoryRepository new. >> >> "Create a slice" >> slice := MDPackageInfoSlice named: 'Refactory'. >> >> "Save it" >> snapshot := slice saveFrom: wc to: memory. >> >> "Load it" >> slice load: snapshot from: memory to: wc. > > How do you load a slice in a new image if it's not a PackageInfo then? You just need to create a different kind of slice. The snapshot will contain a version based on an MDSliceElement that has the details of what kind of slice to use. Colin |
2007/7/16, Colin Putney <[hidden email]>:
> On Jul 16, 2007, at 11:49 AM, Damien Cassou wrote: > > How do you load a slice in a new image if it's not a PackageInfo then? > > You just need to create a different kind of slice. The snapshot will > contain a version based on an MDSliceElement that has the details of > what kind of slice to use. I do not understand. Imagine I give you a repository, how do you load the content? How do you create the slice and what kind of slice? -- Damien Cassou |
2007/7/16, Damien Cassou <[hidden email]>:
> 2007/7/16, Colin Putney <[hidden email]>: > > On Jul 16, 2007, at 11:49 AM, Damien Cassou wrote: > > > How do you load a slice in a new image if it's not a PackageInfo then? > > > > You just need to create a different kind of slice. The snapshot will > > contain a version based on an MDSliceElement that has the details of > > what kind of slice to use. > > I do not understand. Imagine I give you a repository, how do you load > the content? How do you create the slice and what kind of slice? This answer is important for me. How do you load a slice in an image that do not have that slice already? -- Damien Cassou |
Free forum by Nabble | Edit this page |