At this point, having completed module 1 and module 2, we have an SVN server, a repository in that server and we have files/directories in that repository. The whole point of this is to share files and version control them between different users. The next step then, is for you to check out the files from the repository. From here we can simulate another user checking out the files from that same repository. In this way we can see and learn how SVN deals with two people editing the same set of files at the same time.
In the last module we created two user accounts (user1 and user2). With your first user account then (the one that you just used to import the files) we’ll check out our set of files from the repository. Once checked out we’ll have a local copy of the files under SVN version control.
First then, In a directory create a new folder where you’ll check the repository contents out to.
It’s important that we don’t drill down into this folder. We want to check the contents of our repository out into this folder. So we right click on this folder and select ‘SVN Checkout…’
From here we’ll specify the location of the repository that we want to check our files out from. So something like…
If you’ve forgotten what this URL is then you can go back to the VisualSVN server app and right click to select ‘Copy URL to Clipboard’.
Enter this value in the ‘URL of repository’ field. Checkout directory should already be defined, along with the parameters ‘Fully Recursive’ and ‘Head Revision’
Once you’ve clicked on ‘OK’ you should see confirmation that the files have been checked out to your directory.
And you should see a nice green tick against the folder indicating that the contents of that folder are in sync with the repository (which they should be because they’ve only just been checked out).
Drill into that folder and you’ll see the individual sub folders and files with the same green tick to indicate that they are in sync too.
Now we have the contents of the repository copied locally we’ll want to modify a file and check the files changes back into the repository. Check the changes into the repository so that the repository contains the latest versions of the files for everyone else to use.
Checking in your first change
At this point then we want to modify one of our files locally and update the repository with that change. So edit one of the text files and save your changes.
You’ll notice that once you’ve saved the changes the icon against the file changes from a green tick to a red exclamation mark. This shows us that our local file is no longer in sync with the repository.
At this stage then we need to update the repository with our changes. Right click on the file and select ‘SVN Commit….’
At this point Visual SVN will prompt you to enter a message explaining what the change was about. This is useful for other users who see the file has changed and will get to see some summary info about what the change was for.
The ‘Changes made’ section shows you which file you’re updating and what you’ve done with that file (e.g. modified it, added a new file or deleted an existing file). After you’ve clicked OK you’ll see the confirmation message showing that the commit has finished:
This confirmation message also shows you which version you’re now working with. SVN has incremented the version of your file (NOT the repository… just the file) to the next logical revision, revision 2.
If you want to review what’s happened to your files then you can check this by selecting the top level parent folder and clicking on the Visual SVN ‘Show log’ option.
The resulting dialogue box showing you a history of all the changes for your local files.
You can see the same information if you go back to the SVN server and check the repository on the server. Viewing that repository using a browser you should see something like this…
And viewing the individual files you can see the exact revision of each file
This is all very well but the whole point of this version control system is to share and collaborate on projects. So what happens when another user updates the file and your local copy becomes out of sync? That’s what we’ll look at in a future module when we cover updating, merging and conflicts.