TORTOISESVN Introduction to use

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

TORTOISESVN Introduction to use

TORTOISESVN Introduction to use

2009-04-24 Source: dev.idv.tw

    • 1 Installing and downloading client side
    • 2 What is svn (Subversion)?
    • 3 Why use SVN?
    • 4 How do I build svn Repository under Windows?
    • 5 Creating a working directory
    • 6 Add files and directories to Repository
    • 7 Updating files and directories
    • 8 update to a specific version
    • 9 Copying Files and directories
    • 10 making tag or release
    • 11 Quick Reference
      • 11.1 obtained (Checkout) Repository
      • 11.2 Updating (update) files or directories
      • 11.3 New (add) file or directory
      • 11.4 Commit (Commit) modified file or directory
      • 11.5 copy/tag/branch/release File or directory
Install and download client side
    1. Download the Windows-side program: Http://tortoisesvn.net/downloads. Generally, if Windows XP is 32-bit, this file should be used by Tortoisesvn-1.4.x.xxxx-win32-svn-1.4.x.msi. If it is a 64-bit operating system, you should use the Tortoisesvn-1.4.x.xxxx-x64-svn-1.4.x.msi file.
    2. Execute the downloaded TORTOISESVN installer and the installation will be tortoisesvn. Once properly installed, a reboot should be performed to ensure that the TORTOISESVN is correct.
    3. After the installation is successful, press the right mouse button within the File Manager and you should see the following screen:

Most of the tortoisesvn operation is done through the File Manager and right mouse button. If you've used Tortoisecvs before, you should be very gracious about how this works.

What is svn (Subversion)?

There is a simple but not very precise analogy:

SVN = version control + Backup Server

Simply put, you can think of SVN as your backup server, and better yet, he can help you remember the contents of every file you upload to this server. and automatically give each change a version.

In general, we call it the place to store the uploaded files and do repository. In Chinese, a bit like the meaning of a file warehouse. However, we usually use the term repository. Basically, for the first time, we need to have a new file action to put the files you want to back up on repository. Later, when you have any changes, you can upload to repository above, uploading the existing and modified files is called a commit, that is, to commit the changes to the SVN server meaning. A new version will be given to COMMIT,SVN server for each time. At the same time, each upload will be recorded. Later, because of certain factors, if you need to download the file from repository once submitted. You can choose to get the latest version directly, or you can get one of the previous versions. If you forget the version, you can still try to get the version of a date by memory.

Why use SVN?
    1. It is important to back up your work files. You never know when a hard disk on your computer will break. According to the rule of thumb plus the Murphy theorem, bad feelings often occur at the most important moment. For example, to release something the first moment, the hard disk is completely broken, unable to repair. Therefore, it is very important to back up your work data often. Most companies have a dedicated backup mechanism or even offsite redundancy for their servers. It's safer than putting it on your own computer, or on a portable disc.
    2. Version control is very important. You cannot guarantee that the latest version at hand is always right. Many times, after a few days of hard work, you find the wrong way. All changes need to be restored to a few days ago. Few people can fully remember what they have changed. If you do not do the version control, then the worst situation is to start all over again.
    3. The synchronization of data between partners is also very important. Many times, in addition to your personal, there are other partners also need your file. How to provide the latest files to the partner? By e-mail? According to experience, e-mail is a bad way. At the end of the day, there is no knowing which e-mail is new. Because maybe your latest e-mail has been lost as a spam letter. Don't forget, many e-mail software now has anti-spam function, perhaps these letters are treated as advertising letters. And, you should also know that if the general file is placed in an e-mail, the file size will become larger (usually more than 4/3 times the original). If updated every day, I am afraid a few days to confiscate the letter, the mailbox exploded!
    4. If you don't have a good idea, backing up different versions is hard disk space. For example: You have a total of 10MB directories, using simple file backup. If there are 10 versions it will become 100MB. 20 versions of 200MB. If you don't want to back up so many versions, you're going to have to reduce the number of backups. Prolonged backup cycles can lead to increased risk of data loss. Delete old unwanted backups? Based on experience, as long as the time is long, you and Ben do not know that the version one months ago is important or unimportant.

Can SVN help us solve the problem above? The answer is yes:

    1. SVN repository can be a directory on your own computer, or a portable disk (not recommended). Of course, it can be the company's server.
    2. SVN has a great version of the control mechanism. All uploaded versions will be recorded for you. You can get a version of a moment at any time in the future. There are also useful features such as version branching and merging.
    3. SVN allows different developers to access the same files and use SVN server as a mechanism for file synchronization. That is, you do not need to send the file to your development member when you have a file update. Just tell him that the new version is already on the SVN server and ask him to go to the SVN server to get the latest version. Also, SVN server can do this automatically when you upload a new version to the relevant member.
    4. The SVN storage file method is a differential backup approach. In other words, he will only back up a different place. So it saves hard disk space. In addition, he can also make differential backups for so-called non-text files.
How do I build svn Repository under Windows?

Assuming you have installed the TORTOISESVN software mentioned earlier, let's start by telling you how to use your own hard drive or a Walkman as a storage location for SVN repository. If you only want to know how to access an already established SVN server above the repository, skip this section directly.

Suppose you want to place the repository in the E slot. You need to create an empty directory first. In the following example, we set up a directory named Svn_repo below the e-slot. SVN does not qualify the repository directory name. You can create any name that you like. However, it is strongly recommended that you do not use non-English file names (such as Chinese or Japanese).

Through your file manager, on the E:\svn_repo icon, press the right mouse button and select Tortoisesvn->create repository here.

Next, you will see a window that asks you whether the repository database format you want to use is FSFS or BDB. Basically, please choose Fsfs. When you press the OK button, you'll see the next screen.

This means that your SVN repository has been successfully established. The next step is to get your files back in. Later, as long as you need to use this repository, we can use File:///E:/SVN_REPO to represent it. SVN is the way to get in touch with repository through this URL. The format of the various URLs is as follows:

file:///disk drive |/repository Directory/Sub-directory/HTTP/account @ Server name/repository directory/subdirectory https://account @ server name/Repository directory/Sub-directory Svn+ssh ://Account @ Server name/Repository directory/subdirectory

Where HTTP represents the use of a generic Hypertext Transfer protocol. HTTPS represents the use of an encrypted Hypertext Transfer communication protocol. Svn+ssh means that the channel that encrypts the communication through SSH is accessed.

Create a working directory

The so-called working directory is the place you normally use to store your work files. Usually we wait for a paragraph of our work to make a backup. So we usually work under the working directory and wait until the right time in commit to Repository. For example, we want to create a directory named working below the D-slot. First set up this directory.

At this point, the directory should be empty.

After you press the right button in the File Manager (you can press on the icon of the working directory, or you can enter the working directory, press in a blank place), select SVN checkout.

You can then see the following screen:

The first thing we want to fill in is the location of the repository, and for SVN, the location of the repository is the URL. Since we have already established a repository in the E-slot, we are now going to fill in the file:///E:/svn_repo/in the URL of repository column.

Next, take a little look at checkout directory, which should point to your working directory. After confirming, press the OK button, you should be able to see the following message window.

This means that the action is complete. Press the OK button and then go to the directory you just created. You will see a directory named. SVN below the working directory (this directory is hidden and you will not be able to see it if your profile administrator does not have the settings to see the hidden directory).

SVN will create this. SVN subdirectory under your working directory and its subdirectories. You should not go into this directory, especially if you should not change any of the contents below this directory. Otherwise, it is likely that SVN will not function properly.

Because, the original repository is empty, so our current working directory is also empty. If you are now checkout a repository that already has content, you will see that there are many more directories and files under the working directory.

If you want to checkout the above file on an existing SVN server, you only need to give the correct URL and the name of the working directory. will be able to obtain the designated files and directories.

Add files and directories to Repository

Let's say you have the correct action in front of you. Now you are starting to develop a new program. Assume that the program you are developing will be placed in the My_ PRJ subdirectory under the working directory that you created earlier. As shown below:

Let's say you've edited your files and are ready to put them in SVN's repository. You need to press the right mouse button on the icon in the MY_PRJ directory, and select Tortoisesvn->add:

Next, TORTOISESVN will show you the files and directories that are ready to be added. The tick is waiting to be added to the repository. If you have certain files or directories that you do not want to join this time, you can leave this item unchecked. In this way, it will not be added to the repository.

After you press OK, you will see the following message window:

That means it's a success. One thing to note is that this add does not actually put the file in the repository. Just tell SVN to be ready to put the files in the repository. At this point, if you view these files through the File Manager, you should see a white red exclamation mark below the profile icon.

This means that the files in your working directory are not synchronized with the files in the repository. Now we need one more commit action. Let these files really put into the repository. You can press the right mouse button on the icon in the MY_PRJ directory or in the empty space in the MY_PRJ directory to call the following menu and choose SVN Commit.

Immediately thereafter, you will see the following window appear:

In this window, a list is listed in the lower half to give you a clear idea of which files to commit to Repository. Similarly, if you have files that you do not want to commit to repository at this time, you can cancel the selected files so that they will not be commit to repository.

Above the list of files is the message column, where you can enter the purpose of this commit. This is a very important field, and you can rely on this message to know the difference between version and version when you commit many times. When you enter a good message, press OK, you can see the following window appears, notifying you that the specified file has been sent to repository.

You can go to the previous folder to determine if all the file icons have the following green Gogo on top, so that your files are correct to repository.

Sometimes, because of problems with Windows itself, you may see some icons not turning green. At this time, multiple press F5 several times, should be able to solve this problem. If, still not, indicates that your previous commit action is really a problem. Please check carefully if the previous commit action is correct.

Update files and directories

Why do I need an update? Because most of the version control system is used by many people together. So, the same file may still be edited by someone else. To ensure that the files in your working directory are synchronized with the files in the repository. It is recommended that you update the action before editing. Here, let's assume that you have the file check out once. Now it's about how to update in a check out directory. In the file or directory icon you want to update, press the right mouse button. and select SVN Update.

Under normal conditions, you can see the window as above. In this window, you will see which files have been updated. If you don't see the information about the update, it means that the files in your directory are already up-to-date, so you don't need to update them.

Update to a specific version

Sometimes we need to go back to a specific date or version, so we can take advantage of the functionality of the SVN update to revision. In the file or directory icon you want to update, press the right mouse button. and choose Tortoisesvn->update to revision.

In this update window, you can choose to update to the latest version (HEAD). You can also choose to update to a specified version (Revision). Of course, you may not remember the correct version number. Probably only vaguely remember at what time. No problem, press the Show Log button and you'll be able to review the history.

All the actions you've ever done, their dates and the corresponding versions will be listed on this window, just click on the version you want, make him anti-white, and press OK. This version is automatically populated in the revision field in the Update window. Once you press OK again, this version will be removed to your hard drive.

Copy files and directories

Many times you will want to have another copy of the directory for new editing. Wait until the modification of this branch is complete, then merge it into the original main development version. For example, we currently have the following directories and files under working copy:

Now, we're going to build a branch for this directory of trunks. Suppose we want this directory to be in D:\working\my_prj\branch \my_new_branch_for_testing. First, we can press the right mouse button below the trunk directory, or directly under the trunk icon.

In the selection Branch/tag ... After this project, you will see the following dialog box appear.

Please confirm from the WC at URL: The directory is the source directory you want to copy. Next, enter the path in the to URL where you want to copy the past. Usually we will focus all the branch under one directory. For the above example, the branch file will be centered under the branch subdirectory. You only need to enter the directory you want in the to URL. If the directory does not exist, it will be created by SVN for you. It is particularly important to note that SVN is not a backslash because it is a directory-delimited character.

Then enter your purpose for this branch in log message. Press OK to do it.

If successful, you will see the following screen:

Press OK to close the window. If you go right now to working copy's branch subdirectory, you will be disappointed to find that there are no directories just specified under that directory. This is because the part of your working copy is still old, and you only need to do the SVN update under the branch subdirectory to see the new directory. The new directory has nothing to do with the original directory. You can edit it any time until you confirm that all the work done under branch is complete, you can choose to merge the branch back into the original trunk directory, or keep it in branch.

To merge back into the trunk directory, the method is simple. For the above example, in the D:\working\my_prj\trunk directory blank, press the right mouse button and select merge:

You can then see the following screen:

This picture is divided into three parts, the previous from: and to: is to ask you to choose from branch in which version to which version, merge back to the original trunk directory. Therefore, the From and to URL fields should be in the directory that specifies the original branch. All that remains is to specify the revision range to merge. For the above example, we started the merge to the latest version below branch from Branch's revision 7. You can try the merge once by Dry the Run button. This merge will only show some messages and will not really update to the trunk directory. Only when the merge button is pressed will the branch file be really merged with the trunk file.

The above message tells us that the Yyyy.cpp and xxx1.cpp under the trunk directory have been changed. If you are now in the trunk directory, you will see that these two files are in a modified state.

If you confirm that the merge is not a problem, you can use commit directly to commit the two modified files back to SVN repository. If there is a problem, you can modify these two files directly until the confirmation is OK, then commit.

If all goes well, you will successfully merge the branch files back into the trunk.

Make tag or release

The so-called tag or release is a special version, because this version may have a special meaning. For example: This version is a special milestone or release to the customer version. In fact, the method of tag and release is exactly the same as branch. Only branch may need to merge back into the original trunk, and most of the tags and release do not need a merge back into the trunk. For example, today we have a trunk version, this version is considered to be the software version 1.0. Version 1.0 is a very important milestone for development. So we have to make a special mark for him, namely tag. Let's say that this 1.0 version is going to be officially released to the customer or the relevant vendor, and we'll be able to make a release mark for him. Basically, SVN has only the concept of a directory, and there is no tag usage. So you'll see the next SVN menu above, branch and tag are the same project. In this 1.0 example, we are on the trunk, press the right mouse button, select the Branch/tag project:

If you succeed, you will create a 1.0 directory below the tag directory. Of course, if you go under the tag directory, you will not see this directory, you need to update under the tag directory to see it.

The way to make release is exactly the same as the tag. Just change the tag directory to release.

See here, I believe everyone has realized that either Branch,tag or release will just copy the specified trunk version to another directory. As for this directory to call branch or RELEASE,SVN simply don't care. Therefore, you can also have other directory names. However, Branch,tag and release are already the names of SVN's conventions idiomatic. So, unless you know why you're doing it, it's best to follow the naming principle so that the people who join later don't understand it.

Note: The same reason that the trunk is just a contract idiomatic name. Not necessarily called trunk. Just see the trunk directory and you will know that this is the main development backbone.
Quick reference

The front has written a lot of nonsense, mainly for people who do not have version control concept to see. If you want to know directly how a feature is used, see the section below.

At the end of the note, d:\working is used as a working directory. You can change him to any other directory you want.

Obtained (Checkout) Repository
    1. Open the File Manager and enter D:
    2. Press the right mouse button in the File Manager's blank and select SVN Checkout
    3. In the Checkout dialog box,
      1. The location of the URL of Repository:repository.
      2. Checkout directory: Where to store working copy.
    4. If the d:\working directory does not exist, SVN will ask you if you want to create this directory, please select Yes.
    5. Then press OK to checkout the directory.

Update file or directory
    1. Press the right mouse button on the icon for the file or directory you want to update to working copy by repository. Select SVN Update.
    2. If you are updating to a specific version, select Tortoisesvn->update to revision. and enter the version you want in the revision field in the Update dialog box. You can also view the version information through the Show Log button.
Add file or directory (add)
    1. Press the right mouse button on the icon for the file or directory that is not yet part of the repository. Select Tortoisesvn->add.
    2. Select the file you want to add.
    3. Press OK.

Note: The new file has to be submitted (commit) action before it is really put into repository.
Commit (Commit) a modified file or directory
    1. Press the right mouse button in the modified file or in the empty space of the entire directory.
    2. Tick the file or directory that you really want to submit to repository.
    3. Enter the record message (message) for this submission. The message should be clear, but it should not be too simple. Tracking in future versions.
    4. Press OK.

Copy/tag/branch/release file or directory
    1. Verify that the file or directory you are working on is already the latest version in Repository.
    2. Press the right mouse button on the directory or file you want to work with and select Tortoisesvn->branch/tag.
    3. Enter your destination at the to URL.
      1. Branch: To produce a branch. With the difference with trunk different development.
      2. Tag: to form a marker that represents an important milestone.
      3. Release: Indicates a record of a formal release.
      4. Other: Make a copy.

Category: WinForm

(ext.) TORTOISESVN Use profile

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.