SVN local: a good way to manage personal source code (zz)

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

SVN, local, and personal source code management

Today, in the QQ group, someone was inquiring about the VSS plug-in of Delphi, so I got a bit of it. I recently tried SVN, and I felt very good, so I strongly recommended it in the group, so I was almost considered a SVN child care. -_-|

In fact, SVN is indeed the best source code management tool I have ever used. Although I have not used many of these tools, only VSS, CVS, and SVN are available, others, such as PVCs, teamsource, and clearcase, are only heard of, because they are commercial products and are usually used to manage large projects, and there is no chance to try them out, so they do not know how they are. VSS is the first source code management tool I used in my company four years ago. However, it is too general and also a commercial product. So I don't need to work in the company. After that company came out, I tried CVs and started to manage my source code. As an old source code management tool in the OSS circle, I don't need to talk about how powerful CVS is. But now the new star of SVN has gradually replaced CVS. It can be seen that SVN has its own killer. Another important thing is that it is also an open-source free software.

SVNThe full name is subversion. Like CVs, SVN is a cross-platform software that supports most common operating systems. This article only discusses windows. Its official website is: http://subversion.tigris.org (Tigris is an open-source website similar to SourceForge, unlike SF, which provides CVS services, while Tigris provides SVN services ).

Before introducing the application of SVN, we should first discuss an important basic concept of source code management:Repository. Repository is the centralized storage of source code. The source code submitted after all modifications is saved here, and all the modified versions, branch versions, version merge, and concurrent modification processing are recorded. Traditional VSS or CVS use a method similar to C/S, and there is an independent server to do this. SVN is much more flexible. It supports three methods:Independent Server Mode,Web Server Mode(This is not what CVS does) and this article will focus onLocal.

Return to the topic.Personal source code managementIt is a concept I proposed to distinguish it from the source code management developed by the team. Tools such as VSS, CVS, and SVN are mainly used for team development and are used to deal with Version Control of source code modification conflicts and concurrent modification conflicts. However, for personal development, there is no conflict of concurrent modifications. However, personal development has some new problems: Generally, individuals do not have the condition to build an independent server for repository. Therefore, even if CVS is used, the server client is deployed on one machine, user permission management is not required. But sometimes source code needs to be copied between different machines for development, which brings potential risks of version confusion. The Local Mode of SVN is the best solution.

My current usage is: create a repository in the USB flash drive, and then install SVN on each machine, so that I do not need a separate repository server, you only need to plug in the USB flash drive on any machine to implement the complete version control function.
 

Install and use SVN.

This article only discusses the Local Mode in windows, so no independent server or web server is required. The SVN client works like CVs in the command line mode. However, on the Windows platform, we have other options. This is a good implementation of ease of use:Tortoisesvn(Note: This is a svn-independent project, similar to the relationship between wincvs and CVS ). Its official website is: http://www.tortoisesvn.org, download its installationProgram: TortoiseSVN-1.1.3-UNICODE_svn-1.1.3.msi (this file name is for NT/2 k/XP ). This integrated release package contains all the content required by the local application. If you want to use the Chinese version, you can also download this Chinese Language Pack: languagepack_1.1.3_zh_cn.exe (this is a simplified Chinese package, BTW: From the progress point of view, the Traditional Chinese version is more completed: P ). For other methods such as independent server, web server, command line, and Python support, the corresponding installation package must be provided. You can refer to the svn website instructions for downloading and installing.

The installation process is very simple, but after the installation is complete, you must restart it because it must be integrated into the windows Resource Manager.This is another major advantage of SVN.(Thanks to mikeshi for pointing out that CVS also has a tortoisecvs, which is not an advantage of SVN.) Although CVS also has a wincvs, it is not as convenient as tortoisesvn because it is an additional Client. After tortoisesvn is installed, right-click any folder in the resource manager and you will see the menu shown in (I typed a Chinese package, so it is displayed in Chinese, you canSettingsSelect any language pack that has been installed ):

Step 1: create a local repository

Assume that you want to start a project named project1. Create a folder U:/SVN/project1 on the USB flash drive (assuming U. Right-click the folder and select:Tortoisesvn | create a file library here. There are two ways to choose from, such:

Berkeley database and local file system. The local file system method is similar to CVS, but the implementation method is different. Berkeley database is said to be the best Embedded Database solution at present. tortoisesvn adopts the bdb method by default, which is recommended. After creating the file, a prompt window will pop up, indicating that the file library has been created successfully.

Step 2: Create a jobCompositionClip

Create a working folder D:/working/project1 on the local disk (such as disk D. Right-click the folder and select:SVN Retrieval. The following dialog box is displayed:

The only one that needs to be specified is the file library URL. The local method is to use the file protocol. After confirmation, the following dialog box is displayed:

Click OK to complete the creation. A Hidden Folder:. SVN is displayed in the folder. Some necessary information about the working folder is recorded, which is the same as the CVS folder in CVS. A green check box will be added to the icon of a svn working folder, and the green check box will be added to all content added to respository,

Step 3: Start Program writing

You can now create source program files or folders in this working directory. Add some projects to the shortcut menu of any files or folders (except the. SVN folder) in the working folderWorking folder,Subfolders in the working folder,Files in the working folder,Submitted filesRight-click menu content:

From the leftmost menu and rightmost menu, we can see that SVN/tortoisesvn supports almost all functions of CVS, some useful functions are also added (such as renaming files/folders, which is one of the most troublesome problems in CVS ). This is also a major advantage of SVN.

If your source program exists, you can import it to repository immediately: Right-click your original source program folder and selectTortoisesvn | Import. You can. But note: it is best to firstTortoisesvn | setTo set the exclude/ignore style (folder or file name can be set, wildcard characters are supported, Case Sensitive !!!), Or delete unnecessary imported files first. ThenRetrieve(Checkout) to the working directory.

Step 4: submit the written program to Repository

Select all the files and folders to be added, and clickTortoisesvn | add. The following dialog box is displayed (this document is used as an example ):

Add them to repository. After confirmation, a "+" sign will be displayed on its icon, indicating that the file has been added but has not been submitted. Right-click the current folder and selectSVN submissionYou can. The following dialog box is displayed (submit this article, where the repository is actually used)

After the submission is successful, a green check shown above is displayed on its icon.

Step 5: daily use

It is nothing more than repeating the previousJoin/submit. If it is used on another machine, you need to re-create the working directory andRetrieve(Checkout) source code in repository. UseSVN updateFunction to update the content in this working folder to the corresponding version in repository.

For more functions, see online help and other documents provided by the website.
 

Finally, I wish you all the convenience and pleasure of SVN.

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.