SVN usage notes for the first time

Source: Internet
Author: User

I searched for SVN tutorials online. Article They are similar and difficult to find what they need. So I will sort out some useful information for me so that I can check it later!

Installation and deployment
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 sections, not only the Quick Start, but also some advanced functions. To make it simple, the tutorial is used in windows, in order to facilitate the use of resources for limited projects, there is no big difference in UNIX environments.

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. Software Download

Download the Subversion serverProgram.
Download the binary installation file from the official website, download the Binary Package, find Windows NT, 2000, XP and 2003, and select "this directory ", so we can see a lot of download content, currently can be planted svn-1.2.3-setup.exe.

Download the Subversion 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 that of the svn server. On the download page, select official version for Win2k/XP or higher, then on the SourceForge download page, select the current highest stable version of the Installation File TortoiseSVN-1.2.4.4479-svn-1.2.3.msi.

2. server and client Installation

Install the server and run svn-1.2.3-setup.exe directly. Follow the prompts to install svn-1.2.3-setup.exe. In this way, we have an environment where the server can run.
Install tortoisesvn, also directly run the TortoiseSVN-1.2.4.4479-svn-1.2.3.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

5. Run the independent server

Run the following command in any directory:

Svnserve-d-r e: \ svndemo \ Repository
Our server program has started.

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"
OK
After that, the directory remains unchanged. If no error is reported, all the data has been imported to the version library we just defined.

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.

Common operation set:

Simply put, tortoisesvn can be considered asCodeThe version control tool facilitates code compilation by multiple users. Many open-source files use SVN Source code Management tool, you can easily get the code after learning tortoisesvn.
Tortoisesvn Function Rich, but we only need to learn two simple operations. The first is Download Code, and the second is upload. The following describes each function.
Export... download
Because most open-source projects can be directly downloaded, and some permissions may need to be activated for upload, you should first download the code.
1. Download and install tortoisesvn. You won't see any executable programs, because tortoisesvn is embedded in windows.
2. Create an empty folder and right-click it to view the tortoisesvn menu and SVN checkout above.
3. Don't worry about this checkout. We will select export... under the tortoisesvn menu, and then it will let you enter the URL.
4. For example, enter the svn address of [maze treasure] as follows: Http://game-rts-framework.googlecode.com/svn/trunk/
5. Other options do not need to be changed. Do not select omit externals. The "head revision" option indicates the latest code version. Click "OK" to export the code to this directory :)
Just like decompression, isn't it? You can also download tortoisesvn source code from here:
Http://tortoisesvn.tigris.org/svn/tortoisesvn/
You may need to log on here. The user name is guest and the password is left blank.
Checkout... move out
Checkout means to check out, although Effect In the same way, the code is downloaded from the server to the local machine, but the checkout has the verification function. The code that is checkout to somewhere will be monitored by tortoisesvn, and the files in it can enjoy various SVN services.
If you select the checkout, the directory will be associated with the svn address. The changes here can be submitted to the svn server. This indicates that the Code will be written, and the permission must be activated.
You can Http://code.google.com/hosting/ Select create new project to obtain a SVN space provided by Google and upload your code. I will not detail the application process here. Just fill out a simple form.
Now, let me assume that you have obtained an SVN account and password, for example, our RTG project:
Https://game-rts-framework.googlecode.com/svn/trunk/
Note that the preceding example is https: //. If one s is added, it indicates security, which means verification is required.
Assume that the user name is guest and the password is ABC (the user name and password can be assigned to you by the Project Manager)
1. Right-click a directory and choose SVN checkout... the link is displayed. Enter the URL on which it is placed. Do not change other options, similar to export.
2. Enter the correct content when you need to enter the user name and password, and a code download screen will appear.
3. After all the files are checkout, the directory will have a green check, indicating that the Code had to be modified in the last update.
At this time, the files in the directory will have a green check. If you modify them, a red exclamation mark will appear, indicating that the file has been modified. All checked files in this directory are currently under tortoise monitoring. You can right-click the file and you will find that you can perform many operations. Next I will select some of the more common ones to explain.
Commit, revert, add, merge, delete... submit, undo, add file, merge conflict, delete
If you update files in the directory, you can use the commit function. This function uploads your local file modification records to the server, which can be understood as uploading.
But the function of commit is not just to upload files. It will be compared with files on the server. If you update a file and someone on the server updates the file, and it is an update after you checkout, then it will try to integrate your update with others' updates (merge). If the automatic merge fails, then report conflict, you must manually write your own merge, that is, to write your updates in conflict with those of others.
It is best to fill in the log information during the commit, so that others can see what your updates are written. This is equivalent to uploading files and explaining the modifications made by myself. log is very important when many people work together.
Tortoisesvn commit only uploads the file that was previously checkout and modified. If you add some new files, you need to right-click the file and select Add. A plus sign will appear on the file, the next commit will be upload and marked as a green check. Files without a green check mark will not be commit.
If you need to rename or move a file with a green check box, do not use the Windows function. Right-click them and tortoisesvn has corresponding operations. Imagine that these files are no longer your local stuff. Tortoise must be aware of every action you make.
If you modify a file but you regret it, right-click it and select revert, which will change back to the last checkut. Or revert the entire project to any previous version.
Update)
If it is a multi-person project, others need to modify it if they do not modify it themselves. In this case, update is used to synchronize the code on the local server and on the server. Right-click and select update. All changes will be uploaded from the server to your hard disk. NOTE: If someone else deletes a file, you will also be deleted locally after the update.
If the local code has been modified, merge will be performed first like commit, and conflict will be reported if the Code fails.
Other ......
If some files do not want to be modified by others, you can also perform the lock operation.
You can also view the show log menu of all logs, the revision graph in the real version update graph, and the repo-browser of the server directory structure.
In addition, the tag creation operation is equivalent to copying the current code version to other places, and then starting from this place for new development, with no interference with the original version.
These are relatively advanced Application For more information, see help. Document http://tortoisesvn.net/docs/release/TortoiseSVN_zh_CN/
Right.

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.