1 SVN Introduction
SVN is the abbreviation for Subversion, is an open source version control system, compared to RCS, CVS, it uses the branch management system, its design goal is to replace CVS. Many version control services on the Internet have been transferred from CVS to subversion.
The SVN server operates in 2 ways: stand-alone servers and operate with Apache. Both ways have pros and cons, users can choose their own.
SVN stores version data in 2 ways: BDB (a Transaction-safe table type) and FSFS (a storage system that does not require a database). Because the BDB mode is likely to lock the data when the server is interrupted, it is safer to fsfs the way.
2 svn download
SVN client and server side: http://tortoisesvn.net/
3 Installation of SVN server
3.1 Linux environment installation and configuration
1) Installation
# Yum Install-y Subversion
2) Verifying the installation version
# Svnserve--version
3) Create the SVN repository, Project1 the repository name
# MKDIR/DATA0/SVN
# svnadmin Create/data0/svn/project1
4) Add user, format: User name = password
# VI/DATA0/SVN/PROJECT1/CONF/PASSWD
[Users]
Clevercode = 123456
Test1 = 123456
Test2 = 123456
5) Add access rights, Clevercode users to the Admin group, can read and write permissions to/data0/svn/project1 entire directory, TEST1,TEST2 users to the test group, only to/data0/svn/project1/ The test directory has read and write permissions
# Vi/data0/svn/project1/conf/authz
[Groups]
admin = Clevercode
Test = Test1,test2
[project1:/]
@admin = RW
[Project1:/test]
@test = RW
7) Configure svnserve.conf, this file must start with no spaces at the beginning of each line.
Configuration Description:
Anon-access: Controls the permissions of non-authenticated users to access the repository.
Auth-access: Controls the permissions of the authentication user to access the repository.
PASSWORD-DB: Specifies the user name password file name.
AUTHZ-DB: Specifies the permission profile file name through which path-based access control can be implemented.
Realm: Specifies the authentication domain for the repository, which is the name of the authentication domain that is prompted at logon. If the authentication domain of the two repositories is the same, it is recommended to use the same username password data file
# vi/data0/svn/project1/conf/svnserve.conf
[General]
#Anonymous access, can be read, write, none, default is read
Anon-access = None
#Authenticate user permissions,
can be read,write,none, default is write
auth-access = Write
Password-db =/data0/svn/project1/conf/passwd
Authz-db =/data0/svn/project1/conf/authz
8) Configure the firewall, SVN is 3690 port
# Vi/etc/sysconfig/iptables
-A input-p tcp-m state--state new-m TCP--dport 3690-j ACCEPT
# Service Iptables Restart
9) Start SVN,-D for background run,-r to specify root directory is/DATA0/SVN
# svnserve-d-R/DATA0/SVN
10) View SVN
# Ps-ef | grep SVN
3.2 Windows environment installation and configuration
After downloading the Windows Server side, follow the prompts, next in the next step, Windows is relatively simple, so no longer detailed description.
4 Use of SVN client
4.1 Linux Environment use
1. Checkout files to a local directory
SVN checkout Path (path is a directory on the server)
Example: SVN checkout Svn://192.168.1.1/pro/domain
Shorthand: SVN Co
2. Add a new file to the repository
SVN Add File
Example: SVN add test.php (add test.php)
SVN add *.php (Add all php files in the current directory)
3. Submit the changed files to the repository
SVN commit-m "LogMessage" [-n] [--no-unlock] PATH (use –no-unlock switch if hold lock is selected)
Example: SVN commit-m "Add test file for my test" test.php
Shorthand: svn ci
4. Locking/unlock
SVN lock-m "Lockmessage" [--force] PATH
Example: SVN lock-m "lock test File" test.php
SVN unlock PATH
5. Update to a version
SVN update-r m path
For example:
SVN update If there is no directory behind it, the default is to update all files in the current directory and subdirectories to the latest version.
SVN update-r test.php (Restore the file test.php in the repository to version 200)
SVN update test.php (updated, sync in Repository.) If the prompt expires at the time of submission, it is because of the conflict, you need to update, modify the file, then clear the SVN resolved, and then commit the commit)
Shorthand: SVN up
6. View file or directory status
1) SVN status path (status of files and subdirectories under directory, normal status not shown)
"?: not in SVN control; m: content has been modified; C: conflict; A: Scheduled to be added to the repository; K: Locked" M state is generally more
2) SVN status-v path (show file and subdirectory status)
The first column remains the same, the second column shows the work version number, and the third and fourth columns show the last modified version number and the modified person.
Note: The SVN status, SVN diff, and SVN revert three commands can be executed without a network, because SVN retains the original copy of the local version in. svn.
Shorthand: SVN St
7. Delete Files
SVN delete path-m "Delete test Fle"
Example: SVN delete svn://192.168.1.1/pro/domain/test.php-m "Delete test file"
Or go directly to svn delete test.php and then svn ci-m ' delete test file ', which we recommend using this
Shorthand: SVN (del, remove, RM)
8. View Logs
SVN log path
For example: SVN log test.php shows all changes to this file, and its version number
9. View File Details
SVN info Path
Example: SVN info test.php
10. Compare Differences
SVN diff path (compares the modified file to the base version)
Example: SVN diff test.php
SVN diff-r m:n Path (difference between version m and version N)
Example: SVN diff-r 200:201 test.php
Shorthand: SVN di
11. Merge the differences between the two versions into the current file
SVN merge-r m:n Path
For example: SVN merge-r 200:205 test.php (the difference between version 200 and 205 is merged into the current file, but generally conflicts occur and need to be addressed)
12. SVN Help
SVN help
SVN help CI
4.2 Windows environment uses
1) Download SVN's Windows client via official website, followed by.
2) Set up Project1 file, select Chinese parts Right click and choose "SVN Checkout".
3) then as used.
4) Enter the user and password. clevercode:123456.
5 Creating a local warehouse
The local repository was created to address the absence of an SVN server. Used directly locally in windows, applies to individual developers submitting code in native development. Not applicable to team development.
1) Create a local repository: Select a folder (such as code), = "TortoiseSVN" = "Create Repository here".
2) View the local warehouse address: Select the code directory, = "TortoiseSVN" = "Repo-browse". The local address is: File:///E:/a/code.
3) Check out warehouse data: Select another directory (mycode), = "SVN Checkout", enter File:///E:/a/code in the address.
Installation and use of SVN servers in Linux and use of Windows clients (CentOS-6.5)