How to copy several Monticello commits from local

2020-07-18 11:16发布

问题:

I commit several versions of Monticello packages to a local repository on my disk during the day.

At a later time I want to sync the local repository with a Smalltalkhub.com repository.

At the moment I copy the local commits manually one by one to the Smalltalkhub repository using the Monticello browser.

How can i automate this task?

回答1:

You can use Gofer to automate your Monticello tasks.

 Gofer new
   package: 'MyProject-Core';
   package: 'MyProject-Tests';
   url: 'http://smalltalkhub.com/mc/USER/MyProject/main/' username: 'USER' password: '***';
   push.


回答2:

In the Gofer chapter of the "deep into pharo" new free book (pharo by example two - http://rmod.lille.inria.fr/pbe2/.) I presented Gofer in details. In particular I present some ways to migrate between repositories
The default for Gofer is fetch and pull, based on that you can easily build sync.

For example if you use Smalltalk hub

Gofer new
  smalltalkhubUser: 'PharoBooks' project: 'GoferExample'; 
  package: 'PBE2GoferExample';
  package: 'PBE2GoferExampleSecondPackage';
  push.
Gofer new
  smalltalkhubUser: 'PharoBooks' project: 'GoferExample'; 
  package: 'PBE2GoferExample';
  package: 'PBE2GoferExampleSecondPackage';
  fetch

You can also obtain some information as follows

((Gofer new
  smalltalkhubUser: 'Pharo' project: 'NativeBoost'; allResolved)
     groupedBy: [ :each | each packageName])

Now you can also migrate

 | go |
 go := Gofer new squeaksource3: 'Pharo20'. 
 go allResolved
    do: [ :each | self crLog: each packageName. 
        go package: each packageName;
        fetch]

Then once you get the files in your local directory you can push to another repository.

  | go |
  go := Gofer new.
  go repository: (MCHttpRepository
                   location: 'http://ss3.gemtalksystems.com/ss/rb-pharo' 
                   user: 'pharoUser' 
                   password: 'pharoPwd').
  (((FileSystem disk workingDirectory / 'package-cache') allFiles 
       select: [:each | '*.mcz' match: each basename])
                    groupedBy: [:each | (each base copyUpToLast: $-) ]) keys 
                                            do: [:name | go package: name; push]