We are a team of two developers developing PHP/MySQL applications. We've been using Netbeans/TortoiseHG for some time now, but as our projects do not cross, and development is fairly simple and straight forward, we've been using Mercurial mainly to have a central repository where both of us can find the latest version of whatever the other one is working on.
So far, the development path follow very simple steps:
As you can see, very simple and limited, but sufficient for our needs.
But now I'm working on a project that will require real version-control. In my case, this means that I will need to keep two separate and independent development paths, one for production and one for development:
My question is, how should I set up this project, from directory structure to NetBeans and TortoiseHG? What are the best practices?
By the way, I'm using NetBeans IDE 7.3 and TortoiseHG 2.7.1 with Mercurial-2.5.2
To give you a sense of where I am, I've played a little bit with branching in TortoiseHG but the results I got were not what I expected (I didn't get the two independent sets of files I hoped, as to work on them independently). I don't know if I was doing it wrong or if branching is not what I need.
So, having failed with branching and not knowing what to do, I thought about creating multiple folders/directories inside the same Netbeans project, one for each version and name each folder after its version (version1.0, version2.0, version3.0...). Then I would place the whole file structure of the project inside each of these folders and keep a manual control of the updates, i.e., after any change, I would manually copy the files from one "folder version" to another, as needed. But this looks so wrong in so many levels.
Based on what I wrote, can you tell me how to correctly approach this? What are the best practices? Or could you point me in the right direction where I can find tutorials explaining how to get there?
Thanks, S.
Thank you CosLu,
You placed me in the right path and now I understand how this works...
The branching is the way to go, but it does not create a second project in your NetBeans Environment. Instead, you have as many branches in TortoiseHG/Mercurial as you need, and only one of them at a time will show in your NetBeans environment.
In few steps, this is how I understand it works.
To work on a different path (branch) from the one that is currently active, simply go to TortoiseHG, right-click at the head of the branch you want to work, and select "Update". Click OK in the confirmation dialog box and you will be ready to go. In your NetBeans environment, your project will reflect that branch.
It's very important that you pay attention on which branch is active at that moment, so you do not make changes to the wrong branch.
The only part of this puzzle that I don't know yet is how do I commit selective changes from one branch to another. For example, if I make changes to my production system and want it reflected on my development one, without merging them, how do I do it? But this is beyond the scope of this question...