After creating and adding a project with Subversion the next step is to send the code and file modifications to it.
For this recipe we will need a Subversion server or an account from some Subversion provider, such as Sourceforge.
Configuring NetBeans accordingly to work with Subversion and a Java project are necessary for this recipe.
For explanations on how to create a Subversion account on Sourceforge and add a project to Subversion, refer to the Getting Ready section in the beginning of this chapter.
This recipe can also be used with a previously created project, in the case of on-going development.
Carry out the following steps in order to delete NBCookbookSVN.java:
.java
file and select Delete.In order to add a new class you will have to execute the following steps:
nbcookbooksvn
as Package and click on Finish.And finally, to commit the changes:
Adding and deleting a file are two distinct actions that are usually performed by Subversion in the command line.
So when we commit all changes we are not just sending the files to the server, but also deleting and creating new ones on it.
It works the same way whether only code is added, files modified or files deleted/created.
NetBeans highlights files with different colors depending on whether they are new, marked for deletion, or have modifications.
The colors are:
The same coloring scheme can be related to lines of code inside a file. Code lines can also be marked with blue, green, and red indicating the same behavior as explained in the bullet points above.
In the following screenshot NetBeans shows the archives that are synced with the server and not-modified with the blue icon.
Note that Person.java
is written in with a green color, since it is a newly added locally, and NBCookbookSVN.java
is marked as gray.
The little blue icon looking like a small glass means that changes (creation, modification, and deletion) have occurred to the indicated package.
Since Person.java
was not sent to the server, the file is shown without the blue icon.
Ways to track changes in the code the and NetBeans diff window are explained as follows.
Many times, changes to one particular feature in the project affect many different files. So many that it is hard to keep track of what has been changed.
To see the changes to the local files compared to the ones in the server is easy:
We can see which files were altered, the status of these files, and the path.
The icons placed on top of the Subversion view are there to help the developer filter the view of the changes.
The first three actions, represented by the icons (left to right) are:
These three icons will change the way the files are presented in the view.
The other four icons are:
They are responsible for the following actions (left to right):
So besides the previously mentioned way of committing changes to Subversion, this window provides another way of doing it.
The Diff window is where all the differences between the local copy and the copy on the svn server are shown.
It is possible to call this window by clicking on the Diff All button when Show Changes pane is on, or by right-clicking the project node then selecting Subversion and finally Diff.
The screenshot above shows those modifications and the path of each one of those. The left and right panes show the specific locations where modifications were made in both local and remote files.
3.137.167.107