[. NET object-oriented programming advanced] (23) Team Development Weapon (ii) Excellent version control tool SVN (top)

Source: Internet
Author: User
Tags svn client svn update version control system tortoisesvn

[. NET object-oriented programming advanced] (23) Team Development Weapon (ii) Excellent version control tool SVN (top)

This article guide:

The previous article introduced the Common Code management tool VSS, looked at a comment, many classmates detest, some even because the company uses VSS to resign. In fact, what code management tools to use depends on the project. After all, the use of code management tools, is the project manager according to the needs of the decision, if you are a developer, first of all to make their own technology to a point. Here is my personal understanding of these common code management tools to use the scene briefly introduced.

1. Application scenarios for several agent management tools

A. If your project is a small team of 5-6 people, then using VSS is ready.

B. SVN is a good choice if you are a team of dozens of people who need to create a branch of code or need to cross-platform and cross-regional development.

C. For larger projects, if you are using VS development, then using TFS is a good choice, and Microsoft's own product combination can be said seamlessly. and provide the project planning, test management, code review and other packages, such a powerful project management tools, we can not say he is not good, just compare the weight, light on the server-side installation package is more than 2G, and needs the results of SQL Server database work.

D. If your project is open source and there are more branches, then Git is recommended.

2.SVN Introduction

Name: SVN (subversion abbreviation, open source version control system)

Vendor: Open source Project (CollabNet initiated and provided start-up funding, currently WANdisco is the most contributing full-time subversion developer and serves as release manager.)

Features: Support to create branches, flags, support rollback, transactions, etc.

Advantages: Installation operations are relatively simple, support cross-platform, cross-region management code, faster speed, support for file renaming, support for non-locking development, easy to manage, in line with popular thinking habits, easy to get started, agent consistency is high.

Disadvantage: Suitable for small and medium-sized projects, the number of people in dozens of is preferred; not suitable for a large number of projects, such as open source projects, server overhead, database prone to explosion, can not work offline, not connected to the server, can not be compared, restore, submit and other work.

Upgrade: Open source projects, management ratio is also more standardized, upgrade is timely, there is a new version, the writing of this article has a new version of 1.9.3.27038 updated (2 days ago updated, visible very timely).

Recommended: ★★★★ (for medium and small projects)

Installation and use of 3.SVN

First, SVN and other version control tools have the server side and client side, respectively, the following describes the installation and use.

3.1 Installation package Download

installation package, we can download from the official website, the website provides Linux and various versions of Windows that can be used, we mainly introduce the installation using under Windows

Download url:http://subversion.apache.org/packages.html

Pull to the bottom.

For example, there are two installation packages we need, first click on the first "TortoiseSVN" This is a client tool that is used primarily for binding with Windows Explorer for file management

Click to go to the "Little Turtle" download website as follows:



Available in 32-bit and 64-bit versions, respectively, according to our operating system download the corresponding. Here are the various language packs. We download Simplified Chinese

Then, we click on the second address of Figure 1, go to the server and vs plugin download website, such as:

We download "VisualSVN for Visual Studio" which is primarily used for VS development source code versioning.

Download "VISUALSVN Server" This is the administrative tools that need to be installed on the server.

A total of four installation packages, downloaded as follows:

I am a 64-bit operating system, the download is all 64-bit, can be downloaded according to their own operating system 32-bit or 64-bit

3.2 SVN server-side installation

Double-click the downloaded "Visualsvn-server-3.5.0-x64.msi" to enter the SVN server installation

Next

Select the consent statement and click Next

By default, install Server and administrator tools and command line tools, click Next

Here we choose the Standard Edition, the Enterprise Edition needs to pay $950 per server, the standard version is free, and its function can basically meet our needs. Click Next

Here location is the installation path, Repositorys for the database storage address, the following is the port number and whether to use a secure connection, by default, click Next,

Configuration complete, point install installation

When the installation is complete, select Start SVN server.

3.3 SVN server usage

3.3.1 Creating a version Library

Open the SVN server that you just installed, "VISUALSVN server Manager" below

The service side of the main interface to the right of some state information, the left is the repository we created, users and groups.

Right-click on the Repository and open the menu to create the repository, import the existing repository, and browse.

We clicked "Create New Repository." To create a new repository, open the window as follows:

Here is the Select repository type, we press default, click Next

Enter a repository name here and click Next.

Here we press the default, select Create an empty repository, click Next,

Here is to create a new version of the repository, set the authentication method, we press the default, select "All users have read and Write permissions" click Create, complete the new version of the library.

Click Finish to end the repository creation.

3.3.2 Creating a user

Create users below, such as:

Right-click Users to open the Create User opposite box, enter a user name and password, click OK,

Right-click the group and click Create Group

Enter the group name Dev, click Add below to join the previously created user Yu to the group, click OK

3.3.3 User Authorization

Right-click on the version library name MyObject that you created earlier, open the menu and select Properties ...

Open the Permissions window below and we click Add. Adding a user or group, where we can select a group, means that all under that group has the appropriate permissions, or you can choose a single user

We select the Dev group name and then select the readable writable permission in the permissions, as

At this point, the server configuration is complete.

3.4 SVN Client Installation

Below we install the SVN client and find the installation package we downloaded earlier,

Install the "Little Turtle" Tortoisesvn-1.9.3.27038-x64-svn-1.9.3.msi first, then install the language pack Languagepack_1.9.3.27038-x64-zh_cn.msi

Client installation Nothing to say, the whole next step.

Language pack installation is also the next step (if you like the English version, this can be omitted)

After the language pack is installed, the installed language is not displayed immediately and requires one-step setup.

In the Start menu, we find TORTOISESVN settings, or you can right-click on any file on your PC setting

Open the Settings window, click General, and in the language options on the right, select Simplified Chinese to complete the language setting.

at this point, the client installation is complete.  

3.5 SVN Client Basic operation

This section is the focus and will learn how to use SVN for version control

3.5.1 Checking out project files

First we create a project folder on the client computer, MyObject

Right-click the project folder, click Check Out

Open the Checkout window,

Here, we are going to enter the repository address created in the previous service, we can copy this address on the server side, open the server side

Right click on the repository, click on the Rul, then paste it.

There are several options to check out the depth, and here we have the default full recursion. Click OK

This will bring up an authentication window, where you need to verify the user, using the user created by our server

The following save authentication, which is selected by default, is checked and checked out the next time, so you do not need to validate again. If the computer for you to use, you can save, such as multi-person use, please pay attention to security.

When you click OK, the checkout completes if the authenticated user succeeds.

After checkout is complete, because our repository does not have any files, so this project folder is also empty, at this time, if we show hidden files and folders

As you can see, there is one more hidden folder in the folder MyObject

. SVN this hidden folder records very important information, including the working file version and local copy time, and so on, remember, do not manually modify or delete, otherwise your local copy will be destroyed , unable to normal version control.

3.5.2 File 9 Icons meaning

After we install the Ancheng SVN client, we need to restart the computer or log off the computer, we will find that the local file or folder added to the repository has an SVN proprietary small icon, a total of 9 kinds, the following are the meanings of several icons:

Green tick : The icon indicates that this is a newly removed working copy, and his subversion status is normal.

Gray tick : The gray icon indicates "read Only" and if you set the Svn:needs-lock property to a file, subversion will make this file read-only until you get the file lock. A read-only file has this overloaded icon to indicate that you must get a lock before editing.

Red exclamation point: When you start editing a file, the status of the file becomes modified, and the icon turns into a red circle with an exclamation point. This way you can easily know which files have been modified since the last update and which files need to be submitted.

Yellow exclamation point: A triangular sign with an exclamation point indicates a conflict (conflict) has been created in a single update.

Blue plus sign : This means that the file or folder has been scheduled to be added under version control.

Red Fork : Indicates that the file or folder is scheduled to be deleted (deleted), or that the file is missing.

Gray Line : Indicates that version control is not controlled and is ignored.

Blue question mark : not yet received version control, but not ignored.

Lock : Indicates that the file is locked, his subversion status is normal, the lock must be released before someone else's changes can be submitted.

In fact, this icon, we can also be in the SVN client settings to change the style, the following is a few SVN styles to choose from. (I have to say, SVN thought very thoughtful, good software is the case)

3.5.3 adding files to the Repository (add)

The addition of new files, there are two ways, one is to add (add) first add to the change list, then submit, and the second is to submit directly,

A right-click menu for adding and updating, respectively,

If you first join, then submit, the file will be automatically selected, and the status is increased, if submitted directly, you need to manually select the file, such as, click OK, complete the file Add.

At this point, on the server side, click Refresh Repository, we will find that a new file has been successfully added.

3.5.4 Deleting a file (delete)

If the deleted file has not been added to the repository, you can delete it directly, if you have joined the repository, you need to right-click the file, select the SVN delete

After deleting a file, the parent directory will have a red exclamation mark, indicating that the file under that directory has been modified, and we need to submit a parent directory at this time.

3.5.5 file Renaming (Rename)

Modify the filename, select the file or folder you want to rename, then right-click "tortoisesvn update filename", enter the new name in the popup dialog, click the "OK" button, and the file or folder after the modified file name is submitted to the SVN server via "SVN commit".

3.5.6 Restore (Revert)

Restore a file or folder to a previous version, as follows

Right-click the file or folder in TortoiseSVN, click Update to Version ....

Open the Version Update window, select a previous version in the display log, or enter the version number to be rolled back in the version number.

3.5.7 checking for updates (check for modifications)

This feature, you can see what changes you make without prompting, including file or directory additions, modifications, deletions, etc., click to check the repository, you can see other people change the content

3.5.8 Update (SVN update)

Update the local file with the latest version of the SVN server, right-click on the folder that needs updating or right-click on the blank in the file, select "SVN update" (Get the content in the specified version, right-click on "Update to version" in the SVN menu).

Note: If you create a new file or folder that is not added to the server, the file or folder will still be present (this is also an SVN-friendly place to disagree with, not to lose the files that have been created because of newer versions)

3.5.9 resolving conflict files

After the update, there are often conflicting files, because SVN support does not lock the changes, that is, when you edit the file, others can also change the file. If you have updated the same piece of code for the same file. After the update, three backup files are generated and the conflicting files are marked.

There are two solutions to this often-problematic problem:

1. Discard your updates and roll back to the previous version

2. Negotiation, modify the code and submit

Of course, SVN also provides us with a conflict code comparison function.

Open "Compare with Previous version", can be compared, to modify the code, to achieve consistency after submission.

If the conflict code is not handled properly and one party code is lost, do not be afraid, SVN can still reply to the lost content through "update to version".

3.5.10 display log (show log)

Right-click on the SVN menu and select "Show Log" to see who did what.

3.5.11 version Browser (repo-browser)

Right-click on the SVN menu to choose "Version Browser", enter the URL address, not logged in need to verify the user, where you can see other people on the operation of the version, such as locking operations.

Not finish the next article to continue ...

3.6 Key points in this section

This section focuses on a very good and large number of source code version control tools SVN (full name: TortoiseSVN), its usage scenario for dozens of people of small and medium-sized development team, with cross-platform (HTTP access), cross-region, lightweight and many other advantages.

The introduction of the online SVN has a lot of posts, this article also reference some other articles, write more detailed, as far as possible do not miss. SVN's shortcomings are almost negligible compared to his merits, lightweight determines his positioning is the small and medium-sized team, so you do not say he and other managers can not support high concurrency, super-users and so on. Finally, because the space is too long, it will look very tired, the SVN branch and other advanced content will continue to be introduced in the next blog post, in addition to the next chapter will describe the use of SVN in Visual Studio 2013/2015, there are some SVN's use of small tricks, I hope support!

==============================================================================================

Back to Catalog

< If it is helpful to you, please remember to click on the recommendation Oh, if there is There is no understanding or error , please exchange >

< for those who have difficulty reading this series of articles, please read the basics of. NET object-oriented programmingfirst >

< REPRINT statement: Technology needs to share the spirit, welcome to reprint the article in this blog, but please specify copyright and url>

. NET Technology Exchange Group: 467189533

==============================================================================================

[. NET object-oriented programming advanced] (23) Team Development Weapon (ii) Excellent version control tool SVN (top)

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.