Synchronisation of code with Subversion and Netbeans

For the synchronization of code, you must be having an online repository or an offline one, on your intranet.. A very good example of online repository is assembla. You need to invite all the members of the project to this online repository..

now, I am giving u a short tutorial on how to configure assembla and svn with Netbeans..

  1. install netbeans 6.1.
  2. install collabnet subversion.. here you will be asked to register..
  3. open netbeans, open the versioning menu, click subversion, and then checkout..
  4. enter the home folder of the collabnet subversion.. it should be somthing like this.. D:\Program Files\CollabNet Subversion ..
  5. Restart Netbeans..
  6. again click on checkout, enter the url of your repository, it can be found here found at assembla home>Project Name>Trac/SVN>SVN url, and, your assembla username and password..
  7. then, browse the repository folder for Project Folder.. make sure that the scan for netbeans projects after checkout has been checked.. click on the open project which comes after checking out..

now, you will find that, a project has been created.. this is the project which all the team members will be using at the same time.. Team members will be editing it at their pcs and then uploading it to the repository..

Steps to follow, while adding the source code for the first time:

  1. Create a project in your netbeans.
  2. Configure the collabnet subversion as told above.
  3. Select the project in the projects tab.
  4. Click Versioning>Subversion>Import to repository.
  5. Provide the necessary settings, such as url, username and password.

Lets know about some svn commands (which can be found after right clicking the project>subversion..

Important Commands:

Show Changes: This command shows the changes between the code thats there in the repo, and that at your pc.. There can be 7 types of changes, locally new, locally modified, locally deleted, remotely new, remotely modified, and remotely deleted.. One special kind of Change can be local conflict.. This happens when 2 members edit one piece of code at the same time differently.. One example can be, if I edit ideas_controller.rb to something, and Amit edits it to something else, and then, I commit my code.. when I submit, there was no error.. but as soon as amit commits the code, an error creeps out, showing that Amit has been using an older version of the code.. this is called local conflict.. now, at this point of time, Amit has to resolve this conflict (it has to be manual, it can’t be computerized) .. One of the healthy practices is to have a look at the remotely changed files, and perform actions accordingly, like if a new migration is run, you must migrate your database to the current version (this you will come to know once u get acquainted with rails) …

Update: It updates the code at the pc, to the code at the repository.. Note that, locally modified changes can’t be updated..

Commit: It submits the code at ur PC to the code at repository.. Its important to commit only those file, which you have changed.. Files like, development logs, and PC specific settings (database configuration) and all, should be excluded from commit.. This can be achieved by Clicking commit, and selecting ‘exclude from commit’ in the Commit action..

Other Commands:

Diff: It shows the actual difference between the code at the repository and the code on ur pc..

Search History: It shows the actual history of a file, i.e, who has modified the file at what place..

It would be good, if youhave a look over here, how subversion works, and its file sharing operations..

You people must get acquainted with these tools, as these are inseparable from any kind of software development..

Comments (2)

Chris MylonasDecember 3rd, 2008 at 3:32 am

Perhaps you’ve come across this in your java projects, but I’ve imported to a repository a project. Created a 2nd project, no problems. 3rd and subsequent project, gone to the Versioning menu on NB6.1, tried to import to a repository my new project but it’s not an option.

I’ll trudge around the netbeans forums to see if there is a simple solution. If you know what’s going on that would be great to get your feedback.


ujjwalkumarDecember 4th, 2008 at 2:46 am

hi chris!

The same problem occurs with me also quite often. I would like to know if you have renamed a project and then importing. actually, if a project is renamed in netbeans, and if things don’t go properly, the repository properties (url, username and password) are taken from the initial project only. if thats the case, you don’t get any import into repository.

I have tested these things with java projects, as well as ruby on rails projects.

I would like to debug your problem if you provide me with necessary details. Also, it may be a bug in netbeans 6.1. Netbeans 6.5 is out and you can test if the problems persist in Netbeans 6.5 also.


Leave a comment

Your comment