Quickly install and use SVN version management tools under Ubuntu

Source: Internet
Author: User
Tags svn update disk usage version control system tortoisesvn

1. Introduction

Subversion is a free, open source version control system, which is like an ordinary file server, but it can record every change in files and directories. This makes it possible to revert to the previous version in a very good way and to see the details of the data changes. Currently, subversion has become one of the mainstream open source code version management software, referred to as SVN.

2, SVN related commands to understand

SVN: Command line Client

Svnadmin: Tools for creating, resizing, or repairing a repository

SVNSERVE:SVN Service Program

Svndumpfilter: Tools to filter the SVN repository dump data stream

SVNSYNC:SVN Data Synchronization tool to save another copy of the same

Svnlook: Used to view different revisions and transactions in the undergraduate course

3. Two modes of operation

3.1 Run with Svnserve as a standalone service, accessed through the SVN protocol

3.2 with the MOD_DEV_SVN module, run by Apache Service (WEB/DAV), accessed via HTTP or HTTPS protocol. To understand this mode of operation, you can refer to the blog post: http://lizhenliang.blog.51cto.com/7876557/1340646

4. Installation and Deployment

For Ubuntu, it's easy to install SVN, which can be managed directly from the APT package.

4.1 Direct Installation

# sudo apt-get install subversion

4.1 Creating a version Library

# sudo mkdir/home/svn

# sudo svnadmin create/home/svn/repos

4.2 Understanding the Repository

# go to the repository to view the generated related files

# cd/home/svn/repos/

# ls

Conf db format Hooks Locks README.txt

# Our main concern is the Conf and DB files, the Conf folder is the main configuration file and the user, the permissions location, the DB folder is to store the SVN dump data.

# CD conf/

# ls

Authz passwd svnserve.conf

# Authz file is set user rights, passwd file is the store user and password, svnserve.conf is the master profile, first configure the master configuration file.

4.3 Configuring the Version Library

# VI svnserve.conf #将以下参数去掉注释 [general] anon-access = none #匿名访问权限, default read,none is disallow access auth-access = Write #认证用户权限 Password-db = passwd #用户信息存放文件, default under the Repository/conf, you can also specify the file location by absolute path authz-db = Authz
# vi passwd #格式是用户名 = password, with clear text password [users] xiaoming = 123 Zhangsan = 123 Lisi = 123
# VI Authz [groups] #定义组的用户 manager = xiaoming Core_dev = Zhangsan,lisi [repos:/] #以根目录起始的repos版本库 The manager group is read-write @manager = RW [Repos:/media] #core_dev对repos版本库下media目录为读写权限 @core_dev = RW

4.4 Start SVN service

# svnserve-d-R/HOME/SVN

# See if it started successfully

# NETSTAT-ANTP |grep Svnserve

TCP 0 0 0.0.0.0:3690 0.0.0.0:* LISTEN 28967/svnserve

# If you want to turn off the service, you can use Pkill svnserve

4.5 Accessing SVN

# Access to Repos repository address

Svn://192.168.1.100/repos

# Access to Repos/media directory address

Svn://192.168.1.100/repos/media

# Client access to SVN server under Windows

Client: http://tortoisesvn.tigris.org

Connection: After installing the client--right-click the desktop--point tortoisesvn--Select Repo-breowser---Enter the URL (svn://192.168.1.100/repos)-- Input Manager group xiaoming user and password log in and right click to upload and delete files


Blog: http://lizhenliang.blog.51cto.com

5. Common SVN commands

5.1 Get current Latest revision number

Svnlook Youngest/home/svn/repos

5.2 Synchronizing the Code directory on the server to a local directory

SVN checkout svn://192.168.1.100/repos/media/svn--username Zhangsan--password 123

#不指定同步到本地目录 (/SVN) is the current directory by default, or you can specify no user name and password, which you need to enter manually. Or use Shorthand SVN co "svn://...".

5.3 Submit the new file to the SVN repository

Specific steps:

A) cd/svn #切换到本地代码目录,

b) SVN add filename

#将文件加入svn管理, at this time did not commit to complete, and also submit the file in the/SVN directory, otherwise reported "SVN: '" Working copy "

c) svn ci filename

#添加注释说明并提交文件, this will be opened with the Nano Editor, add the comment description and press ctrl+x, then press Y, and finally enter to complete the submission

5.4 Submit the modified file to SVN

SVN commit-m "comment description" filename

5.5 Update code to the latest version

# Update all files in the code directory to the latest version

SVN update

# Restore a file to a version

SVN update-r filename#85 is revision number

5.6 to code locking/unlock

# Plus Lock

SVN lock-m "comment description" filename

# unlock

SVN unlock filename

5.7 Code Update conflicts

If an expiration is provided at the time of submission, the code conflict is explained by SVN update filename, then SVN resolved filename, and then the SVN commit-m "comment description" filename.

5.8 Viewing logs

SVN log filename

5.9 Viewing file information

SVN info filename

5.10 Repository Merging

Merge library 1 into Library 2: first checkout the Library 2 code to the local directory (svn co url2), then go to this directory to perform the migration (SVN merge URL1)

6. Backup mode

6. 1 Svnadmin dump is an officially recommended backup method for small (100G left -to-right) repository backups, incremental backups, and slower backup restores.

The 6.2 svnadmin Hotcopy is a full-volume hot-copy tool, so disk usage is high for large (100G +) repository backups, but not incremental backups, and backup recovery is fast.

6.3 Svnsync is a real-time backup method that copies data completely to another repository, and when this machine fails, it can quickly switch to the backup.

7. Backup and Recovery

7.1 Svnadmin Dump Backup

# Full Backup

Svnadmin Dump/home/svn/repos > YYMMDD_FULLY_BACKUP.SVN

# Full Compression backup

Svnadmin Dump/home/svn/repos | gzip > yymmdd_fully_backup.gz

# Backup Recovery

Svnadmin Load/home/svn/repos < YYMMDD_FULLY_BACKUP.SVN

Zcat yymmdd_fully_backup.gz | Svnadmin Load Repos

# # # Incremental Backup # # #

# First full backup

Svnadmin dump/home/svn/repos-r 0:100 > YYMMDD_INCREMENTAL_BACKUP.SVN

# Re-incremental backup

Svnadmin dump/home/svn/repos-r 101:200--incremental > YYMMDD_INCREMENTAL_BACKUP.SVN

7.2 Svnadmin Hotcopy Backup

# Backup

Svnadmin Hotcopy/home/svn/repos yymmdd_fully_backup--clean-logs

# recovery

Svnadmin Hotcopy Yymmdd_fully_backup/home/svn/repos


This article is from the "Penguin" blog, please be sure to keep this source http://lizhenliang.blog.51cto.com/7876557/1651831

Quickly install and use SVN version management tools under Ubuntu

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.