Tortoisesvn configuration and usage tutorial

Source: Internet
Author: User
Tags svn update tortoisesvn

Source: dev.idv.tw

  • 1. Install and download the client
  • 2. What is SVN (subversion )?
  • 3. Why SVN?
  • 4. How do I create SVN repository in windows?
  • 5. Create a working directory
  • 6. add files and directories to repository.
  • 7. Update files and directories
  • 8. Update to a specific version.
  • 9 copy files and directories
  • 10 create a tag or release
  • 11 Quick Reference
    • 11.1 get (checkout) Repository
    • 11.2 update a file or directory
    • 11.3 Add a file or directory
    • 11.4 submit (COMMIT) modified files or directories
    • 11.5 copy/Tag/branch/release files or directories
Install and download the client
  1. Download the windows program: http://tortoisesvn.net/downloads. In general, for 32-bit Windows XP, you should use the TortoiseSVN-1.4.x.xxxx-win32-svn-1.4.x.msi file. For 64-bit operating systems, you should use the TortoiseSVN-1.4.x.xxxx-x64-svn-1.4.x.msi file.
  2. Run the downloaded tortoisesvn installer to install tortoisesvn. After the installation is correct, you should restart the system once to ensure that tortoisesvn is correct.
  3. After the installation is successful, right-click the archive administrator and you will see the following picture:

Most tortoisesvn operations are completed by the archive administrator and right-clicking. If you have used tortoisecvs before, you should feel very kind about this operation method.

What is SVN (subversion )?

There is a simple but not very accurate metaphor:

SVN = Version Control + Backup Server

Simply put, you can use SVN as your backup server. Better, it helps you remember the file content uploaded to this server each time. And automatically assign a version to each change.

Generally, repository is used to store the uploaded files. In Chinese, it is a bit like a file warehouse. However, we usually use the repository term. Basically, for the first time, we need to add a new file to put the file to repository. In the future, if you have any modifications, you can upload them to the repository file. Uploading an existing and modified file is called commit, which means submitting the changes to the svn server. For each commit, the svn server will give him a new version. At the same time, the upload time is recorded. In the future, if you need to download files that have been submitted from repository due to some factors. You can choose to get the latest version or any previous version. If you forget the version, you can try to get the version of a certain date by memorizing it.

Why SVN?
  1. It is very important to back up work files. You never know when the hard disk on your computer will break down. According to the empirical law, coupled with the mofi theorem, bad things often occur at the most important moment. For example, the hard disk is completely damaged and cannot be repaired the moment before the release is required. Therefore, backing up work data is very important. Most companies have dedicated backup mechanisms, or even remote backup. It is definitely safer than putting it in your computer or on a flash drive.
  2. Version control is very important. You cannot guarantee that the latest version is always correct. Most of the time, after several days of hard work, you find that you are in the wrong direction. You need to reply all the modifications to the version a few days ago. Few people can fully remember what they have modified. If version control is not completed, the worst case is to redo it all.
  3. Data synchronization between partners is also very important. Many times, apart from yourself, other partners also need your files. How can we provide our partners with the latest archives? Use e-mail? Based on experience, using e-mail is a poor solution. At the end, I don't know which email is new. Because your latest email may have been lost as a spam. Don't forget that many email software now have the anti-spam function. These emails may have been processed as advertising emails. In addition, you should also know that if the normal file is put in E-mail, the file size will become relatively large (usually more than 4/3 times of the original ). If it is updated once a day, I am afraid the mailbox will burst if I haven't received it for a few days!
  4. If there is no good way, backing up different versions will consume hard disk space. For example, you have a directory of 10 MB in total and use a simple archive backup. If there are 10 versions, it will become 100 MB. The 20 versions have 200 MB. If you do not want to back up so many versions, you must reduce the number of backups. Increasing the backup cycle will increase the risk of data loss. Delete unnecessary backup? Based on experience, as long as the time is prolonged, you do not know whether the version a month ago is important or not.

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

  1. SVN repository can be a directory on your computer or a flash drive (not recommended ). Of course, it can also be a company server.
  2. SVN has a great version control mechanism. All uploaded versions are recorded for you. You can obtain the version at any time in the future. In addition, it also provides easy-to-use features such as version branch and merge.
  3. SVN allows different developers to access the same file and uses SVN server as the file synchronization mechanism. In other words, when you have an archive update, you do not need to send the archive to your developer. You only need to tell him that the new version is already on the svn server. Ask him to go to the svn server to obtain the latest version. In addition, the svn server can automatically send emails to relevant members after you upload a new version.
  4. SVN stores files in different backup modes. That is to say, the backup will only be different. Therefore, it saves hard disk space. In addition, it can also perform differential backup for so-called non-text files.
How to Create SVN repository in windows?

Assume that you have installed the tortoisesvn software mentioned above. Now we will first tell you how to use your own hard disk or flash drive as the storage location of SVN repository. If you only want to know how to access the repository on a created SVN server, skip this section.

Assume that you want to place repository in the e-slot. Create an empty directory first. In the following example, a directory named svn_repo is created under the e-slot. SVN does not limit the repository directory name. You can create any name you like. However, we strongly recommend that you do not use a non-English file name (such as Chinese or Japanese ).

With your archive administrator, right-click the icon in E: \ svn_repo and choose tortoisesvn-> Create repository here.

Next, you will see the following window, which mainly asks you whether the repository database format you want to use is fsfs or bdb. Basically, select fsfs. After you press OK, you can see the next screen.

This indicates that your SVN repository has been successfully created. The next step is to back up your file. In the future, we can use file: // E:/svn_repo to express this repository. SVN uses this URL to get in touch with repository. The URL formats are as follows:

File: // disk drive |/Repository directory/subdirectory http: // account @ server name/Repository directory/subdirectory https: // account @ server name/Repository directory/subdirectory SVN + SSH: // account @ server name/Repository directory/subdirectory

HTTP indicates that the common hyper-text communication protocol is used. HTTPS indicates the encrypted hyper-text transmission communication protocol. SVN + SSH Indicates access through the SSH encrypted communication pipeline.

Create a working directory

The so-called working directory is actually the place where you normally store work files. Generally, we will wait for a section of our work to back up. Therefore, we usually work under the working directory, and wait until the appropriate time in commit to repository. For example, we want to create a directory named working under the D-slot. First, create the directory.

In this case, the directory should be empty.

Right-click the archive administrator and select SVN checkout (you can press the icon in the working directory or enter the working directory and press it in a blank place.

Then you can see the following picture:

First, we need to fill in the repository location. For SVN, the repository location is a URL. We have already created a repository in the e-slot. Therefore, we need to enter file: // E:/svn_repo/in the URL of repository column /.

Next, let's take a look at the checkout directory. This field should point to your working directory. Click OK to see the following message window.

This indicates that the action is completed. Click OK and go to the directory you just created. You will see an additional name under the working directory. SVN directory (this directory is hidden. If your archive Administrator does not set it, you will not be able to see the hidden directory ).

SVN creates the. SVN subdirectory under your working directory and Its subdirectory. You should not go into this directory, especially do not change any content under this directory. Otherwise, SVN may not work properly.

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

If you want to checkout the file on an existing SVN server, you only need to specify the correct URL and the name of the working directory. You can obtain the specified file and directory.

Add files and directories to Repository

Assume that all the preceding actions are correct. Now you start to develop a new program. Assume that the program you developed will be placed in the my _ prj subdirectory under the previously created working directory. As follows:

 

Assume that you have edited the files and want to put them in SVN repository. Right-click the icon in the my_prj directory and choose tortoisesvn-> Add:

Tortoisesvn will display the files and directories to be added. To be added to repository. If you do not want to add files or directories to this project, do not select this project. In this way, it will not be added to repository.

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

This indicates that the operation is successful. Note that the Add action does not actually put the file in repository. Only tell SVN to prepare to put these files in repository. At this time, if you view these files through the archive administrator, you will see a white exclamation point under the archive icon.

This indicates that the files in your working directory are not synchronized with those in repository. Now we need to add one more commit action. Put these archives into repository. You can right-click the icon in the my_prj directory or the blank space in the my_prj directory to open the following menu and select SVN commit.

Then, you will see the following window:

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

At the top of the archive list is the message column, where you can enter the purpose of this commit. This is a very important field. When you commit a large number of times, you can rely on this message to know the differences between versions. After you enter the message and press OK, the following window appears, notifying you that the specified file has been sent to repository.

You can go to the previous folder to check whether all the file icons have the following green hooks. This means that your files are correctly recorded in repository.

Sometimes, due to Windows problems, you may see that some icons do not turn green. Press F5 several times to solve the problem. If it still does not work, it indicates that your previous commit action is actually faulty. Check whether the previous commit action is correct.

Update files and directories

Why update? Most version control systems are used by many people. Therefore, some people may edit the same file. To ensure that the files in your working directory are synchronized with those in repository. We recommend that you perform the update operation before editing. Here, we assume that you have checked the file once. Now we need to explain how to update a check-out directory. Right-click the file or directory icon you want to update. Select SVN update.

 

Normally, you can see the window above. In this window, the files updated are displayed. If you do not see the file update information, it indicates that the file in your directory is up-to-date, so you do not need to update it.

Update to a specific version

Sometimes we need to trace back to a specific date or version, then we can use the svn update to revision function. Right-click the file or directory icon you want to update. Select 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. You may only vaguely remember the approximate time. It doesn't matter. Press the show log button to review the history.

All the actions you have done, and their dates and corresponding versions are listed in this window. Just click on the version you want to change it to a whitelist, and then press OK. This version is automatically filled in the revision field in the update window. If you press OK again, this version will be taken out to your hard disk.

Copy files and directories

Most of the time you want to have another copied directory for new compilation. After confirming that the Branch has been modified, merge it to the original major development version. For example, we currently have the following directories and files under working copy:

Now, we need to create a branch for the trunk directory. Suppose we want this directory to be in D: \ working \ my_prj \ branch \ my_new_branch_for_testing. First, we can right-click the blank space under the trunk directory or directly under the trunk icon.

Select branch/Tag... After this project, you will see the following dialog box.

Make sure that the directory in from wc at URL is the source directory to be copied. Then, enter the path you want to copy to URL. Generally, we will put all branch in a directory. In the preceding example, Branch files are stored in the sub-directories of branch. In the to URL, you only need to enter the directory you want. If the directory does not exist, SVN will help you create it. Note that SVN uses a slash as a directory separator rather than a backslash.

Enter the purpose of your branch in log message. Press OK.

If it succeeds, you can see the following picture:

Press OK to close the window. If you immediately go to the branch sub-directory of working copy, you will be disappointed to find that there is no specified directory under this directory. This is because the working copy part is still old. You only need to perform SVN update under the Branch subdirectory to see the newly added directory. The new directory has nothing to do with the original directory. You can edit it at will until you confirm that all the work done under branch is completed, you can choose to return this branch merge back to the original trunk directory, or keep it in branch.

The method for returning merge to the trunk directory is simple. In the preceding example, right-click the D: \ working \ my_prj \ trunk directory and select merge:

The following figure is displayed:

This screen is divided into three parts. The previous from: And to: Ask which version of branch you want to go back to the original trunk directory. Therefore, the from and to URL fields must all specify the original branch directory. The rest is to specify the revision range for merge. In the above example, we start from Branch's revision 7 to merge to the latest version below branch. You can try merge by using the dry run button. This merge will only display some messages and will not be actually updated to the trunk directory. Only by pressing the merge button will branch and trunk files be truly merged.

The above message tells us that YYYY. cpp and xxx1.cpp under the trunk Directory have been changed. If you go to the trunk directory, you will see the two files in the modified state.

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

If everything goes well, you will successfully return Branch's file merge to trunk.

Create a tag or release

The so-called tag or release is a special version, because this version may be of special significance. For example, this version is a special version provided by milestone or release to the customer. In fact, the tag and release practices are exactly the same as branch. Only branch may need merge back to the original trunk, while most of tag and release do not need merge back to the trunk. For example, today we have a trunk version, which is regarded as version 1.0 of the software. Version 1.0 is a very important milestone for development. So we need to make a tag for him. Assume that this version 1.0 is to officially release the version to the customer or the relevant vendor, and we want to make a release tag for it. Basically, SVN only has the directory concept and does not have any tag usage. So you will see that on the svn menu, branch and tag are the same project. In this example of 1.0, we right-click the trunk and select the branch/Tag project:

If the tag is successfully created, a 1.0 directory is created under the tag directory. Of course, if you go to the directory under the tag, you will not see this directory. You need to update it under the tag directory to see it.

 

The procedure for making a release is exactly the same as that for creating a tag. Just replace the directory of the tag with release.

As you can see, I believe that branch, Tag, or release only copies the specified trunk version to another directory. SVN does not care whether this directory is branch or release. Therefore, you can use another directory name. However, branch, tag, and release are already common names in SVN. Therefore, unless you know why you did this, it is best to follow the naming principle of follow, so that new users will not understand it.

Note: In the same way, trunk is just a convention name. It does not have to be called trunk. The trunk directory shows the main development trunk.
Quick Reference

I wrote a lot of nonsense, mainly for those who have no idea about version control. If you want to know how to use a function, see the following section.

In the subsequent descriptions, D: \ working is used as the working directory. You can replace it with any other directory you want.

Get (checkout) Repository
  1. Open the archive administrator and enter D:
  2. Right-click the archive administrator blank space and select SVN checkout
  3. In the checkout dialog box,
    1. URL of repository: the location of the repository.
    2. Checkout Directory: the location where working copy is to be stored.
  4. If the D: \ working directory does not exist, SVN will ask you if you want to create this directory. Select Yes.
  5. Then press OK to checkout the directory.

Update a file or directory
  1. Right-click the file or directory icon that you want to update from repository to working copy. Select SVN update.
  2. If you want to update to a specific version, select tortoisesvn-> Update to revision. In the update dialog box, enter the version you want in the revision field. You can also view the version information through the show log button.
Add a file or directory
  1. Right-click the icon of the file or directory that does not belong to repository. Select tortoisesvn-> Add.
  2. Select the file to be added.
  3. Press OK.

Note: Newly Added files must be submitted (COMMIT) before they can be truly put into repository.
Submitted (COMMIT) modified files or directories
  1. Right-click the modified file or the blank space of the entire directory.
  2. Select the files or directories to be submitted to repository.
  3. Enter the message ). This message should be clear but should not be too simple. To facilitate future version tracking.
  4. Press OK.

Copy/Tag/branch/release file or directory
  1. Make sure that the file or directory you want to process is the latest version in repository.
  2. Right-click the directory or file to be processed and choose tortoisesvn-> branch/Tag.
  3. Enter the destination at the to URL.
    1. Branch: generates a branch. To differentiate development from trunk.
    2. Tag: to form a tag that represents an important milestone.
    3. Release: indicates a record of a formal release.
    4. Others: perform a copy operation ).

Tortoisesvn configuration and usage tutorial

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.