Lab SVN/NetBeans

draindecorumSoftware and s/w Development

Aug 15, 2012 (5 years and 11 months ago)


SVN – (Apache) Subversion
Short overview
- Revision control system
- Successor to CVS (Concurrent Versions System)
- Available as a shell-client, extension for the windows explorer (TortoiseSVN), integrated in
NetBeans (Team-menu -> Subversion), …
- Many advantages, e.g.
o Source code is stored centralized on a server
o Each team member can get the most recent version of a project
o Handles multiple users working on the same file(s) (merging)
o Keeps track of changes of a file – if your latest changes introduced a nasty bug, you
are able to get back to the version before
o You can split a project into different branches
o …
- Typical workflow
o Once
 One team member creates a project and imports it to an SVN-repository
 The other team members can now checkout the project
o Repeating
 Before you start working, update the
version of the project on his computer in
order to receive the latest changes
 Now you make your changes to the files
you are interested in
 Test your changes – does the project (at
least) still compile?
 Afterwards you will check the status of
the repository, to check if anyone else
has been working on the same file (use
“Show changes” in NetBeans)
• If conflicting changes have been made, you might run into trouble, it
is a good idea to use svn diff, which will show the differences
 If everything looks fine, you commit your changes, any other team member
who updates his local copy will now get your changes, if he or she wants to
commit changes done in the same file(s), he or she has to check the status
and might have to deal with merges and conflicts
- Important:
o Only commit working code
o Check before a commit, if conflicts might occur

See also:

Occurrence of a conflict

Things to try out now
You should create your own NetBeans-project; you might take the files for the collision-detection-
assignment. Choose your name or user-ID as name for the folder for your project (subfolder of the
NetBeans-project-folder); since you should import the folder/project into your group’s SVN
repository, it is good to use a name that will not conflict with other folders/projects in the repository.
After creating your project, you should import it into your group’s SVN. One way to do this is to right
click the project in NetBeans and select “Versioning -> Import into Subversion Repository…” from the
pop-up menu. By now, a system administrator should have sent you an email with the login
information to your group’s SVN, you will need this information now.
Note: You might have to install an SVN-client; in this case NetBeans will open a specific dialogue,
where you can probably just use the recommended setting.
After importing your project, you should try out different SVN-functions. These are hidden in the
Team (or Versioning) menu under Subversion or, if a file/project is already tracked by SVN, in a file’s
pop-up menu “Subversion”.
When you get the feeling to know enough about the basic functions, it would be interesting to create
some conflicts. If you have the luck to have other members of your team at the lab, you should
collaborate and decide on a file in the SVN, you all will start to edit. Try to do some commits and
observe what will happen. Try to create conflicts and then discuss how you may organize the future
work in your team in order to avoid conflicts.