[Monticello2] Loading from a repository

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[Monticello2] Loading from a repository

Damien Cassou-3
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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Lukas Renggli
> 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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Damien Cassou-3
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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Lukas Renggli
> 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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Colin Putney
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


Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Damien Cassou-3
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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Colin Putney

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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Damien Cassou-3
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

Reply | Threaded
Open this post in threaded view
|

Re: [Monticello2] Loading from a repository

Damien Cassou-3
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