SVN quick tutorial

Source: Internet
Author: User
Tags tortoisesvn
SVN quick tutorial

This copy from the Web site: http://www.subversion.org.cn /? Action-viewnews-itemid-1

How to quickly create a Subversion server and use it in projects is a major concern for everyone. Compared with CVS, subversion has more options and is easier, several commands can be used to create a server environment. An animation tutorial is provided here.
This article is the fastest tutorial using subversion. It helps you establish a set of available server environments in the shortest time, and can be applied to actual projects with just a slight adjustment.
This tutorial is divided into the following parts. For ease of instruction, it is used in Windows to facilitate the use of projects with limited resources. In a Unix environment, the installation method is different, and the command execution is not much different.

  • Software Download
  • Server and client Installation
  • Create a version Library (repository)
  • Configure users and permissions
  • Run an independent server
  • Initialize Import
  • Basic client operations
1. Download the Subversion server program.

Download the binary installation file from the official website, go to the Binary Package download section, and find
For Windows NT, 2000, XP and 2003, select Apache 2.0 or Apache
2.2, so we can see a lot of download content, currently can download Setup-Subversion-1.5.3.msi.

Download the subversion of the Windows client tortoisesvn.

Tortoisesvn is a tool that extends Windows Shell and can be seen as a plug-in for Windows resource manager. After installation, Windows can identify the working directory of subversion.
The official website is tortoisesvn, the download method is similar to the svn server in front, in the download page we can choose to download the version, the current maximum stable version of the installation file for the TortoiseSVN-1.5.5.14361-win32-svn-1.5.4.msi.

2. server and client Installation

Server Installation, run the Setup-Subversion-1.5.3.msi directly, as prompted to install it, so that we have a set of servers can run the environment.

Install tortoisesvn, also directly run the TortoiseSVN-1.5.5.14361-win32-svn-1.5.4.msi according to the prompts to install, but after the completion of the last will prompt whether to restart, in fact, restart is just to make SVN work copy in the special style of Windows effective, it has nothing to do with all the actual functions. In order to immediately see the good results, restart the machine.
 

3. Create a version Library (repository)

To run the Subversion server, you must first create a version Library (repository), which can be seen as a database for storing data on the server. After the Subversion server is installed, you can run it directly, for example:

svnadmin create E:\svndemo\repository

A version library is created under the directory e: \ svndemo \ repository.

We can also use tortoisesvn to perform this step graphically:
Right-click the directory e: \ svndemo \ repository and choose tortoisesvn> Create repository here... ", then you can select the version library mode. Here you can use the default mode, and then create a series of directories and files.


4. Configure users and permissions

Go to the E: \ svndemo \ repository \ conf directory and modify svnserve. conf:
# [General]
# Password-DB = passwd
Changed:
[General]
Password-DB = passwd

Modify the passwd file in the same directory and remove the following three lines of comment:
# [Users]
# Harry = harryssecret
# Sally = sallyssecret
Finally changed:
[Users]
Harry = harryssecret
Sally = sallyssecret

In the passwd file, the character before "=" is the user name, followed by the password. Note that the comment "#" before "[users]" must be deleted.

5. Run the independent server

Run the following command in any directory:
Svnserve-d-r e: \ svndemo \ repository our server program has started. Do not close the command line window. Close the window will also stop svnserve.

6. initialize the Import

Go to the project root directory we want to import. In this example, E: \ svndemo \ initproject. the directory contains a readme.txt file:


Right-click tortoisesvn and choose import...
Enter "SVN: // localhost/trunk" in the URL of repository"
Enter your log information in import message

After that, the directory remains unchanged. If no error is reported, all the data has been imported to the version library we just defined.

Note that this step can be performed on another host 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/trunk ".

7. Basic client operations

Extract the version library to a working copy:

Go to any empty directory, in this example, E: \ svndemo \ wc1, right-click-> checkout, enter SVN: // localhost/trunk in URL of repository, in this way, we get a copy of work.

Make changes in the work copy and submit:

Open readme.txt, modify it, and right-click commit... to submit the modification to the version library. We can run it.

View the modifications:

Right-click readme.txt-> tortoisesvn-> show log, so that we can see all the submissions to this file. Right-click on version 1 and choose compare with working copy. We can compare the differences between the working copy file and Version 1.

Finally, all the content has been recorded as an animation file for your reference.

If you have any comments in this tutorial, we can discuss them here.

  1. After the file is updated, two or more people modify the location of a file at the same time to determine whether the file is in conflict. (this is generally not the case because the uploaded version can be compiled, in addition, each person is responsible for his/her own module. No one will modify the same file independently. Others will also update the file first, and then upload and modify the file ,,,,)
  2. Developer's habitual actions. The first thing to do at work in the morning is to update the SVN version library and start the day's work.
  3. After work in the evening, or when you want to upload things, you can directly upload things because you are not responsible for any changes.
  4. How does a conflict come about: Because different people modify the same file in the same place at the same time, at this time, he submitted it. If you didn't submit it, you couldn't submit it, at this time, you need to update first, and the update will cause code conflicts. It is best not to have multiple users modify a file and a public file at the same time. before changing the file, you should communicate with us or solve the conflict.
  5. Update first, no conflict exists, and then submit. If a conflict exists, resolve the conflict and submit it again. Otherwise, it cannot be submitted.
  6. For some files in conflict, right-clickTortoisesvn-> resolved. Resolution conflict: http://www.blogjava.net/jasmine214--love/archive/2011/04/07/347769.html
  7. Update-conflict resolution-delete the following three files-submit (if there is a conflict with the files you have not modified, delete and update the files, and resolve the conflict with the files you modified)

Test. php. Mine is your own file before the conflict

The test. php. version number is the local version file before the conflict.

The version number of the test. php. server is the version file of the server after the conflict.

SVN code conflict and cannot be submitted

Zhang Ying posted on

CATEGORY Directory: Server-related

For those who are new to SVN, it is depressing to fail to submit SVN after the svn conflict. The most depressing thing is the coverage between codes. You have built my code, and I will be very angry. It is uncomfortable for anyone who has built it.

Why is there a code conflict? Because different people have modified the same part of the same file at the same time. At this time, he submitted the file. If you didn't submit the file, you couldn't submit it, at this time, you need to update first, and the update will cause code conflicts. In general, you should try to avoid modifying the same file by multiple people. If you change the file to a public file, it is best to check it out with everyone.

Next I will introduce a common solution to conflicts that will not overwrite the code. Take test. php as an example:

1. the file cannot be submitted after modification, mostly because of version inconsistency. Update the file and submit the file without conflict.

2. Update the file. If a conflict occurs, open the file test. php and you will see the content similar to the following:

<
Asdfadfadfadf
11111111111111
========
Asdfadfadfadf
111111111111111
222222222222
>>>>>>>>>>>>>>>>

Combine the content modified by others and the content modified by yourself, and then remove the <<<<<===,>>>>>>> conflicting symbols in the file. After removal, it still cannot be submitted. Why? Because three files are generated during the conflict, these three files cannot be submitted.

Tortoisesvn used by the client (this is estimated to be the most commonly used by programmers). When a conflict occurs, three files are generated.

Test. php. Mine is your own file before the conflict

The test. php. version number is the local version file before the conflict.

The version number of the test. php. server is the version file of the server after the conflict.

When submitting the file, you can delete the three files and submit them.

3. Cause of overwrite.

A) when modifying the conflicting file test. php, all other code is deleted, leaving only your own code. In this way, overwrite is generated.

B) Directly copy the content in test. php. Mine to the test. php file, which will overwrite the code.

In the above two cases, I have my own eyes on the new users and want to avoid these two operations.

Original article: http://blog.51yip.com/server/1071.html

  • To avoid conflicts, you must update the file before modifying it.

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.