常用的svn命令的一个简要介绍,很有用的:
CREATE REPOSITORY
$ svnadmin create /usr/local/svn/newrepos
IMPORT MODULE
$ svn import mytree file:///usr/local/svn/newrepos/fooproject
Adding mytree/foo.c
Adding mytree/bar.c
Adding mytree/subdir
Adding mytree/subdir/quux.h
Committed revision 1.
START STANDALONE SVN SERVER
svnserve.exe -d -r d:/temp/repos
STARTING SVN UNDER APACHE
DAV svn
SVNPath d:/Data/SVN
AuthType Basic
AuthName "Subversion repository"
AuthUserFile d:/Data/SVN/svn-auth-file
Require valid-user
Would be available using:
svn co http://ip:port/path/to/repo/
ENABLING SIMPLE AUTHORIZATION
1) create passw file:
htpasswd -cm d:/Data/svn-auth-file
add pass:
htpasswd -m d:/Data/svn-auth-file
2) create svn-policy-file file:
[groups]
project1-developers = anton, mike
project2 = anton, mike, peter
[project1:/]
@project1-developers = rw
[project2:/]
@project2-developers = rw
3) httpd.conf:
DAV svn
SVNPath d:/Data/SVN
AuthType Basic
AuthName "Subversion repository"
AuthUserFile d:/Data/svn-auth-file
Require valid-user
AuthzSVNAccessFile d:/Data/svn-policy-file
ENABLING SVN TRAFFIC COMPRESSION
It is required to invoke mode_deflate in httpd.conf:
DeflateBufferSize 8096
DeflateCompressionLevel 9
...
SetOutputFilter DEFLATE
SetInputFilter DEFLATE
DAV svn
SVNPath d:/temp/repos
AuthType Basic
AuthName "Subversion repository"
AuthUserFile d:/temp/svn-auth-file
Require valid-user
EXTRACTING ONE PROJECT FROM MULTIPROJECT REPOSITORY
1) Dumping repos:
svnadmin dump d:datasvn > repo-dump
or svnadmin dump myrepos --revision 100:200 > revs-100-200.dumpfile
2) taking 1 project from repo:
type repo-dump | svndumpfilter include project1 > project1-dump
3) removing root dir:
Node-path: project1
Node-action: add
Node-kind: dir
Content-length: 0
Replace all "Node-path: project1/" strings with "Node-path: "
4) creating repo:
svnadmin create d:datasvnproject1
5) restoring:
svnadmin load d:datasvnproject1 < project1-dump
6) browsing
svnlook tree d:datasvn
7) Configuring Apache:
SetOutputFilter DEFLATE
SetInputFilter DEFLATE
DAV svn
# any "/svn/foo" URL will map to a repository /usr/local/svn/foo
SVNParentPath d:/Data/SVN
AuthType Basic
AuthName "Subversion repository"
AuthUserFile d:/Data/svn-auth-file
Require valid-user
8) Switch all working copies to a new repository:
[to a new branch] svn switch http://newIP:newPort/path/to/repo
[to a new URL] svn switch --relocate http://oldIP:oldPort/path/to/repo http://newIP:newPort/path/to/repo
BERKLEY DB recovery
1) download appropriate bdb release from berkley site
2) build win tools usinn VC 6.0+
3) run db_recover -vec -h d:datasvnproject1
4) move _db files from d:datasvnbroker into d:datasvnproject1db folder
5) if fail problem persists, after 4th step do backup/restore svn repo:
svnadmin dump d:datasvnproject1 > project1.timestamp.dump
svnadmin create d:datasvnproject1
svnadmin load d:datasvnproject1 < project1.timestamp.dump