Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy a Monticello package to another repository under a different name with Gofer

The context is this one:
A package had several branches developped in several repositories

  • squeaksource
  • source.squeak.org/trunk

Development stopped in source.squeak.org, and the goal is to transfer the branch back to squeaksource in order to have all versions published in a single repository.
But to ease human browsing and fast identification of the branch, I wish to add a standard branch identification to the name of squeaksource copy.
Is there a way to automate this operation? With Gofer maybe?

like image 941
aka.nice Avatar asked Jun 05 '12 21:06

aka.nice


2 Answers

Monticello packages are immutable. You can easily move the versions around, but you should not rename the files. If you do, you break the history and loose the ability to merge the versions within your version tree and with other people's contributions.

To move all versions of package A from source url to target url you can use:

Gofer new
   repository: 'source url';
   package: 'A';
   fetch

" If you understand the concequences you could rename/rebranch the version files in your package-cache at this point. "

Gofer new
   repository: 'target url';
   package: 'A';
   push
like image 170
Lukas Renggli Avatar answered Sep 30 '22 19:09

Lukas Renggli


A more arcane solution which avoids subsequent serialization and deserialization of Monticello packages. This is useful for very big repositories and speeds up the copying quite a bit:

| sourceRepositoryUrl destinationRepositoryUrl files |

repositoryUrl := 'http://www.squeaksource.com/PROJECT'.
destinationRepositoryUrl := 'http://smalltalkhub.com/mc/USER/PROJECT/main'.

files := (MCHttpRepository new 
    parseFileNamesFromStream: (ZnClient new get: repositoryUrl; entity) readStream)
    select: [ :each | ZnMonticelloServerDelegate new isValidMczName: each ].

files do: [ :fileName ||entity stream|

    Transcript show: fileName; cr.
    "download version"
    entity := ZnClient new
    beOneShot;
        url: repositoryUrl;
        addPath: fileName;
        get;
        entity.

    "upload the version to gemstone"
    ZnClient new
        beOneShot;
        ifFail: [ :exception | Transcript show: fileName; show: ' '; print: exception ];
        username: 'USER' password: 'PASSWORD';
        entity: entity;
        url: destinationRepositoryUrl;
        addPath: fileName;
        put ]
displayingProgress: [ :fileName| 'Copying ', fileName]
like image 31
camillobruni Avatar answered Sep 30 '22 18:09

camillobruni