2012-06-05 19 views
10

的背景是這一個:
一個包已在多個倉庫如何在蒙蒂塞洛包下一個不同的名稱複製到另一個存儲庫GOFER

  • squeaksource
  • source.squeak.org developped幾個分支/ trunk

開發停止在source.squeak.org中,目標是將分支轉移回squeaksource以便將所有版本發佈到單個存儲庫中。
但爲了方便人們瀏覽並快速識別分支,我希望爲squeaksource副本的名稱添加標準分支標識。
有沒有辦法讓這個操作自動化? Gofer可能嗎?

+0

你添加轉換/複製操作的僞代碼示例...... –

+0

我的目的是一樣的東西:
實用copyEveryVersionAfter:「宇宙-ls.39'fromRepository:'source.squeak.org/trunk'toRepository:'www.squeaksource.com/universes'withBranchSuffix:'squeaktrunk' –

回答

7

蒙蒂塞洛包是不可變的。您可以輕鬆地移動版本,但不應該重命名文件。如果你這樣做,你會破壞歷史,並且無法合併版本樹中的版本和其他人的貢獻。

要將包一個源URL目標URL你可以使用的所有版本:

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 
+0

啊,當然,我忘了這個功能...... UUID只用於像校驗和一樣,但不是用於識別目的,只有名字纔算數。我當然可以使用versionInfo手術,或像oldName becomeForward:newName這樣的黑魔法超級大國... –

+0

是的,如果您控制了項目的所有現有分支,那麼可以工作。再次記住,任何涉及不是來自你的分支的版本的操作(加載,比較,合併......)都需要單獨的黑魔法。 –

3

避免了後續的系列化和蒙蒂塞洛包的反序列化一個更神祕的解決方案。這是一個非常大的倉庫有用,加快複製頗有幾分:

| 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] 
相關問題