Checking out the Subversion repository with the svn client

At this point, we have a working Subversion repository; we can now check it out in a folder of our choice, which will become our working copy; in my case, I will use the C:Sources folder:

$ cd C:Sourcessvn
$ svn checkout file:///Repos/MySvnRepo

You now have a MySvnRepo folder under your Sources folder, ready to be filled with your project files; but first, let me remind you of a couple of things.

As you may know, a Subversion repository generally has the following subfolders structure:

  • /trunk, the main folder, where, generally, you have the code under development
  • /tags, the root folder of the snapshots you usually freeze and leave untouched, for example, /tags/v1.0
  • /branches, the root folder of all the repository branches you will create for features development, for example, /branches/NewDesign

Subversion does not provide a command to initialize a repository with this layout (commonly known as standard layout), so we have to build it up by hand.
At this point, we can import a skeleton folder that already contains the three subfolders (/trunk, /branches and /tags), with a command like this:

$ cd SourcessvnMySvnRepo
$ svn import /path/to/some/skeleton/dir

Otherwise, we can create folders by hand using the svn mkdir command:

$ cd SourcessvnMySvnRepo
$ svn mkdir trunk
$ svn mkdir tags
$ svn mkdir branches  

Commit the folders we just created and the repository is ready:

svn commit -m "Initial layout"  

Now, add and commit the first file:

$ cd trunk
$ echo "This is a Subversion repo" > readme.txt
$ svn add readme.txt
$ svn commit -m "Readme file"

Feel free to add even more files, or import an existing project if you want to replicate a more real situation; to import files in a Subversion repository, you can use the svn import command, as we already have seen before:

$ svn import MyProjectFolder

Later, we will add a tag and a branch to verify how Git interacts with them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.205.223