Yesterday I watched David Leedy's NotesIn9 series and in that video he mentioned Source Code Management (SCM). When I started work at GBS I was introduced to SCM. At first this was an alien concept as I believe 98% of notes developers have no idea what SCM is or what it can provide to them. But since I've been introduced to SCM I don't know how I managed without it. Pretty much everything I develop at work and personally goes to a git server and when I'm done with the development I just delete it from DDE and possibly even the domino server. I can do that because all of my code is stored in the cloud and always accessible from anywhere.
If you're working with a team of developers with multiple people working in the same application, SCM is critical to the success of the project. Of course you can enable design locking so people don't step on one another, but I've learned working on a server that's across the country just sucks. If you're in that situation you've probably discovered that working on a local server is much better so you make a replica of the app that everyone is working on, make your changes in that replica and then replicate. This is all fine and well, but you'll invariably end up with duplicate design elements which, of course are replication save conflicts. You'll probably also suffer from your hard written code being overwritten at some point. This is no good, and while doable can certainly turn into a time suck.
So, how do we remedy this issue? With SCM of course. When using a SCM system, either SVN or git, everyone can work on their own local servers and just commit their changes to the SCM server. Any changes to the same files by different users will be merged into the master branch on the SCM server. People can then pull those changes down and incorporate them into their local applications to continue work with the latest and greatest version with everyone's changes. No replication save conflicts, no lost code and no design locking. All of this results in better productivity.
SCM will also allow you to do branching. Branching allows you to work on maybe some proof of concept features without affecting the production code stream. You make a new branch and make your changes just as you normally would. If you break the whole thing, no worries you can always go back to the previous version or even go back to a previous commit before everything broke. So you've totally screwed up, but not really as you're saved by SCM because you can go back. Even if your changes don't pan out, you can just abandon the code and nothing else is required, it's in a different branch. On the flip side, if your changes work and you're happy with them, you just merge the "feature branch" back into the main branch and you don't change anything that was already working and your new changes are available.
So, how do we get this magic SCM system and be able to use it from within DDE? If you're using 8.5.3 you've already got a part of what you need because the "Source Control Enablement for Domino Designer" comes with DDE 8.5.3. What you'll need to get and install is a project by Nathan Freeman on OpenNTF called EGit for Domino Designer and install that just as you would any eclipse plugin. Also, you'll need a git server to store your code on. For a while I was using github which allows for unlimited (I think) public repositories. There is also BitBucket which allows for unlimited private repositories but you can also have public repositories. I recently moved all my repositories over to BitBucket because of the private repositories (Thanks David!). Both of these services are free, so it won't cost you anything.
Now you've installed the EGit plugin and created your github or BitBucket account and you're ready to put some of your applications in the SCM. I always start with making a new repository on the server. And then clone that repository on your local machine. You should have a "Git Repositories" tab somewhere in DDE. If you don't have that tab you can add it by going to Window\Show Eclipse Views\Other and scroll down to the Git category, select "Git Repositories" and click add. Once you have that you can clone a repository to your local machine:
Once you do that you should get this dialog:
To find that URI go to your github or BitBucket account and open the repository and that URL should be somewhere on that page. Copy it and paste it into the URI field (all the other fields will be filled in automatically) and enter your SCM server username and password and click Next. Then just follow the prompts accepting the defaults:
Your new repository should now show up in DDE in the Git Repositories Tab:
Now, to add an nsf to this new repository. In DDE, open an application and navigate to the "Package Explorer" tab. Find the application you want in the SCM and right click on it and navigate to "Team Development\Setup Source Control for this Application" and you will be presented with a wizard. Just follow the prompts for that accepting the defaults after defining a project name on the 2nd card of the wizard:
Once you click finish, an "On Disk" version of the NSF will be created and be visible in the Package Explorer. If you look in this file, you'll see all the things you would expect to see there and it is the entire design of the nsf, all the resources, java files (if any are created), forms, views, custom controls, xpages, etc, everything. Now, right click that "On Disk" version and select Team\Share:
You will then be presented with a dialog to pick the repository you want to place this "On Disk" file in:
Once you select your new repository, click finish. Then Right-Click the "On Disk" file again and select Team\Commit, select all the files in the resulting dialog, enter a comment (won't allow a commit without a comment) and then OK and the files will be copied into the repository.
This will copy/merge your changes into the repository and you can see it by navigating to your "Git Repositories" tab, right click the repository and navigate to the "Working Directory" entry:
We're almost there now. At this point you won't see this change reflected on the website which hosts your SCM server. You'll need to navigate to the "Git Repositories" tab, right click the repository and select "Push to Upstream" and click OK in the resulting dialog. This will send your changes to the server. If you're working on a team, use "Fetch from Upstream" to get the changes they made:
You should now be able to see your changes on the SCM website.
In the next post I'll show how to create a new application from a git repository.