Jumpstart Guide to Using Enchanting with Bazaar Version Control
This article discusses how to develop Enchanting and use it with an external version control system (namely Bazaar). I used the graphical Bazaar Explorer tool on Windows and went through things step-by-step. If you prefer to use the ‘bzr’ command-line tool, you’ll see the commands to type highlighted in blue.
The Enchanting project is hosted on Launchpad. You can do most of the things listed in this tutorial without even having a Launchpad account. However, if you want to contribute back to the mainline development of the project, you will need to:
- sign up for a Launchpad account
- request to join the Enchanting Team
- tell Launchpad what your public SSH keys is.
One more link you may find handy is to the latest image file for Enchanting.
Without further ado, then, here are the step-by-step screenshots and text for getting started with Enchanting and Bazaar.
Now, you will create a branch of the Enchanting project. Doing so will copy all of the files from the Enchanting project on Launchpad (called "lp:enchanting" for short) to your local computer.
After hitting close on that last dialog, the files downloaded, and I was told I was done creating a branch.
... and, if I navigate to the specified folder in my filesystem, you can see that the branch has indeed been created and populated.
Two important files are not versioned in the source-code repository: Enchanting.image and Enchanting.changes. These files represent a snapshot of the state of the virtual machine image running in Squeak, and as such, change all of the time. For those rare occasions when you need a new copy of the image, download it from http://static.robotclub.ab.ca/source_code/enchanting/Enchanting-Image-Latest.zip.
Unzip the latest image file and put Enchanting.image and Enchanting.changes inside your main Enchanting directory (overwriting any files with the same names).
Drag and drop Enchanting.image onto Enchanting.exe/Enchanting.app, and you'll be greeted with the running image inside a Squeak Virtual Machine, similar to the picture above.
... the file menu has developer functions if you hold down Shift while opening it. Any time you get new code from Launchpad, you'll want to "Import From Version Control." This will 'file in' (import) all of the classes that have been exported to the Classes subdirectory.
Let us now assume that you have new functionality to add that resides within the Enchanting.image. Go ahead and hack on the code ...
Here is what the Classes folder looks like afterwards. You can see there are now more files in the directory. They will need to be added to the source control system.
Going back to Bazaar Explorer, I hit the 'Refresh' button, and it indicates that changes have been made.
I hit the 'plus' symbol beside the word "Unversioned" and specified which files to add to version control.
After that, I wanted to see what changed in the modified files, so I hit the 'Diff' button. [In this image, so far as I can tell, the only difference is in the text file line endings. I will be fixing that so that diffing works properly.] Do note that you can configure Bazaar Explorer to use your favourite diff and merge tools.
Now that I am happy with everything I've done, I am performing a local commit. Basically, this means that all the changes I've made will be safe in the source control system, but only on my computer. (We'll push the changes to launchpad in the next few steps.)
After I type in a message (so I know what changes I made when I look through the history/log of the project), I hit "Okay" and everything is committed locally.
I am now going to Merge. Basically, this will check to see if there have been any changes on Launchpad that need to be integrated into my branch. The location could read "lp:enchanting" for short.
The merge went successfully. It does help that there were no changes. If there were, I recommend diffing, testing, committing locally, and merging again until there are no changes.
Now, I (believe I) am ready to push my changes to the code repository on Launchpad, so I hit the "Push" button.
I need to tell Launchpad who I am so I can upload code. The only way to do that in Bazaar Explorer version 1, is to go to "All Commands..."
... and then issue the "launchpad-login" command with my Launchpad username, "clinton-blackmore". After a couple of false starts, I hit "Okay" and it works.
Now that I'm logged in to Launchpad (and am on the Enchanting-Team that controls the Enchanting project), I try to push the code again. It gets further, but fails in that it can not verify my SSH key to upload the code. I go to the Launchpad site, read up on creating an SSH key and telling Launchpad what it is, do it, and then, as you can see, I successfully push up a new version of the code.