Version control for System Administrators (Part 2)
In Part 1 I showed you how easy it is to set up ChangeVue 2009 and to add all your scripts to source control.
In Part 2 you will learn how easy it is to make PrimalScript work seamlessly with version control and ChangeVue. The steps described here apply to just about any source control system you care to use, but we will use ChangeVue to illustrate the individual actions. The PrimalScript options and screenshots where created with PrimalScript 2009. If you have an earlier version, your dialogs will be slightly but not substantially different.
The first step is to make PrimalScript aware that you would like to use a Source Code Control System. You do that in the Source Control – General page of PrimalScript’s Options dialog.
Make sure the “Enable Source Control connection” is checked.
When selecting a provider, your easiest choice is to use a specific provider and select SAPIEN ChangeVue. That setting has the benefit that it will not interfere with other software you may use. This still leaves you the option to use Visual Studio with Microsoft’s Team Server for example.
Spend some moments thinking about the other options here. If PrimalScript detects that you are about to modify a file under source control, it can either just check it out for you silently or it can prompt you. It really depends on your preference and is easy enough to change. For the most seamless workflow, I recommend to uncheck the “Prompt before checking files out” and “Prompt for comment on check-in” for now.
Likewise, select “Check in when file is closed” to follow the workflow used in this post. Press OK to submit these changes.
Now there is only one thing left to do. In the last post you added you Scripts folder under “My documents” to ChangeVue. We will have to make PrimalScript aware that this folder is under source control. To do that, select Tools – Source Control – Connect Folder… from PrimalScript’s menu and select the appropriate folder in the shown dialog.
Since you may have multiple projects and multiple repositories, PrimalScript also needs to know where to map this folder to.
The “Project Name” is what you created in ChangeVue the last time and the Source Control Path is the location of the repository you want to connect to.
Press OK and you should get a dialog indicating that all went well and you are now connected. Any login dialog you may see in between, depending on Source Control provider or security model, should be easy to follow.
Now open any file in your scripts folder in PrimalScript. You will notice in the status bar that the file is read-only.
If you look at the ChangeVue explorer now, you will see the file checked out to you, just as you expect:
Now switch back to PrimalScript and save and close the file.
Your file was checked back in, without any prompt or interference, just as you would normally edit files.
However, if you look in the ChangeVue explorer for the file history, you will see that every time you closed the file a new version was created.
That leaves one last question to answer. Why should you use ChangeVue 2009 for this and not any other source control system? PrimalScript stores a lot of information about your files in alternate file streams, things like Undo information, bookmarks, breakpoints etc.
In any other Version Control Software, that information is lost when you check-in/check-out a file, since they do not preserve any alternate file streams so long as the repository is on an NTFS partition.
ChangeVue does, so you can check in your files at work, go home, establish a VPN and check the file back out and still have all that information preserved.