Linux SVN server Setup, client operation, backup and recovery

Source: Internet
Author: User
Tags auth diff svn client svn update version control system

Subversion (SVN) is an open source version control system that manages data that changes over time. This data is placed in a central repository, which is much like an ordinary file server that remembers every change in the file so that it can be restored to the old version, or the history of the changes to the file.

This article directory:

Linux SVN server Deployment

Linux SVN client command operation

Linux SVN Backup and recovery

One, Linux SVN server deployment

1. Install SVN

[Email protected]~] #yum install-y Subversion

[Email protected]~] #svnserve--version

Svnserve,version 1.6.11 (r934486)

2. Create SVN repository

[[Email protected]~]# mkdir/data/svn

[Email protected]~]# svnadmin Create/data/svn/project

[[Email protected]]# ls/data/svn/project/

Conf db format Hooks Locks README.txt

3. Configure SVN

[[Email protected]]# cd/data/svn/project/conf/

[Email protected]]# ls

Authz passwd svnserve.conf

File Description:

1) under the SVNSERVE.CONF:SVN service configuration file.

2) passwd: User name password file.

3) AUTHZ:SVN permissions profile.

svnserve.conf file

The file configuration item is divided into the following 5 items:

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

The configuration is as follows:

[Email protected]]# grep-e "anon-access =|auth-access =|password-db =|authz-db =|realm=" svnserve.conf

Anon-access = None

auth-access = Write

Password-db = passwd

Authz-db = Authz

Realm =/data/svn/project

passwd file

The role is to configure the user name and password

[Email protected]]# cat passwd

[Users]

yangyun= yangyunpasswd

Test = TESTPASSWD

Authz file

Configure User access rights

[Email protected]]# cat Authz |grep-v ' # '

[Aliases]

[Groups]

Project_w=yangyun

Project_r=test

[/]

Project_w=rw

Project_r=r

4. Start SVN service

[Email protected]]# svnserve-d-R/DATA/SVN

5. Initialization of SVN data

[Email protected]]# svn import mysite file:///data/svn/project/-m ' initial import '

Will copy the directory MySite to the repository under project

[Email protected]]# svn list File:///data/svn/project

manage.py

mysite/

static/

templates/

web02/

After the import, the original directory tree did not convert to a working copy, in order to get started, or to run SVN checkout to export a working copy.

Second, Linux SVN client command operation

1. Checkout files to a local directory

SVN checkout Path (path is a directory on the server)

Shorthand: SVN Co

Cases:

SVN Co svn://115.28.24.178/project--username=yangyun--PASSWORD=YANGYUNPASSWD

#指定版本的文件

SVN co svn://115.28.24.178/project--username=yangyun--password=yangyunpasswd-r 5

2. Add a new file to your local repository

SVN Add File #此命令得在checkout出来的路径里才能操作

For example:

cp/root/123.txt./

SVN add 123.txt #把123. txt added to the local library

A 123.txt

3. Submit the changed files to the repository

SVN commit-m "LogMessage" [-n] [--no-unlock] PATH (using the--no-unlock switch if lock is selected)

Shorthand: svn ci

Cases:

SVN commit 123.txt-m ' Add 123.txt ' #只提交123. txt

SVN commit-m ' Add 123.txt ' #默认提交当前目录下的所以文件

SVN commit *.txt-m ' Add 123.txt ' #也可以正则匹配文件提交

4. Locking/unlock

SVN lock-m "Lockmessage" [--force] PATH

For 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. Delete Files

SVN delete path-m "Delete test Fle"

Example: SVN delete svn://192.168.1.1/pro/domain/test.php-m "Delete Testfile"

Or just svn delete test.php and then svn ci-m ' Delete testfile ', the recommended use of this

Shorthand: SVN (del, remove, RM)

7. View Logs

SVN log path

For example: SVN log test.php shows all changes to this file, and its version number

8. View File Details

SVN InfoPath

Example: SVN info test.php #可知道路径版本, time, submitter, etc.

9. 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

10. 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)

11. SVN Help

SVN help

SVN help CI

12. List of files and directories under the repository

SVN list Path #显示path目录下的所有属于版本库的文件和目录

Shorthand: SVN ls

13. Create a new directory under version control

SVN mkdir: Create a new directory under the included version control.

Usage:

SVN mkdirpath #效果等同: mkdir test;svn add test;

14. Restore Local Modifications

SVN revert: Restores the original unchanged working copy file (restores most of the local modifications).

Revert

Usage: revert PATH ...

Note: The notebook command will not access the network and will release the conflicting condition. But it does not restore the deleted directory

Third, Linux SVN backup and recovery

1, full-scale backup:

Curr= ' Svnlook youngest/data/svn/project/' #此处是查询工程目录的最新版本

Svnadmin dump/data/svn/repos/test--revision 0: $cur--incremental >0-"$curr" Svn.bak

Echo $curr >/tmp/svn_revision

2. Incremental backup

Old= ' Cat/tmp/svn_revision '

new= ' Svnlook youngest/data/svn/project/'

Svnadmin dump/data/svn/repos/test--revision $old: $new--incremental > $old "-" $new "Svn.bak

3. SVN recovery

Recovery sequence is restored from the lower version to the higher version, i.e., restore the last full backup first, and then restore the incremental backup next to the file.

cd/data/svn/repos/

Svnadmin Create Test2

Svnadmin Load Test2 </data/svnback/20110719/0-1112svn.bak

Svnadmin Load Test2 </data/svnback/20110719/1113-1120svn.bak

Linux SVN server Setup, client operation, backup and recovery

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.