如何使用Gofer将Monticello软件包复制到另一个名称下的存储库

时间:2012-06-05 21:20:10

标签: smalltalk pharo squeak monticello

背景是这一个:
一个软件包在几个存储库中开发了几个分支

  • squeaksource
  • source.squeak.org/trunk

开发在source.squeak.org中停止,目标是将分支转移回squeaksource,以便将所有版本发布在单个存储库中。
但为了方便人们浏览和快速识别分支,我希望在squeaksource副本的名称中添加标准分支标识。
有没有办法自动化这项操作?可能还有Gofer?

2 个答案:

答案 0 :(得分:7)

Monticello包是不可变的。您可以轻松移动版本,但不应重命名文件。如果这样做,您就会破坏历史记录,并且无法合并版本树中的版本以及其他人的贡献。

要将包 A 的所有版本从源网址移至目标网址,您可以使用:

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

答案 1 :(得分:3)

一个更神秘的解决方案,避免了随后的Monticello软件包的序列化和反序列化。这对于非常大的存储库很有用,并且可以加快复制速度:

| 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]