Installation and use of subversion

Source: Internet
Author: User
Tags svn svn client svn update tortoisesvn

1 windows2003 The SVN server

1.1 Getting Subversion Server program
Download the latest server Installer to the official website (http://subversion.tigris.org/).
Currently the latest is 1.5 version, the specific download address in: http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100&expandFolder= 8100&folderid=91


1.2 Install server Side
Download the server side is a ZIP compression package, direct decompression can be, such as I extract to e:/subversion. Client installation file is an EXE executable file, directly run the prompt installation can be installed, the client after installation prompts restart.


1.3 Build Version library (Repository)
Running a subversion server requires that you first establish a version library (Repository).
A version library can be viewed as a place where data is centrally stored and managed on the server.

First establish the E:/SVN empty folder as the root of all version libraries.
Then, go to the command line and switch to the Subversion bin directory.
Enter the following command:

Svnadmin Create E:/svn/repos1

This command establishes a version library repos1 under E:/SVN.
Repos1 some folders and files are automatically generated below.

We can also use TORTOISESVN graphically to complete this step:
First set up empty directory E:/SVN/REPOS1, note must be empty.
=> on the Repos1 folder "right button->tortoisesvn->create Repository here ..."
=> can choose the version library mode, which uses the default Fsfs
=> creates a series of folders and files, as the command line establishes.


1.4 Running standalone servers
At this point, the Subversion service has not yet started, only through its command to establish a version library.
Continue typing in the command window just now:

Svnserve.exe--daemon

Svnserve will wait for the request on port 3690 and the--daemon (two dash) option tells Svnserve to run as a daemon so that it does not exit until the manual termination.
Note Do not close the command line window, close the window will stop the Svnserve.

To verify that Svnserve is working properly, use the TortoiseSVN-> repo-browser to view the version library.
In the Pop-up URL dialog box, enter:

Svn://localhost/svn/repos1

Click the OK button to see the REPOS1 version of the Library directory tree structure, only then REPOS1 is an empty library.

You can also use the--root option to set the root location to restrict access to the server directory, thereby increasing security and saving input Svnserve

Time of URL:

Svnserve.exe--daemon--root drive:/path/to/repository

With the previous test as an example, Svnserve will run as:

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

The version library browser URL in TortoiseSVN is then reduced to:

Svn://localhost/repos1

You might ask, wouldn't it be a one-time command to start the SVN server? How do I get the SVN server to start automatically when it's powered on?
The answer is to register the SVN service with the Windows system service and execute commands at the Windows command prompt.

SC create SVN binpath= "/" d:/subversion/bin/svnserve.exe/"--service-r f:/svn" displayname= "SVN service" depend= Tcpip s tart= Auto

Is this order a little long?
In fact, it is easy to understand, SC is the System Service Registration tool with Windows, Microsoft Support Center provides detailed instructions, I will not repeat, the parameter binpath= "/" d:/subversion/bin/svnserve.exe/"--service- "R F:/SVN" is like the command we started manually to start the SVN server, right? It is not difficult to understand that the-D was changed to--service, because it is now a service. Well, now that it's done, try it again.
PS: If you want to remove the SVN service that you just registered from system services, you can use the SC Delete svn command.


1.5 Configuring Users and Permissions
Open the e:/svn/repos1/conf directory with a text editor and modify the svnserve.conf:

Will:

# password-db = passwd

To

Password-db = passwd

That is, remove the previous # annotation and note that there is no space in front of it.
Then modify the passwd file in the same directory and add an account number:

Will:

[Users]
# Harry = Harryssecret
# sally = Sallyssecret

Add account Number:

[Users]
#harry = Harryssecret
#sally = Sallyssecret
Test = Test

1.6 Initialization Import

The following is the import of our data (project) into this version library, and later the version library to manage our data. Any changes we make are recorded back to the version library, and even when we lose or change the data, the library can help us retrieve the data.

For example, I have a guestbook folder under the D:/wwwroot, which is stored in the Guest book Program I wrote.
On this folder, right-click-> tortoisesvn-> Import ..., enter URL of repository in pop-up dialog box

Svn://localhost/repos1/guestbook

Enter "Import entire guest book" as a comment in the import message.
Click OK to enter the account number after the request. We enter test in username and password. When finished, the contents of the guestbook are all imported into the Svn://localhost/svn/repos1/guestbook.

We see no change in e:/svn/repos1, even a guestbook folder is not established, the only change is the e:/svn/repos1 capacity of the larger. In fact, the contents of our source guestbook have been imported into the REPOS1 version library, and the source guestbook folder can be deleted.

It should be noted that this step can be done entirely on another client with TORTOISESVN installed. For example, the IP of the host running Svnserve is 133.96.121.22, then the content of the URL part is "svn://133.96.121.22".


2 TORTOISESVN Installation and use

2.1 Get and install the TORTOISESVN client program


Complete the SVN server installation configuration, how to use SVN it. Under Windows, the most commonly used SVN client is TORTOISESVN, sometimes referred to as TSVN.
Can be from

Http://tortoisesvn.net/downloads Download the latest version, the current version is TortoiseSVN-1.4.1.7992. After downloading, install. Reboot the machine for the directory icon to take effect.
or download from http://www.7xm.net/soft/softdown.asp?softid=11321
In the Explorer, the right mouse button clicks anywhere, "SVN Checkout" appears in the right menu, which is the successful installation.


2.2 SVN operation Process
The general process developers use SVN for development is:
Checkout (check out) item
--> Update files or directories--> update
--> modify file or directory--> commit (commit) changes
--> add file or directory--> Add (add) file or directory--> commit (Submit)
--> Delete files or directories--> commit (commit) to a previous level directory
Among them, checkout only once, update, commit, add operations will be used as often as needed.


2.2.1 Checkout (check out) operation
In the Explorer, right-click anywhere and choose SVN Checkout in the menu.
The dialog box appears, and the SVN string is entered in "URL of repository:"
Format is protocol://ip:port/version library/project/directory.
Enter according to the actual situation, for example

Http://code.google.com/p/google-web-toolkit/source.
To enter a directory for local code in checkout directory, select an empty directory or a new directory.
SVN will empty all the files in the directory. When you have finished typing, click the "OK" button.
If required, prompts for a username and password. After the "Save Authentication" is selected, you can log on automatically at a later time without losing the password.
Checkout ... Sometimes it can be a long time. End, point "OK".


2.2.2 Update (UPDATE) operation
In Explorer, select the local directory or file, and the right mouse button selects "SVN Update." Will be prompted to have no files need to be updated, point "OK" completed.


2.2.3 Commit (Commit) operation
Commit the changed files or directories in the local directory to the version library.
To add a new file or directory, first use Add, then commit.
Deletes a file or directory, commits a previous level directory.
In Explorer, select the local directory or file, and the right mouse button selects SVN Commit.
Displays an interface that is divided into 2 boxes. Enter descriptive text in the upper box, suggest a write version number, or change the reason for future lookups. The following box lists the contents of the submission. There is no content to submit, and a description of the text appears in the box below. Point "OK".
End of submission, display result. Point "OK".


2.2.4 Resolve Code Conflicts
If a commit appears, "You have to update your work copy a." Red warning, stating that this file in the version library has been modified by someone else.
Please click "OK" button to exit. Execute update, and then commit.
If the modification does not conflict with the code obtained by update, it is merged automatically. If a conflict, such as a modification of the same line of code, occurs, the "one or more files are in a conflicted state" appears. Red warning, and produces several file record conflicts.

In general, we do not edit conflict files directly. Instead, resolve the conflict manually by following these steps.
In Explorer, select the file to which the commit conflicts, and the right mouse button selects "Edit conficts".
The interface is divided into "theirs", "Mine" and "merged" 3 parts, representing "Other people modified content", "I Modified Content" and "merged results" 3 parts. We are going to combine "other people's changes" and "What I modify" to form a "merged result".

The merger is generally divided into 4 different situations:

1. Keep "My Changes" and discard "other people's changes". Right-click the corresponding line of the mine box, click "Use this text block".
2. Discard "My Changes" and keep "other people's changes". Right-click the corresponding line of the theirs box, click "Use this text block".
3. Keep "My Changes" and "other people's changes" at the same time, and put "My changes" in the front. Right-click the corresponding line of the mine box, click "Use text blocks from mine before theirs".
4. Keep "My Changes" and "other people's changes" at the same time, and put "other people's changes" in the front. Right-click the corresponding line of the mine box, click "Use text blocks from theirs before mine".

Merge complete, Ctrl+s save, exit.

Then, in Explorer, select the conflict file, the right mouse button selects "Resolved", and the tag conflict is resolved. The file created by the conflict is automatically deleted. At this point, you are ready to proceed with the commit operation.


2.2.5 Add (ADD) operation
To add a new file or directory, first use Add, then commit.
In the Explorer, select the new directory or file, and select "Add" in the right mouse button menu.
Prompts for additional files. Click "OK" to continue. End point "OK".


2.2.6 Delete operation
Deletes a file or directory, commits a previous level directory.

3  Appendix:
describes several sites that provide SVN source control free of charge
Domestic:
http://www.coollittlethings.com/
only need to register to use, fast, using HTTP for transmission, No Web management functionality.
Foreign:
http://code.google.com/hosting/
Google provides, faster, application can be used, using HTTPS for transmission, security, high reliability, with web management functions.
Http://developer.novell.com/wiki/index.php/Project_Hosting
Novell offers, applications need to be audited, faster, with HTTPS for transmission, security, high reliability , with Web management capabilities. The
is recommended for use by Google.

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.