SVN build Reference Manual [Detailed description + picture]

Source: Internet
Author: User
Tags svn update tortoisesvn

 

I. SVN server and client Installation

Install the server program
Run the server program VisualSVN-Server-1.6.4.msi, install as prompted, so that we have a set of server running environment.

Install the client program tortoisesvn
Run the TortoiseSVN-1.6.4.16808-win32-svn-1.6.4.msi according to the prompts to install, but after the final completion will prompt whether to restart, in fact, restart only make SVN work copy in windows in the special style effective, and all the actual functions have nothing to do, in order to see the effect immediately, restart the machine.

Install the client Language Pack
Run LanguagePack_1.6.4.16808-win32-zh_CN.msi

Note: Both the above-mentioned server and client programs are open-source software. Pay attention to the consistency of the two versions during use.

Ii. Create a version library using SVN

Multi-Database Management Mode

Svnroot is the root directory of the version library, wendang is the document management version library, and sourcecode is the system code management version library.

Visualsvn-server provides a visual console through which we can easily create version libraries and assign permissions.

1. Start visualsvn Server Manager, right-click visualsvn servers, and select Properties

2. Set the root location of the version library on the pop-up interface. After the settings are complete, the related services will be restarted.


3. Right-click visualsvn servers and choose creat new repository to create a new version library. Then, enter the library name in the text box.


If the checkbox in is selected, the trunk, branches, and tags subdirectories are created under the database test. If not selected, only the empty version library test is created.

(Note: Visual SVN Server Manager does not support creating and deleting files in the directory. Tortoise SVN is required for this operation)

Iii. SVN Security Configuration

User settings

1. Start visualsvn Server Manager, right-click the users folder on the page, and select create user

2. Add a new user and password on the pop-up users settings page.

User Group settings

1. On visualsvn Server Manager, right-click the groups folder on the page and select create group.

2. Add new groups and group members on the gruop settings page.

Security Settings

1. Select a library from the version library, right-click and select Properties

2. Click the "add..." button in, select the user we just added, and click OK.

3. Authorize the user or group as shown in the following figure.

Change Password online

1. Add the alias. So and mod_cgi.so files to the bin folder of the installation directory (for example, c: \ Program Files \ visualsvn Server \).

2. add the cgi-bin folder to the installation directory, including svnpass and svnpass. INI files, modify svnpass. in INI, The pwdfilepath address points to the file stored in the password of the version package library, for example: pwdfilepath = D: \ repositories \ htpasswd

3. Modify the httpd-custom.conf In the conf folder in the installation directory and add the following content:

Loadmodule alias_module bin/mod_alias.so

Loadmodule cgi_module bin/mod_cgi.so

<Ifmodule alias_module>

ScriptAlias/cgi-bin/"C:/program files/visualsvn server/cgi-bin /"

</Ifmodule>

4. modify part of the htdocs folder in the installation directory

NOTE: For the files required above, see related attachments in SVN.

5. the user accesses the version library through the URL. After the verification is passed, the password can be modified online.

Iv. SVN Backup Recovery Mechanism

For the sake of resource security, in order to prevent the configuration library resources from being lost and unrecoverable due to hardware or software faults of the Configuration Management Server, You need to regularly back up the configuration library resources. The backup policy adopted here is "regular large backup, always backup", that is, regular backup of all configuration library resources under the configuration library root directory, and for each configuration library, if the resources in the database have been modified (that is, the resource has been modified and submitted), only the modified information is backed up. The following describes the implementation of "regular backup" and "always backup.

Implementation steps of "regular large backup"

The most common and simple backup is to directly use the copy command to copy the version library directory to the backup directory. however, this is not a safe method, because if the version library changes during the copy process, the results of horse Backup will be inaccurate and the backup function will be lost, therefore, the "svnadmin hotcopy" Command provided can prevent this problem.

For example, the following SVN version library is available:

D: \ Repositories

Upload-test

│ ─ ── Conf

│ ├ ── Dav

│ ─ ── DB

│ ─-Revprops

│ ── Revs

│ Transactions

│ ─ ── Hooks

│ ─ ── Locks

└ ── Yanfa

├ ── Conf

├ ── Dav

Analytic DB

│ Bai── revprops

│ ─ ── Revs

│ Transactions

├ ── Hooks

─ ── Locks

Now back up test to the E: \ repositories_back directory, just run:

Svnadmin hotcopy D: \ repositories \ test E: \ repositories_back \ test

Implementation script:

1. Compile the backup. bat batch processing file

Echo off

Rem subversion installation directory

Set svn_home = "C: \ Program Files \ visualsvn server" (= the installation path of the visualsvn server on the right side. Modify the path based on the actual situation)

Parent directory of all REM versions

Set svn_root = D: \ repositories \ (= the path of the configuration database root directory on the right. Modify the directory based on the actual situation)

Rem Backup Directory

Set backup_svn_root = E: \ repositories_back (= the backup file storage path on the right. Create a storage folder based on the actual situation)

Set backup_directory = % backup_svn_root % \ % Date :~ 0, 10%

If exist % backup_directory % goto checkback

: Startback

Echo create Backup Directory % backup_directory %> % backup_svn_root %/backup. Log

Mkdir % backup_directory %

Rem verifies whether the directory is a version library. If yes, the name backup is taken out.

For/R % svn_root % I in (.) Do @ if exist "% I \ conf \ svnserve. conf" % svn_root % \ simplebackup. Bat "% ~ Fi "% ~ Ni

Goto end

: Checkback

RD/S/Q % backup_directory %

Goto startback

: End

2. Compile simplebackup. bat batch file

@ ECHO is backing up version library % 1 ......

@ % Svn_home % \ bin \ svnadmin hotcopy % 1% backup_directory % \ % 2

@ Echo version library % 1 successfully backed up to % 2!

Goto clean

: Clean

Del/Q % backup_svn_root % \ modifiedbackup \ *. Dump

Goto end

: End

3. backup. BAT and simplebackup. put the bat batch processing file under the configuration database root directory (here is D: \ repositories), test whether the program can be successfully executed, enter the configuration database root directory, and double-click the file backup. BAT, and then go to the Backup Directory D: \ svnbackup to check whether all the configuration libraries under the configuration database root directory have been backed up and whether the backup log is output correctly. If both of the two items pass, it indicates that the program is no problem.

4. Put the execution of file backup. bat in the system task plan so that the backup can be performed automatically on a regular basis. Click Start> Control Panel> task plan> Add scheduled task to open the task plan wizard window,

Click "Next" to enter the next window. Click "Browse". In the "Select Program to schedule" dialog box that appears, select backup under the configuration library root directory. add the BAT file,





After entering the next window, you can set the added Task Name and task execution interval type. If the task name is the same as the program name, set the weekly backup to be executed,

Click "Next" to enter the start time and start date of task execution in the next window. If the interval type is different, the content displayed in the window is different. Set the task to be executed at every Friday,

Click "Next" to set the user name and password required for task execution. Use the Default User Name (the default user is the local administrator user). Enter the logon password of the local administrartor user,

Click "Next" and then click "finish" in the next window to complete the task addition. In this way, the system can automatically back up the configuration database based on the scheduled task information. Because "regular large backup" is an overall backup of the latest version of all configuration libraries, all "always-on and small-Backup" after the last large Backup will be automatically deleted each time ".

Steps for "always backup"

1. Compile the post-commit.bat batch processing file

Echo off

Set svn_home = c: \ Program Files \ visualsvn server (= the installation path of the visualsvn server on the right side. Modify the path based on the actual situation)

Set svn_root = D: \ repositories (= path of the configuration database root directory on the right. Modify the directory based on the actual situation)

Set svn_modified_backup_root = E: \ repositories_back \ modifiedbackup (= the backup file storage path on the right. Create a storage folder based on the actual situation)

SET LOG_FILE = % svn_modified_backup_root % \ modifiedbuckup. Log

Echo Incremental Backup configuration library version % 2 modification> % LOG_FILE %

Cd c: \ Program Files \ visualsvn Server \ bin

Svnadmin dump D: \ repositories \ test (= the configuration library backed up from time to time on the right) -- incremental -- Revision % 2> E: \ repositories_back \ modifiedbackup \ Dev. Dump

Goto end

: End

2. Place the compiled post-commit.bat batch file in the hooks directory of the corresponding configuration Library (here is D: \ repositories \ test \ hooks)

3. test whether the "always-in-time backup" function is implemented. In the local SVN workspace, modify and submit the configuration library that implements the "always-in-time backup" function, then go to the corresponding Backup Directory (here E: \ repositories_back \ modifiedbackup) and check whether the backup file (here Dev. dump) and backup log (modifiedbuckup here. log ). If both exist, the backup is successful.

4. Perform the preceding operations on each configuration database under the configuration database root directory so that each configuration database can implement the "always backup" function.

Restore database backup configuration

Because the backup methods of the configuration library are "regular large backup" and "always small backup", there are also two backup data restoration policies:

1. if the contents of all the configuration libraries in the root directory of the configuration library have not been modified after "regular large backup, (that is, there is a backup data file under the Backup Directory of "time and small backup"). At this time, you can restore the backup data file of the big backup that was last backed up. The method is as follows: click "start"-> "All Programs"-> "visualsvn server" to start the visual control panel of the visual SVN server, and select the configuration root directory node "repositories ", right-click and choose "all tasks"> "Import existing repository ...", Open the import existing repository window.
In the repository location input box, enter the path of the configuration database backup file to be imported (or click "Browse" to browse and select), and then enter the name of the new configuration library in the "New repository name" text box, the operation result is as follows:

Click "OK" to restore the backup database. (Perform the preceding operations for backup of each configuration database)

2. if some configuration library contents in the root directory of the configuration Library have been modified effectively before "regular large backup, first, you need to back up the changes to the configuration Library (small backup. dump) is merged to the latest overall backup (large backup). The merge method is to execute the batch processing file merger. bat. The file content is as follows:

Cd c: \ Program Files \ visualsvn Server \ bin svnadmin load E: \ repositories_back \ 2010-06-01 \ test <E: \ repositories_back \ modifiedbuckup \ Dev. Dump

(Note: e: \ repositories_back \ modifiedbuckup \ Dev. dump is the cumulative backup Dev for the configuration database test "always backup. dump path, where E: \ repositories_back \ 2010-06-01 \ test is the path of the backup database test in the configuration library test for the latest "regular large backup)

Then, restore the backup database test according to the method in restore policy 1. If no configuration library has been effectively modified, you can restore it directly by following the method in restore policy 1.

5. access through a Web browser

Open your browser and enter "https :\\......... "network path, and then enter the correct username and password given by the configuration database administrator in the pop-up authentication login box,

After successful login, you can browse and download the configuration library objects with permissions.

6. basic use of tortoisesvn

Check in resources to the svn Server

If there is a folder for sharing documents, check the resources in this folder into the test library on the svn server, right-click the shared documents folder, and then the right-click menu is shown in:

Click Import to bring up the following form, where https: // Neng: 8443/is the server name and port number, SVN is the root directory of the version library, and test is the version library created for the test group:

Click "OK". The following form is displayed, requiring creden:

In the above form, enter the user name and password, and click OK:

As shown in, all the information in the shared document has been successfully checked into the svn server. At this time, the team members can move the shared documents on the svn server to their own machines.

Check out resources to the Local Machine

Create a folder test on the local machine, right-click it, And the pop-up window is as follows:

In the repository URL: Enter the address of the repository in SVN server in the text box. By default, click OK to check the information in the Test Library.

Note: There are four options for detecting the depth in, namely, migrating out all, checking out only the sub-directories and files at the lower level, checking out only the files, and checking out only empty projects. The default value is the first item. In this case, a dialog box is displayed, asking you to enter the user name and password. After verification, you can view the content in the code library.

Once you have made any changes to the file or folder, the display image of the file or folder will change. Modified one of the files:

Let's take a look at the pictures corresponding to different States:

Submit the modified file to the svn server.

Modified the QC Use Case compiling specification document in the 09-Soft Card CAS folder. The following shows how to submit the document to the svn server.

Note: When submitting resources to the server, make sure that the local resources are in the latest version. Otherwise, the submission may fail or cause version conflict.

Right-click the 09-Soft Card CAS folder or right-click the blank space in the 09-Soft Card CAS file and click SVN submit. the following form is displayed:

Click OK to bring up the following form:


Add a new file to the svn Server

Add a new userinfo file under the [09-Soft Card CAS] file. CS, right-click the blank space under the [09-Soft Card CAS] file, and click SVN submit, just like submitting the modified file to the svn server mentioned above.

You can also go to the file userinfo. on CS, right-click and choose tortoisesvn => Add. In this way, the file is not submitted to the svn server, but the file is marked as a file in the library, and change the status to the modified status. After that, we need to submit this file again in svn c to submit it to the test database on the svn server.

The above is about adding files. In fact, the steps for adding folders are the same.

Update the local code to be consistent with the latest version on the svn server.

This is also very simple. You just need to right-click the folder to be updated or right-click the blank space in the file and click SVN update.

Note: The update operation may fail due to version conflict, which can be solved by merging or other methods; or it may fail because of locking. This requires unlocking first.

Rename a file or folder and submit the modification to the svn server.

Right-click the file or folder to be renamed, click tortisesvn => rename, enter a new name in the pop-up form, and click OK. This method does not directly rename the file or folder, but marks the name of the file or folder as the name after renaming. We also need to submit it to the svn server using SVN to rename it.

Delete a file or folder and submit the modification to the svn server.

The simplest way is to directly delete a file or folder and use SVN to submit updates to the svn server. Another method is to right-click the file or folder you want to delete> tortoisesvn => Delete. This method is not directly deleted, instead, you can delete the file or folder. You also need to submit it to the svn server using SVN to delete it.

Note: In fact, from the time you migrate the source code to the svn server, data and files of each version can be moved out at any time even if you have deleted them.

 

 

 

 

 

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.