I spent years programming in Delphi, from the first version 1.0, more than ten years ago, to the excellent releases 6 and 7. I also grew up as a developer using tools like TurboPascal so when a couple of days ago I had the chance to have a try on the latest Delphi IDE and check how it works with Plastic it was actually a very rewarding experience.
Installing Plastic plugin
When you install Plastic to be integrated with Delphi, remember to check the Visual Studio integration option in the installer. Plastic currently integrates with Delphi using the SCC API so if you don’t install the SCC plugin you won’t be able to make it run within Delphi.
Once Plastic is installed you’ll need to download and install SourceConneXion. You can obtain it from http://www.epocalipse.com/downloads.htm. I’ve tried version 3 and it works great. Remember to download SourceConneXion and not VssConnection (as I did the first time) because the latter only works with Visual Source Safe.
Open Delphi, and go to Source Control\Tools\Provider Configuration and select Plastic as your version control provider.
Now you have Plastic installed and working.
You can take a look at the Delphi configuration options for plugins (Source Control\Tools\Options) in order to set up whether you want automatic checkouts, and so on.
Adding a project under source control
I started with a very simple Win32 project containing just a form and a button as you can see on the following figure:
Then I just right clicked on my project and selected the add to source control option.
If you still don’t have a workspace at your project’s location Plastic will help you creating one. You need to place your Delphi projects inside a Plastic workspace. For normal (and complex) Delphi projects a Plastic workspace will be used to work on different ones. A workspace is just a place on your disk where you work with your projects and Plastic knows that it has to control all changes there.
Delphi creates a list of the files to be added and shows it in a dialog so you can decide which ones go in or are rejected. In my case I typed a short comment telling this was the initial code import.
Once your project is under source control you can start working. Another developer can already create a new workspace on his machine and download the code you’ve just added.
I played a little bit with the Delphi functionalities and created a DUnit testing project. I also placed it under source control. Then I decided to change on the sample test methods so I just typed a key on the file. The file was checked in so Delphi prompts you if you want to check out the file before making any further modifications.
From now on the process will be very simple: checkouts will happen automatically whenever you start typing on a protected file. To checkin your changes you just have to go to the Source Control menu or right click on your file on the Project Manager pane.
Under the Source Control menu there’s an interesting option: the project explorer. You can take a look at your entire project tree (very simple in my case) and check whether the files are checkout or not.
The project explorer is also very useful to select several files and run group checkins from there.
Changing a file’s type
Plastic recognizes Pascal’s file extensions but it can happen that you use a different Delphi version or that you have under version control a file which type has been wrongly identified by Plastic. I mean, maybe you have a binary file which should be identified as text or vice versa. It is important for running diffs and merges because text and binary tools are different.
If you need to modify a file type, simply go to the Plastic GUI (you can also do it from the command line, but the GUI is easier) select the file you want to change, right click on it and go to the type menu option.
You can also do it from the file history.
Labelling your source code
So far I’ve just made some modifications on the main branch so my branch explorer looks like the following figure (please note to display the branch explorer you've to go to the Plastic GUI). There are just some changesets available but no branches at all.
The first thing I’ll do is creating a baseline with the code I’ve made so far, so I have a good starting point to use during development. I mean, I have a version of my entire project which I know it works, it compiles, it passes the tests, and so on (yes, here I have just a very simple project, but you know, I describe how things should be).
To do so I go to the labels view and choose to create new label and then I type the name and comments of the new label.
Please remember in Plastic labelling is a two-step process: first you create the new label and then you apply it to your workspace. So here is the second step.
How does my branch explorer look like after the labelling? Just take a look at the following figure.
So far we've seen the very basics of starting a project with Delphi and Plastic SCM. Now we know how to add a project under source control, perform basic operations, label a release...
In the next post I'll be introducing branching and merging using a Delphi project...
news ( 119 ) mono ( 30 ) merging ( 23 ) integrations ( 22 ) distributed ( 20 ) best practices ( 18 ) branching ( 14 ) semanticmerge ( 14 ) git ( 12 ) scm ( 11 ) c# ( 9 ) fun ( 9 ) testing ( 9 ) solaris ( 7 ) branch explorer ( 6 ) configuration ( 6 ) performance ( 6 ) visual studio ( 6 ) migration ( 5 ) Agile ( 4 ) Scrum ( 4 ) backend ( 4 ) differences ( 4 ) delphi ( 2 ) unity ( 2 ) eclipse ( 1 )