Size: 7349
Comment:
|
← Revision 27 as of 2008-02-20 18:51:07 ⇥
Size: 8312
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
[:What Is Subversion For: << Previous Page] [SVNKit Architecture: Next Page >>] |
[[Main]] + [[What_Is_Subversion_For|What Is Subversion For]] .- Setting Up A Subversion Repository .+ [[SVNKit_Architecture|SVNKit Architecture]] .+ [[Getting_Started_With_SVNKit|Getting Started With SVNKit]] .+ [[Authentication]] .+ [[Managing_Repository_With_SVNKit|Managing Repository With SVNKit]] .+ [[Printing_Out_A_Subversion_Repository_Tree|Printing Out A Subversion Repository Tree]] .+ [[Printing_Out_File_Contents|Printing Out File Contents]] .+ [[Printing_Out_Repository_History|Printing Out Repository History]] .+ [[Committing_To_A_Repository|Editing operation: committing to a repository]] .+ [[Updating_From_A_Repository|Editing Operation: receiving changes from a repository]] .+ [[Replicating_An_Existing_Repository|Replicating An Existing Repository]] .+ [[Managing_A_Working_Copy|Managing A Working Copy]] |
Line 4: | Line 16: |
[[TableOfContents]] | ---- <<TableOfContents>> |
Line 7: | Line 21: |
Up to now a [http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.backends Subversion repository storage] can be represented by either a [http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.backends.bdb Berkley DB database] (mostly reffered as ''Berkley DB'' type) or by an [http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.backends.fsfs ordinary filesystem] |
Up to now a [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.backends|Subversion repository storage]] can be represented by either a [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.backends.bdb|Berkley DB database]] (mostly reffered as ''Berkley DB'' type) or by an [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.backends.fsfs|ordinary filesystem]] |
Line 13: | Line 27: |
A Subversion distribution package (it can be downloaded from the [http://subversion.tigris.org Subversion home site]) includes a tool called __svnadmin__ which is responsible for creating repositories. When you install Subversion you |
A [[Subversion]] distribution package (it can be downloaded from the [[http://subversion.tigris.org|Subversion home site]]) includes a tool called '''svnadmin''' which is responsible for creating repositories. When you install [[Subversion]] you |
Line 16: | Line 30: |
Line 19: | Line 34: |
Line 21: | Line 37: |
Line 24: | Line 41: |
Line 25: | Line 43: |
Line 36: | Line 55: |
Read [official instructions | http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html] how to create and set up a repository on your computer using official Subversion tools. !!!Creating a Subversion repository with SVNKit __SVNKit__ provides an ability to create only FSFS-type repositories. The following is a code snippet which demonstrates how you can create a blank repository using __SVNKit:__ [{Java2HtmlPlugin |
Read [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html|official instructions]] how to create and set up a repository on your computer using official [[Subversion]] tools. = Creating a Subversion repository with SVNKit = [[SVNKit]] provides an ability to create only FSFS-type repositories. The following is a code snippet which demonstrates how you can create a blank repository using [[SVNKit]]: {{{#!java |
Line 46: | Line 67: |
Line 48: | Line 70: |
SVNURL tgtURL = SVNRepositoryFactory.createLocalRepository( new File(tgtPath), true , false ); } catch(SVNException e) { |
SVNURL tgtURL = SVNRepositoryFactory.createLocalRepository( new File( tgtPath ), true , false ); } catch ( SVNException e ) { |
Line 52: | Line 74: |
Line 53: | Line 76: |
}] This will create an FSFS-type repository at path ''C:/repos/root/path''. The second parameter of the ''createLocalRepository(...)'' method set to ''true'' enables modifications to [revision properties | http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.revprops] of the |
}}} This will create an FSFS-type repository at path {{{C:/repos/root/path}}}. The second parameter of the {{{createLocalRepository(...)}}} method set to {{{true}}} enables modifications to [[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.html#svn.reposadmin.basics.revprops|revision properties]] of the |
Line 59: | Line 83: |
[hook script | http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks] file into the ''hooks'' directory (see the repository root directory layout above). When someone is trying to change a revision property, a server (say, [svnserve | http://svnbook.red-bean.com/nightly/en/svn.serverconfig.svnserve.html]) |
[[http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks|hook script]] file into the ''hooks'' directory (see the repository root directory layout above). When someone is trying to change a revision property, a server (say, [[http://svnbook.red-bean.com/nightly/en/svn.serverconfig.svnserve.html|svnserve]]) |
Line 64: | Line 90: |
Line 66: | Line 93: |
until you place a ''pre-revprop-change'' hook manually into the target ''hooks'' directory. With __SVNKit__ enabling changes to revision properties is quite straightforward. When the second parameter of the ''createLocalRepository(...)'' method is ''true'' __SVNKit__ places an empty executable ''pre-revprop-change'' hook script into the ''hooks'' |
until you place a ''pre-revprop-change'' hook manually into the target ''hooks'' directory. With [[SVNKit]] enabling changes to revision properties is quite straightforward. When the second parameter of the {{{createLocalRepository(...)}}} method is {{{true}}} [[SVNKit]] places an empty executable ''pre-revprop-change'' hook script into the ''hooks'' |
Line 70: | Line 99: |
However when this parameter is ''false'' no hook script is added (but only templates), and revision properties changing | However when this parameter is {{{false}}} no hook script is added (but only templates), and revision properties changing |
Line 72: | Line 101: |
The third parameter of the ''createLocalRepository(...)'' method controls whether a repository creation must be forced or not. That is, if this parameter is ''true'' and the specified path already exists __SVNKit__ replaces it with a new repository. However if it's ''false'', an existing path (whatever it is) is not removed and a new repository creation fails with an [SVNException | http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/SVNException.html]. If a repository is successfully created the ''createLocalRepository(...)'' method returns a ''file:///'' url of the |
The third parameter of the {{{createLocalRepository(...)}}} method controls whether a repository creation must be forced or not. That is, if this parameter is {{{true}}} and the specified path already exists [[SVNKit]] replaces it with a new repository. However if it's {{{false}}}, an existing path (whatever it is) is not removed and a new repository creation fails with an [[http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/SVNException.html|SVNException]]. If a repository is successfully created the {{{createLocalRepository(...)}}} method returns a {{{file:///}}} url of the |
Line 76: | Line 107: |
Also you may create an FSFS-type repository with [SVNAdminClient | http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/SVNAdminClient.html] - the class belonging to the high-level API. Actually this admin client class uses [SVNRepositoryFactory | http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepositoryFactory.html] |
Also you may create an FSFS-type repository with [[http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/SVNAdminClient.html|SVNAdminClient]] - the class belonging to the high-level API. Actually this admin client class uses [[http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/io/SVNRepositoryFactory.html|SVNRepositoryFactory]] |
Line 79: | Line 110: |
[{Java2HtmlPlugin | {{{#!java |
Line 88: | Line 120: |
SVNURL tgtURL = adminClient.doCreateRepository( new File(tgtPath), null , true , false ); } catch(SVNException e) { |
SVNURL tgtURL = adminClient.doCreateRepository( new File( tgtPath ), null , true , false ); } catch ( SVNException e ) { |
Line 93: | Line 125: |
}] !!!Accessing a repository There are two ways of accessing a Subversion repository: * over a network * on a local machine [{Image src = 'Subversion_Architecture.png' caption = 'Subversion Access Schemes' }] Up to now Subversion supports the following repository access schemes: ||Schema||Access Method |file:///|direct repository access (on a local disk) |http://|access via WebDAV protocol to Subversion-aware Apache server |https://|same as http://, but with SSL encryption |svn://|access via custom protocol to an svnserve server |svn+ssh://|same as svn://, but through an SSH tunnel !!file:/// access |
}}} = Accessing a repository = There are two ways of accessing a [[Subversion]] repository: * over a network * on a local machine {{attachment:Subversion_Architecture.png}} Up to now [[Subversion]] supports the following repository access schemes: ||<:#E0E0FF>Schema||<:#E0E0FF>Access Method|| ||{{{file:///}}}||direct repository access (on a local disk)|| ||{{{http://}}}||access via WebDAV protocol to Subversion-aware Apache server|| ||{{{https://}}}||same as {{{http://}}}, but with SSL encryption|| ||{{{svn://}}}||access via custom protocol to an svnserve server|| ||{{{svn+ssh://}}}||same as {{{svn://}}}, but through an SSH tunnel|| == file:/// access == |
Line 108: | Line 146: |
located on the same computer. Subversion will use only a user name in commit operations: if no user name is provided | located on the same computer. [[Subversion]] will use only a user name in commit operations: if no user name is provided |
Line 110: | Line 148: |
!!svn://, svn+ssh:// access To use the ''svn://'' protocol an administrator configures access rules and accounts that will be used by an __svnserve__ program to authenticate users. ''svn+ssh://'' protocol: first a client authenticates himself to a host |
== svn://, svn+ssh:// access == To use the {{{svn://}}} protocol an administrator configures access rules and accounts that will be used by an '''svnserve''' program to authenticate users. {{{svn+ssh://}}} protocol: first a client authenticates himself to a host |
Line 114: | Line 153: |
machine. You may try either technique, details are described in [this chapter | http://svnbook.red-bean.com/nightly/en/svn.serverconfig.svnserve.html] | machine. You may try either technique, details are described in [[http://svnbook.red-bean.com/nightly/en/svn.serverconfig.svnserve.html|this chapter]] |
Line 116: | Line 155: |
!!http://, https:// access To use the ''http:// '' protocol an dministrator configures an Apache server with a WebDAV protocol extension module. How to share your repository access over ''http:// '' (including account configuration tips), please, be sure to read the [Apache dedicated chapter | http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html] of the Subversion |
== http://, https:// access == To use the {{{http://}}} protocol an dministrator configures an Apache server with a WebDAV protocol extension module. How to share your repository access over {{{http://}}} (including account configuration tips), please, be sure to read the [[http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html|Apache dedicated chapter]] of the [[Subversion]] |
- - Setting Up A Subversion Repository
Contents
Subversion repository types
Up to now a Subversion repository storage can be represented by either a Berkley DB database (mostly reffered as Berkley DB type) or by an ordinary filesystem (mostly reffered as FSFS type).
Creating a Subversion repository manually
A Subversion distribution package (it can be downloaded from the Subversion home site) includes a tool called svnadmin which is responsible for creating repositories. When you install Subversion you can create a repository performing a command in the command prompt:
...>svnadmin create C:\path
This will create an FSFS repository at the path you specify. You may also explicitly provide the type of a repository back-end:
...>svnadmin create --fs-type bdb C:\path
The layout of a repository root directory looks like this:
/ |_conf/ |_dav/ |_db/ |_hooks/ |_locks/ |_format |_readme.txt
Read official instructions how to create and set up a repository on your computer using official Subversion tools.
Creating a Subversion repository with SVNKit
SVNKit provides an ability to create only FSFS-type repositories. The following is a code snippet which demonstrates how you can create a blank repository using SVNKit:
1 import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
2 import org.tmatesoft.svn.core.SVNURL;
3 import org.tmatesoft.svn.core.SVNException;
4 ...
5
6 try {
7 String tgtPath = "C:/repos/root/path";
8 SVNURL tgtURL = SVNRepositoryFactory.createLocalRepository( new File( tgtPath ), true , false );
9 } catch ( SVNException e ) {
10 //handle exception
11 }
12
13 ...
This will create an FSFS-type repository at path C:/repos/root/path. The second parameter of the createLocalRepository(...) method set to true enables modifications to revision properties of the created repository. As revision properties are unversioned, there's a risk to lose their values forever if changes to them are allowed. To allow revision properties changing you have to place an executable pre-revprop-change hook script file into the hooks directory (see the repository root directory layout above).
When someone is trying to change a revision property, a server (say, svnserve) first invokes a pre-revprop-change hook. If this hook script is not found in the hooks directory, or the script returns a non-zero value, modifications to revision properties are rejected by the server.
When you create a new repository with the Subversion's svnadmin tool a new repository's hook directory contains no real hook files, but only hook templates. This means that you won't be able to change revision properties until you place a pre-revprop-change hook manually into the target hooks directory.
With SVNKit enabling changes to revision properties is quite straightforward. When the second parameter of the createLocalRepository(...) method is true SVNKit places an empty executable pre-revprop-change hook script into the hooks directory of a new repository. Such a hook does nothing, simply returns 0 letting the requested change operation perform. However when this parameter is false no hook script is added (but only templates), and revision properties changing is disabled.
The third parameter of the createLocalRepository(...) method controls whether a repository creation must be forced or not. That is, if this parameter is true and the specified path already exists SVNKit replaces it with a new repository. However if it's false, an existing path (whatever it is) is not removed and a new repository creation fails with an SVNException.
If a repository is successfully created the createLocalRepository(...) method returns a file:/// url of the repository root location. Also you may create an FSFS-type repository with SVNAdminClient - the class belonging to the high-level API. Actually this admin client class uses SVNRepositoryFactory to do the same job.
1 import org.tmatesoft.svn.core.wc.admin.SVNAdminClient;
2 import org.tmatesoft.svn.core.SVNURL;
3 import org.tmatesoft.svn.core.SVNException;
4 ...
5 SVNAdminClient adminClient;
6 ...
7 try {
8 String tgtPath = "C:/repos/root/path";
9 SVNURL tgtURL = adminClient.doCreateRepository( new File( tgtPath ), null , true , false );
10 } catch ( SVNException e ) {
11 //handle exception
12 }
13 ...
Accessing a repository
There are two ways of accessing a Subversion repository:
- over a network
- on a local machine
Up to now Subversion supports the following repository access schemes:
Schema |
Access Method |
file:/// |
direct repository access (on a local disk) |
http:// |
access via WebDAV protocol to Subversion-aware Apache server |
https:// |
same as http://, but with SSL encryption |
svn:// |
access via custom protocol to an svnserve server |
svn+ssh:// |
same as svn://, but through an SSH tunnel |
file:/// access
This protocol does not require you to set up a user account for the repository to work with since the repository is located on the same computer. Subversion will use only a user name in commit operations: if no user name is provided explicitly, a session user name is used.
svn://, svn+ssh:// access
To use the svn:// protocol an administrator configures access rules and accounts that will be used by an svnserve program to authenticate users. svn+ssh:// protocol: first a client authenticates himself to a host server over an ssh, a tunneled connection is established and further he works with a repository just like on a local machine. You may try either technique, details are described in this chapter of the Subversion book.
http://, https:// access
To use the http:// protocol an dministrator configures an Apache server with a WebDAV protocol extension module. How to share your repository access over http:// (including account configuration tips), please, be sure to read the Apache dedicated chapter of the Subversion book.