Using Carbide C++ 2.0 with CVSNT server
Using Carbide C++ v2.0 with CVSNT - Johnson Mathew Easow - email@example.com
1. Install Carbide C++ (Available free from forum.nokia.com) 2. Install CVSNT server (Available free from cvsnt.org)
1. Create a new user in your system (You can use an existing user with admin privileges if you want). This will be the user through which you will be communicating with the CVSNT server. For example, let’s create a user called Albert. Right click on My Computer. Select Manage.
2. Now you will have to create a repository folder. This is the root folder of CVSNT server’s database. For example, create a folder like c:\cvsrepos.
3. Add an environment variable (My Computer->Properties->Advanced->Environment variables) called CVSROOT and give the value of this variable, as the path of your newly created repository folder (c:\cvsrepos).
4. Open a command prompt (Start->Run->cmd).
5. Here you will have to tell the CVSNT server about the new folder you created for repository. Type cvs -d <repopath> init , where <repopath> will be the newly created repository folder path. For example, c:\cvsrepos. This will initialize the repository folder and you can see the newly created CVSROOT folder inside the repository folder. The CVSROOT folder stores all the configuration information for your repository.
6. Now create a new cvs user for using the repository with the CVSNT server. You will have to use the same name of the user which you created in step 1. Type the following in the command prompt. cvs passwd -a <username> . For example cvs passwd -a Albert Now, CVSNT server will ask for a password. Enter a password. Confirm the same.
7. Now you need to connect the system user with the cvs user you just created. For this, type the following in the command prompt. cvs passwd -r <username> . Remember to use the same user name you used in last step. It will again ask for a password. Give the same password which you gave in the last step.
8. Close the command prompt.
By this time, you have installed CVSNT server, created a repository and initialized it, created a username and password to connect to the CVSNT server with appropriate protocol (For ex: pserver). Note that you have not installed any CVSNT client yet. You don’t need one, as you will be using Carbide C++ for communicating with the server.
Importing an existing project to CVS:
You may have an existing project some where else in your system which you want to bring under CVS control. Here are the steps to do the same. For example, think that your existing project folder is in C:\MyProjects\HelloWorld
Open a command prompt and navigate to the project folder (ex: cd C:\MyProjects\HelloWorld). Now type the following in the command prompt.
cvs import -m "sample log" < repopath > <vendor> <initial tag>
“sample log” is for an entry in the log file (mandatory, I think), <repopath> is your repository path (ex: c:\cvsrepos), <vendor> is the vendor id (ex: myself), <initial tag> is the label for the imported sources. I will talk about tags in a short while. For now, give as “First”
In our example this will be like the following. cvs import -m "sample log" c:\cvsrepos Myself First
This will import your existing project to CVS database.
Importing a CVS project to Carbide C++:
1. Open Carbide C++. Go to File->Import. Expand “CVS” folder and select “Projects from CVS”. Click Next.
2. In the next screen, give host as “localhost”. If you are in a domain or a network, give your hostname. (In a command prompt, type hostname to find this out.)
3. Give the <repopath> (ex: c:\cvsrepos) in the Repository path field.
4. Give the <username> (ex: Albert) in the User field. Give the <password> you created for this user in the Password field.
5. Select connection as pserver. Select Use default port.
6. Click Next.
7. In the next screen, you will have to specify the project name. To select the project you just imported to CVS database, select, Use an existing module checkbox.
8. Your project in the CVS will be listed and select the top most folder. (Ex: HelloWorld)
9. Click Next.
10. In the next screen, you will be provided with the option of how to checkout the project. You can create a new project or you can use the existing workspace. In our example, we import to the existing work space. Select, Checkout as a project in the workspace.
11. Remember to select the Checkout subfolders check box. This is selected by default.
12. Click Next. Again Next. And then Finish. Your project will be now imported to Carbide workspace. You can expand the project folder the in Project Explorer to see the files and their versions.
At any given moment, the state of your project folder (its files, their versions), can be given a label (a Tag in the CVS). This label enables you to restore a particular state of your project. Take a look at the following scenario.
Helloworld basic - Tagged as First. Helloworld with theme support – Tagged as Second. Helloworld with theme, scalability support – Tagged as third.
Now, if you want to switch the project state from Helloworld with theme, scalability support to Helloworld basic, you can load the state from the CVS by selecting the First tag. I will show you how to do that, shortly. So when you do that, all your files and folders will get revert back to their versions which was at the time of tagging the project as First.
Usually, it is a practice to tag the project whenever one new feature is added or after some major bug fixes. By doing this, you are ensuring that you can always revert the project state back, if something goes wrong in future development.
Playing around with the project:
• Open a file and modify it. In the Project Explorer this will be indicated by using a > • For committing any changes to the CVS, right click on the project, select Team->Commit. Enter a comment for this commit so that when you take the history of the element, you can see the comment for each version.
• Now, right click on the project, select Team->Tag as version and give a tag to the current state. • Do a second set of changes to the file and commit once you are done. • Now, if you want to revert back to the state before you did the second set of changes, right click on the project, select Team->Switch to another branch or version, and select the respective tag of your choice. All your files, folders will get switched to the corresponding versions which they had at the time of marking this tag.
Backing up the project manually:
Select, File->Export->General->Archive File and give the file name and location. This will export the current set of the project files and folders to the specified zip file.
You can export in so many formats, as you can see in the File->Export dialog.
Try all for more FUN ;-) .
NB: Please note that you can do a lot of things with the CVSNT and Carbide C++. I have covered only the basics, necessary to run a project. Read the CVSNT manual and Carbide C++ user guide for more details.