Linux SVN server Setup, client operation, backup and recovery

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

Subversion (SVN) is an open source version control system that manages data 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

First,Linux SVNServer Deployment

1 , installation SVN

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

[[Email protected]~]# svnserve--version

Svnserve,version 1.6.11 (r934486)

2 , creating SVN Version Library

[[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 , Configuration 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 the permissions configuration file.

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 , Initialize 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 SVNClient Command Actions

1 , the file Checkout 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

# specified version of the file

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

2 , add a new file to the local repository

svn Add File # This command has to be done in the checkout path .

For example:

cp/root/123.txt./

svn add 123.txt # add 123.txt to your local library

A 123.txt

3 , committing 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 ' # Submit only 123.txt

svn commit-m ' Add 123.txt ' # The default commits the current directory so the file

svn commit *.txt-m ' Add 123.txt ' # You can also submit a regular match file

4 , plus lock / 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, 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

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

Ten , merging 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)

One , SVN Help

SVN help

SVN help CI

A , List of files and directories under the repository

svn list Path # displays all files and directories belonging to the repository under the path directory

Shorthand: SVN ls

- , create a new directory under the included version control

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

Usage:

SVN Mkdirpath # effect equivalent: mkdir test;svn add test;

- , 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 SVNBackup and Recovery

1 , full-scale backup:

curr= ' Svnlook youngest/data/svn/project/' # here is the latest version of the Query engineering catalog

Svnadmin du mp/data/svn/repos/test--revision 0: $cur-I. NC remental >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


This article from "Yang Cloud" blog, reproduced please contact the author!

Linux SVN server Setup, client operation, backup and recovery

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.