Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now that we've got Subversion installed, let's create a repository and then a project inside that repository. Creating a repository in Subversion is easy, use the svnadmin command. So we're going to say svnadmin create c:\svn\r1, r1 is the name of the repository you want to create. You don't have to create it inside the SVN directory, but it's a convenient way to make it easy to back up all the repositories by simply backing up the SVN directory. Next step, we need to create a project.
Project setup in Subversion can appear to be somewhat complex, but once you have learned how to do it, it's the same every time. There is a set of conventions that are commonly used so that if you move from one group to another that's using some version, you'll see the same kind of pattern being used because it makes it easy to do branches and tags and keep track of which is the trunk. So, I always name my projects, as you know XXX-YYY, where XXX is the name of the repository and YYY is the name of the project.
So then I know just by being in the project directory where everything is located. So we'll create the project by saying svn mkdir and then create the URI and then use the URI for our repository r1/r1-p1 and then we'll create a commit message for that, "Create project p1". All right. Our project is now there. Now as I mentioned, using SVN is the convention regarding how the project directories are set up.
This involves creating three specific directories, one called branches, one called tags, and one called trunk. If you have an existing directory of source code, what I would suggest you do is go there, create these three directories, and then move the original contents of your directory into the trunk subdirectory before doing the import. Since we don't have an existing directory, we're going to create this directory structure and import it into Subversion. So we're going to go into the temp directory, and we're going to make a directory called r1-p1, and then we're going to go in there and create the subdirectories, so it should look like that.
Now, we're going to import that into Subversion by using svn import, and in this case, I'm not going to put the -m because I'm going to show you how the editor's invocation works because we did that set SVN_EDITOR=notepad , and so here it's going to open up Notepad. You'll see that there is a line that says --This line, and those below, will be ignored--. That shows you the status of all the things you're doing. Any line or lines you put before that are your commit message. So we're going to put Import structure of project p1 and then when we save that and quit Notepad, it automatically adds it to the Subversion repository.
Now in our case, since we did it from a temporary directory, we can go ahead and go back to the root and delete that temporary directory. And now finally, we want to change directory to the place where we want the working set to live. In this case, I'm going to do it at the root of the C drive, but you may want to put it inside of a directory called work or div, or wherever you keep your source code. Note that this is different than your original directory if you had files in it. You can put it in that same place, but remember your original directory with files is not part of Subversion, it's not being tracked for source code control, so you need to create a new directory using Subversion that has not only your files, but also some metadata that allows Subversion to track your changes.
So in our case, we're going to svn co--now CO is short for checkout. Subversion has long and short versions of many of the commands. In this case, CO stands for checkout. Another one I'll use quite a bit is CI, which is short for check in, which is actually short for the Subversion commit command. So we're going to check out our svn repository 1, repository 1, project 1, and what this is going to do is not only create a C:\r1-p1 directory, it's also going to collect all the data from the repository, including any files we had in the trunk directory and put them in there and tell Subversion to start tracking them.
So now if we go and cd to r1-p1, you can see that there is our subdirectory structure that we wanted to have. Now in order to be able to ask the Subversion if it's really tracking this, we can say svn log -v, and now we can see the entire log. First, you'll see revision 2 says that changed these paths, and so revision 1, we actually created the subdirectory for project p1. So that's all there is to creating a repository and a project.
You can easily create additional projects inside this repository, you simply skip the first SVN admin command and then just start with the svn mkdir command for creating your additional projects. Let's move on to adding some files in there and do some check ins and check outs.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 104276 Viewers
56 Video lessons · 116204 Viewers
71 Video lessons · 85422 Viewers
131 Video lessons · 40901 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.