Tortoise SVN Tutorial: Revisions In Code Repository

Learn to Make Revisions in Code Repository:

Our previous tutorial in this series explained, how to Set up a free server repository of your own and set up a Tortoise SVN UI client.

In this tutorial, we will be learning about how to use the Tortoise SVN client to check-out and check-in the code from/to repository. Read through this Entire Subversion Training Tutorials for a complete understanding of the concept.

Revisions in Code Repository

Revisions in Code Repository by Check-in/Checkout using TortoiseSVN

Let us open the Eclipse IDE.

** If you do not have Eclipse set up in your machine then you can refer here and that will help you in setting up eclipse.
** You can install java (Java Runtime Environment or JRE) from here.
** Once you install JRE, then you can install eclipse.

Install eclipse

Browse and select a place where you would like to create your workspace.

Select a place to create your workspace

Click Launch.

Click Launch

Click Workbench. Now inside this workspace, we will create a very simple java project (File => New =>Java Project).

Create a very simple java project

Mention the project name as seen below.

Mention project name

Click Finish. Select the src folder as shown below.

Select src folder

After selecting the src folder, right-click and further click on ‘New’ => Class.

Click ‘New’

Mention some class name (here ‘PracticeSVN’) and select the checkbox as ‘public static void main’.

Select the checkbox ‘public static void main’

Click Finish. Now in this class, let’s write a simple SOP (system.out.println) statement.

Simple SOP

Suppose we want to put this project into the server which is the common centralized repository for all the team members. In order to do this, the team members must know how to check-in the code inside the server and how to check-out (extract) the code from the server onto their local machine.

Let us see how the check-in works. We will now check-in the project that we have created above to the repository. Select your project and right-click it.

Check-in

Click Properties, and this will tell us the location of our project, select the location up to the ‘Workspaces’, right-click and then copy the location.

Copy the location

Just go to this location.

Figure 37 Just go to this location

Right click on your Project => click ‘TortoiseSVN’ => click Import (this means check-in into the repository).

Click Import

Mention the name of the repository URL.

Name of the repository URL

Click OK. This will connect your local machine to the server (you must be connected to the internet).

Connect local machine to the server

You will get the authentication screen in which you have to enter the same login credentials that you had created while creating a repository.

Authentication screen

Click OK, you will start seeing the files getting transferred to the repository and the import will complete in 4 minutes.

Import gets finished in 4 minutes

Click Ok. Now refresh the repository page. As shown below the project comes inside the server. At the bottom, we can see that the repository revision is at 1.

Refresh the repository page

Go inside the src folder, and you will find the PracticeSVN.java that we created.

PracticeSVN.java

Click PracticeSVN.java, and you will see the code that we had written.

Successfully checked-in code

Thus we have successfully checked in our code into the server repository.

Now we would like to do the opposite or bring the code back from the repository to our local machine. In other words, we would like to check-out the code from the repository. To do that, let us create a blank folder in our local machine and name it as ‘CheckoutSVN’.

Now right-click on this folder => ‘TortoiseSVN’ => ‘Export’.

Export

When you click ‘Export’ the below window comes up. The repository URL will be automatically populated. The export directory will show the location of the folder in your local machine where you would like to check-out the code.

Export directory

Click OK. The export starts and gets finished within 10 seconds (in this case).

Export Completed

Click OK

Go inside the folder ‘CheckoutSVN’, and you will see the contents of the repository. If you further go inside the src folder, you will see the java file that we had created. Thus our checkout is successful from the server repository to our local machine.

CheckoutSVN

Figure 50 checkout is successful

Conclusion

This tutorial explained the simple concept of SVN. We just have to install the Tortoise SVN client and check-out/check-in the code from/to the repository.

Thus in this tutorial, we have practically learned how to check-out the code from the repository and how can we check-in the updated code into the repository.

In the upcoming tutorial, we will learn how to delete the code content from the repository.

PREV Tutorial | NEXT Tutorial