1
edit
Changes
SVN
,no edit summary
::For a complete guide: [http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.diff.html http://svnbook.red-bean.com/en/1.2/svn.ref.svn.c.diff.html]
= Create SVN Repositories on Local Machine =
Because I struggled way too much to figure this out (possibly because I couldn't access the SVN book when i wanted to figure out how to do this), here is a quick rundown on how to create SVN repositories on the local machine.
Prerequisites? [http://subversion.tigris.org/project_packages.html Subversion] obviously...
It is probably a good idea to have a centralized area to house all of the repositories that you may want to create, so first you must do that. For me (and for the purposes of this guide), I will house all of the repositories in the directory: ''C:\svn\repositories''. So here's some commands you can use to create the directory structure:
> cd C:\
C:\> mkdir svn
C:\svn> cd svn
C:\svn> mkdir repositories
C:\svn> cd repositories
C:\svn\repositories>_
OK. Now it's time to create your repository. Let's say you want to create a repository called ''MyFirstRepository''. You can do that by executing this command:
C:\svn\repositories> svnadmin create MyFirstRepository
That command creates a new repository that is initially empty and starts at revision 0. In the ''repositories'' directory, you should now see a directory called ''MyFirstRepository''. If you change to this directory, you should see a directory structure similar to this:
MyFirstRepository/
|-conf/
|-authz
|-passwd
|-svnserve.conf
|-dav/
|-db/
|-<bunch of subdirectories and files in here>
|-hooks/
|-<bunch of files in here>
|-locks/
|-<bunch of files in here>
|-format
|-README.txt
Now, you have two options (that I know of):
* Checkout the repository
* Import an existing project to that new repository
''' Checkout the repository '''
For the purposes of this part of the guide, let's say you want to checkout the repository to the desktop ergo your present working directory is the Desktop (i.e.: C:\Documents and Settings\[Username]\Desktop). To do this, issue this command:
> svn checkout file:///C:/svn/repositories/MyFirstRepository/
This will checkout the repository. You should now see a folder called ''MyFirstRepository'' on the Desktop.
Note the 3 forward slashes that qualify the protocol name and forward slashes between directories.
As stated before, it is a good idea to structure your repository to have different folders for branches, tags, and the trunk. So, assuming your present working directory is the Desktop, to set up the repository structure, do something like this:
> cd MyFirstRepository
> mkdir branches tags trunk
> svn add *
> svn commit -m "set up repository structure"
''' Import an existing project to that new repository '''
For the purposes of this part of the guide, let's say you have a project located in ''C:\project'' that you want to add to the SVN repository ''MyFirstRepository''. Here's how you can do that:
> svn import "C:\project" "file:///C:/svn/repositories/MyFirstRepository" -m "import project to repository"
This command should add everything in ''C:\project'' to the repository and commit the changes. Now, you can checkout the repository using the command:
> svn checkout file:///C:/svn/repositories/MyFirstRepository/
and you will see all of the project files you imported beforehand being checked out.
Notes: If there are spaces in the repository path or name, or path to project, you may need to enclose it in quotes for the commands to work. Thus, it is better if there are no spaces in the names and paths.
''' Additional Information '''
If you want to control access to the repository, specify the users that can access a repository, there are a couple of configuration files located in the ''conf'' directory that you can edit.
'''svnserve.conf'''
The first one, svnserve.conf, has a couple of options that you can uncomment to control access to the repository. They are:
anon-access = read # anonymous users may have read access to the repository
auth-access = write # authenticated users may have write access to the repository
# a third option, none, means they have no access to the repository
password-db = passwd # Specify the location of the password database file.
# This file lists the name and password for each user of the repository
authz-db = authz # Specifies the location of the authorization rules file.
# This file is used to define access permissions for individual users of the repository.
All of these options are commented out by default.
'''passwd'''
This file houses a list of names and passwords for each user of the repository. An example passwd file may look like this:
[users]
user1 = password1
user2 = password2
=References=
*[http://svnbook.red-bean.com/en/1.2/svn.branchmerge.maint.html SVN Branch MaintananceMaintenance]
*[http://svnbook.red-bean.com/en/1.1/ch03s05.html Basic Work Cycle]