SVN construction in Windows

Source: Internet
Author: User
Tags tortoisesvn

Summary of SVN setup steps in Windows

1. Basic Concepts

1.1. What is version control?

Version Control is a data warehouse that records every change to the file.

SVN servers can run in two ways: independent servers and Apache. The two methods have their own advantages and disadvantages.

SVN also stores version data in two ways: bdb and fsfs. Because the bdb method may lock data when the server is interrupted (I am suffering from LDAP and cannot cure it), it is safer to use the fsfs method.

1.2. What is subversion?

Subversion is a free, open-source version control system, or a centralized information sharing system. Its core is the version library, which stores all the data, the version library stores data in the form of a file tree-including files and directories. Any number of clients can connect to the version library to read and write these files. By writing, others can see this information and read data to see others' modifications. It manages files and directories over time. A group of files are stored in the central version library. This version library is similar to a common file server, but it can record every modification to files and directories, this allows you to obtain a previous version of the data and check the changes. From this perspective, many people regard the version control system as a "time machine ".

Subversion can access its version library through the network, so that users can use it on different computers. To a certain extent, it can be said that it is to promote collaboration to allow users to modify the same data in their respective places. The progress may be very rapid, and there is no channel for all changes to achieve results. Because all jobs have historical versions, you do not have to worry about the impact of quality due to the loss of a channel, if an incorrect change exists, cancel the change.

Some version control systems are also Software Configuration Management (SCM) systems, which are specially designed to manage source code, there are many features about software development-Understanding programming languages themselves, or providing tools for building programs. However, subversion is not such a system. It is a general system that can manage all types of file sets. For you, this may be the source code, for others, it may be a goods quotation or a manuscript.

2. Install the independent server svnserver

2.1. Preparations

2.2. Install the server and client

2.3. Create a version Library

To run the Subversion server, you must first create a version Library (repository ). The version library can be seen as a place where data is centrally stored and managed on servers.

Create a version library. First, create an empty E: \ SVN folder as the root directory of all version libraries. Then, go to the command line and switch to the bin directory of subversion. Run the following command:

Svnadmin create E: \ SVN \ repos1

This command creates a version library repos1 under E: \ SVN. Some folders and files are automatically generated under repos1.

We can also use tortoisesvn to perform this step graphically:

First create an empty directory e: \ SVN \ repos1
Be sure to leave it empty. Then in repos1
On the folder, "right-click-> tortoisesvn-> createrepository here... ", then you can select the version library mode. Here you can use the default fsfs, and then create a series of folders and files, which are the same as those created on the command line.

2.4. Running Server

At this time, the Subversion service has not started yet, but the version library has been created through its command. Enter the following in the Command window:

Svnserve.exe -- daemon

Svnserve will wait for the request on port 3690, and the -- daemon (two dashes) Option tells svnserve to run in daemon mode, so that it will not exit before manual termination. Do not close the command line window. Close the window will stop svnserve.

To verify that svnserve works properly, use tortoisesvn-> repo-browser to view the version library. In the pop-up URL dialog box, enter:

SVN: // localhost/SVN/repos1

Click "OK" to view the directory tree structure of the repos1 version library, but repos1 is an empty database.

You can also use the -- root option to set the root location to restrict the access directory of the server, so as to increase security and save time for inputting svnserveurl:

Svnserve.exe -- daemon -- rootdrive: \ path \ To \ Repository

In the previous test, svnserve runs as follows:

Svnserve.exe -- daemon -- root E: \ SVN

Then the browser URL in tortoisesvn is reduced:

SVN: // localhost/repos1

2.5. Configure users and permissions

Open the E: \ SVN \ repos1 \ conf directory in the text editor and modify svnserve. conf:

Set:

# Password-DB = passwd

Changed:

Password-DB = passwd

Remove the # annotator. Note that there is no space before it.

Then modify the passwd file in the same directory and add an account:

Set:

[Users]
# Harry = harryssecret
# Sally = sallyssecret

Add an account:

[Users]
# Harry = harryssecret
# Sally = sallyssecret
Test = test

2.6. initialize the Import

The following describes how to import our data (project) to this version library and manage our data in the future. Any of our changes are recorded by the version library. Even if we lose or correct the data, the version library can help us retrieve the data.

For example, I have a guestbook under E: \ SVN.
Folder, which stores the code programs I have compiled. Right-click the folder and choose tortoisesvn> Import ..."
Run svnserve-d-r e: \ SVN \ repos1 in command line mode to access files on the svn server.

In the "URL of repository" dialog box, enter "SVN: // localhost/repos1/Guestbook ". In "Import message", enter "import entire message book" as the comment.
After clicking OK, enter the account. Enter test in both the user name and password. After completion, all content in the guestbook is imported to SVN: // localhost/SVN/repos1/guestbook.

We can see that there is no change in E: \ SVN \ repos1, and even a guestbook folder is not created. The only change is that the capacity of E: \ SVN \ repos1 has increased. In fact, the content in the source guestbook has already been imported into the repos1 version library, and the source guestbook folder can be deleted.

Note that this step can be performed on another client with tortoisesvn installed. For example, if the IP address of the host running svnserve is 133.96.121.22, the content entered in the URL section is "SVN: // 133.96.121.22 ".

2.7. Basic operation procedure

1. Check out)

Extract the version library to a working copy:

To any empty directory, such as creating an empty folder F: \ work in partition F. Right-click and choose SVN checkout ". In "URL of repository", enter "SVN: // localhost/SVN/repos1/Guestbook" to get a copy of the content in the guestbook.

2. Check in/commit)

Make changes in the work copy and submit:

In the copy of the guestbook job, open a file and modify it. Right-click and choose SVN commit ...". In this way, the modifications are submitted to the version library, which stores the submitted data as needed.

Right-click the modified file and choose tortoisesvn> show log to view all submissions to the file. Right-click different revision entries and choose "compare with working copy". We can compare the differences between the files that work copies and the selected revision version.

3. Differences between apachesvn and subversion

The Subversion design includes an abstract network layer, which means that the version library can be accessed through various server processes. Theoretically, subversion can be implemented using an infinite number of network protocols. Currently, there are two types of servers in practice.

· Svnserver: svnserve is a small (also called Lightweight) independent server that uses its own defined protocols and clients. (Note: The above installation configuration is used to install the svnserver server .)

· Apachesvn: Apache is the most popular Web server. By using the mod_dav_svn module, Apache can access the version library and allow the client to access it using the HTTP extension protocol WebDAV/DeltaV.

Accessing the version library through HTTP is one of the highlights of subversion.Apachesvn ServerWith many
Svnserve Server
Without features, it is more flexible to use, but a little difficult to configure, flexibility usually brings complexity.

Because the Subversion requires version control, the standard HTTP Protocol cannot meet the requirements. To make Apache and subversion work together, you need to use WebDAV (web-based Distributed Authoring andversioning :) Web Distributed creation and version control ).

 

 

Conclusion 2

One Server

1. Download and install Subversion
2. Create a version library and run the following command in the command line:
Svnadmin create E:/SVN/doc
Svnadmin create E:/SVN/Project
Two shared folders will be created.
3. Set the password and permissions.
Open svnserve. conf under E:/SVN/doc/conf and set # password-DB =
Remove # Before passwd. Do not leave spaces; otherwise, an error will be reported. If all accounts have all permissions by default, do not remove # Before # authz-DB = authz, otherwise, you must enter the authz file under E:/SVN/doc/conf to set permissions for each account.
Go to the passwd file under E:/SVN/doc/conf and add Sally = sallypsw under [users]. Then, the password sallypsw is created for user Sally.
4. Start the svn Server
Run the following command on the command line:
Svnserve-d-r e:/SVN
Or create a batch file startsvn. BAT and copy the above content. The root directory of the server is E:/SVN. There are two shared folders below.
5. Import existing projects
SVN import E:/tree SVN: // 192.168.1.23/doc-M "importmassage"
Parameter description
E:/tree directory of the project to be imported
SVN: // 192.168.1.23/DOC address of the svn server to be imported
-The M "Import massage" parameter must also be added. Otherwise, the system prompts "cannot use the external editor to obtain log information"
6. Export projects in SVN
SVN export SVN: // 192.168.1.23/doc e:/Etest
Parameter description
SVN: // 192.168.1.23/DOC address of the svn server to Be Exported
E:/Etest: The export project is placed in the E:/Etest folder. E:/Etest cannot be created.
Export a specified version
SVN export-R version SVN: // 192.168.1.23/doc e:/Etest export the specified version number file. E:/Etest cannot be created.
Version can be a number.
7. View the svn directory structure on the server.
SVN list SVN: // 192.168.1.23/Project

 

2. Client

Use tortoisesvn to access the server:
1. Download and install tortoisesvn.
2. select a folder to be shared, such as E:/localsvn. Right-click svncheckout and enter SVN: // 127.0.0.1/doc in the URL. Then, the folder will be associated with the directory e on the server: /SVN/DOC: click OK.
3. Get an update from the server: Right-click E:/localsvn and select svnupdate to download the latest update from the server.
4. Submit the update to the server: Right-click E:/localsvn, select svncommit..., enter the user name and password, and click OK. Then, the update is submitted to the server.

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.