Installation and use of SVN version controller--learning record

1. SVN overview

SCM: Software Configuration Management

The so-called software configuration management is actually the control and management of the software source code.

CVS: Veteran product

VSS: entry-level product

ClearCase: IBM provides technical support, mid-level products

SVN: Mainstream Products

What is SVN

• SVN full name SubVersion

• SVN is a version management tool that has emerged in recent years and is the successor to CVS. Currently, the vast majority of software companies use SVN as their code version management software.

Features: Simple to operate, easy to get started

Cross-platform support (Window/Linux/MacOS)

Support version rollback function (time machine)

Get SVN software

It belongs to C/S structure software (client and server)

Server software: VisualSVN

URL: http://www.visualsvn.com/

Client software: TortoiseSVN

URL: http://tortoisesvn.net/downloads

2. Server-side software installation (VisualSVN)

Server software is stored on the software/server side

1) Double-click the server software installation

2) Next, continue

3) Next, continue

4) Next, continue

5) Next, continue, finish safely.

3. SVN server configuration

1. Create a project

① First create a public directory WebApp on the SVN server side as the project directory

② Create a Shop folder in the WebApp directory as Shop (version warehouse)

③ Create a version repository, basic syntax:

svnadmin create Shop folder path (Shop warehouse)

If the Shop warehouse configuration is successful, the Shop folder will display the following directory structure

2. Perform server-side supervision

Apacheàhttp://localhost or (ip address) to access the relevant files in the htdocs directory (supervision)

SVNàsvn://localhost or (ip address) to access the relevant data warehouse (such as Shop warehouse)

Basic syntax:

svnserve -d (runs in the background) -r (supervisory directory) version repository directory

As shown below:

Through the above instructions, our svn://localhost or ip address can directly point to the Shop version warehouse

3. Permission control

By default, the SVN server does not allow anonymous users to upload files to the server, so system-related configuration files must be changed.

Change the code on line 19, remove the preceding spaces and # signs, and change its value to write (read and write)

4. Installation and use of SVN client software

1. Obtain the software installation package

2. Confirm the number of operating system bits

32-bit operating system

64-bit operating system

How to confirm the operating system bitness? You can right-click on the computer icon à Properties, as shown below:

From the above analysis, we can see that we need to install 64-bit client software.

3. Client software installation steps

① Double-click the software to run (TortoiseSVN)

② Agree to the license agreement, the next step:

③ Select the default installation, the next step:

④ Next, Install, the system will automatically install the SVN software, click Finish.

 

Note: After the TortoiseSVN client software is installed, be sure to restart the computer, otherwise the SVN icon will not be displayed.

If the following two icons appear with the right mouse button, it means that we have successfully installed!

⑤ Install the Chinese package

Double-click to run the installation language pack, the system will automatically find the previous TortoiseSVN software installation directory, and perform automatic installation. After the installation is complete, the following settings can be performed:

 

⑥ Use the client software to connect to the SVN server

(Checkout checkout)

First, right-click on your project directory à TortoiseSVN à repository browser à output the SVN server address:

svn://SVN server address à Shop project (warehouse)

show hidden files

If the above .svn hidden folder appears, it means the checkout is successful.

Five, SVN use detailed explanation (1)

1, SVN three major instructions

1) (Checkout) Checkout operation: ① Link to SVN server ② Update server data to local

Note: Checkout only operates once at the first link, if you update it later, please use Update (update command)

2) (Commit) Submit operation: ① Submit local data to the server

Most of the above work is done by the project manager, so if a new programmer comes to the company, what operations does he need to do?

1) Check out the operation, the effect is as follows:

2) Commit, the effect is as follows:

The above instructions are usually uploaded after the module is developed

3) Project Manager (Update update operation)

6. Detailed explanation of SVN use (2)

1. What is version rollback?

Sometimes, the operation of the software may make developers or users dissatisfied, and then we need to return the current version to a previous version.

2. Version rollback function

① Right-click on the blank area of ​​the project and operate as shown in the figure below

Version rollback based on logs

Select the state to be rolled back according to the log information, the effect is as shown in the following figure

The fallback effect is as follows:

Seven, configure multiple warehouses and permission control

1. Configure multiple warehouses

In actual project development, we may develop multiple projects at the same time, so how do we supervise multiple projects?

Warehouse supervision is performed through svnserve, but the supervision instruction can only supervise a certain folder, and cannot supervise multiple warehouses at the same time.

Answer: The purpose of supervising all warehouses can be achieved by supervising the general catalog of WebApp

svnserve -d (background operation) -r (supervision directory) WebApp (project general directory)

① Open the DOS window and enter the following command

svn://localhost or ip address to access the D:/svn/WebApp directory

If you need to access the Shop project, Wechat project

Shop project: svn://localhost/Shop

Wechat project: svn://localhost/Wechat

2. Permission control

If you want to use permission control, there is a prerequisite: you must first enable the permission function

In each repository there is a conf folder with three files in it

authz file: authorization file

Tell which users have which permissions

 

passwd file: authentication file

Identify which users and corresponding passwords a warehouse has in the current svn system

 

By default, the above two files are disabled. If you need to use them, you must first open the above two files

svnserve.conf configuration file

 

The steps to turn on are as follows:

① Annotate the read and write permissions of anonymous users

② Open the authentication file and authorization file

③ Write an authentication file to define the relevant user name and password

 

④ Write authorization documents

⑤ Test

Enter admin, admin888 super administrator

Eight, SVN service configuration and management

1. Configure the self-starting service

sc create SVNService binpath= “D:\subversion\bin\svnserve.exe --service -r D:/svnroot” start= auto

sc create service name binpath=space “svnserve.exe –service –r D:/svn/WebApp” start=space auto

Create a system service, service name SVNService

① Open Run, enter the cmd command, and open the DOS environment (please use the super administrator to run)

② Enter the command

③ View system services

Control Panel à Administrative Tools à Services

Double-click to run to start the SVNService service

If the operation is successful, it means that the SVN supervision service is enabled.

 

2. Create a batch file

start service net start service name

stop service net stop service name

delete service sc delete service name

Nine, hook program

A hook is a program that is triggered by some repository event, such as the creation of a new revision, or the modification of an unversioned property.

By default, the hooks subdirectory (repository /hooks/ ) contains various repository hook templates.

 

post-commit.tmpl : The hook program triggered after the transaction is completed

Hook programs can be written by default using batch instructions or shell instructions

 

1. Write hook programs through batch instructions

① Command svn server working directory

Set the server-side SVN path

SET SVN="D:\svn\bin\svn.exe“

 

② Specify the working directory of the web server

Set the server-side project run directory

SET DIR="D:\server\apache\htdocs\shop"

③ Update the data to the DIR directory in real time through the update command

SVN update %DIR%

 

2. Specific use steps

Step 1: Copy post-commit.tmpl to post-commit.bat file

Step 2: Fill in the relevant batch instructions

Step 3: Create a Shop project in the apache directory and update the SVN server data to the local

Step 4: Update the file to the SVN server, you can get the latest data in the Shop directory in real time

Step 5: You can directly access the update file in the form of a virtual host

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325843048&siteId=291194637