Update 2017: This guide remains here for historical reasons. The script presented here works, but is severely flawed in respect to history ordering and merging.
If you are migrating, you should use git-migration instead.
Using SmalltalkHub for project management is what most people would opt for when they start with versioning in Pharo. Although this solution works well for the versioning itself, it doesn’t handle many use cases that you might seek in modern project versioning platform. That’s where git and GitHub comes in.
(Note: this guide makes mention of GitHub, however you can follow the guide even if you want to use BitBucket, GitLab, or your local git repo.)
GitHub and git offers a wide range of additional features:
- issue tracker
- github pages (website for your project hosted on
- decentralized collaboration
- better version control
- bundling non-code artifacts (images, documents, …)
- and much,
- much more
Furthermore the support for git(hub) in Pharo is improving with a range of emerging tools.
After you are done, clone the repository somewhere to your system.
Now I recommend you create a new folder in the root of your project where the source code will live. The reason for this is that you will have better organization if you want to add non-Pharo content to the project such as documentation, assets, configs, etc. I like to use
repository, however you are free to name it whatever you want.
From within Pharo, first install GitFileTree. You can do so from Catalog Browser.
Now open Monticello Browser and click on +Repository to add a new repository and select
A file manager will open where you can select the target folder of your local git repository. Select the place where you want your code to live. If you created a subfolder for that (as mentioned previously), then select that folder.
If everything was done right, you should now have a new repository created.
Now we can finally get to the copying itself.
Despite SmalltalkHub and GitHub using different storage formats, you will be working with them in the same manner, as in Pharo you access them both via Monticello.
This also means that the copying itself can be scripted as you can copy freely copy Monticello packages between repositories.
There’s not much point in explaining the script itself, so I’ll just provide it as it is.
You need to modify the source and destination (just change the name to whatever is appropriate), and add name mapping from Monticello commits to git commits (SmalltalkHub commits do not contain email), then you can execute the script in the Playground.
Note: executing the script may take a while because it will have to download each individual commit (you will see a progress bar though)… so go have a cup of coffee.
(The link under the script will lead you directly to the latest gist.)
Push your code to GitHub and you’re done.
Finally you should add a
BaselineOf (git’s counterpart of
ConfigurationOf) so your project can be easily loaded via Metacello. How to do that you can find here http://blog.yuriy.tymch.uk/2015/07/pharo-and-github-versioning-revision-2.html.
Likewise if you want to automatically test your GitHub project, then you can read the guide Testing Pharo projects with Travis