Basic methods of TOTOISESVN use

Source: Internet
Author: User

Basic methods of TOTOISESVN use

Basic methods of TOTOISESVN use

In the project management Practice Tutorial One, 工欲善其事, its prerequisite "Basic Tools", I have explained how to install TORTOISESVN. In the above explained how to use VISUALSVN server, today I would like to talk about, TortoiseSVN simple way to use.

First, check in the source code to the SVN server

If we create a project in the folder Startkit using Visual Studio, we need to check the source code of the project into the codebase on the SVN server, first right click on the Startkit folder, and the context menu is as follows:

Figure 2-2-1

Click Import, pop up the form below, where http://zt.net.henu.edu.cn is the server name, SVN is the root of the code warehouse, and Startkit is a code base we added in the previous tutorial:

Note: The checkbox in the lower left corner is not useful when you check in the source code for the first time, but it is helpful when you commit the code later.

Figure 2-2-2

Click the OK button and the following form will pop up asking for your credentials:

Figure 2-2-3

Enter your username and password in the form above and click the OK button:

Figure 2-2-4

As shown, well, the source code has been successfully checked into the SVN server. This is when team members can move out of the source code on the SVN server to their machines.

Second, check out the source code to the machine

To create a folder on this machine Startkit, right click on Checkout, pop up the form like:

Figure 2-2-5

Enter the address of the codebase in SVN server in the text box under URL of Repository: Other default, click the OK button to start checking out the source code.

Description: In the checkout Depth, there are 4 options, namely to move out all, check out only the next level of subdirectories and files, check out only the files, check out only empty items, the default is the first item. In the example above, we can also use the Web to access the code base and enter http://zt.net.henu.edu.cn/svn/StartKit/in the browser.

A dialog box will also pop up asking for a user name and password that can be verified to explore the contents of the code base.

Get! The source code has been successfully checked out to the Startkit directory you just created.

Open the Startkit directory and you can see the folder structure as follows:

Figure 2-2-5

Once you have made any changes to the file or folder, the opportunity to display the picture in the file or folder changes. I have modified two of these files:

Figure 2-2-7

Let's look at the pictures of the different states:

Figure 2-2-8

We already know how to check in the source code to the SVN server, how to check out the code from the server to the machine, but also a simple understanding of the different states of the corresponding pattern.

Third, submit the modified files to the SVN server

In Figure 2-2-7 above, I modified the two files in the model file ImageInfo.cs and NewsInfo.cs, and the following shows how to commit to the SVN server.

Note: When submitting the source code to the server, be sure to ensure that the native code is the latest version, otherwise the submission may fail or cause a version conflict.

Right-click on the Model folder or in the blank space under Model file and click on SVN Commit ... The following form pops up:

Figure 2-2-9

Click the OK button to eject the form as follows:

Figure 2-2-10

Iv. adding new files to SVN server

We add a new class file under the model file UserInfo.cs, right click on the blank in the model file, click on the SVN commit ..., and the above-mentioned commit the modified file to the SVN server, it is OK.

Alternatively, you can right-click on the file UserInfo.cs and click Tortoisesvn=>>add to eject the form as follows:

Figure 2-2-11

Select the UserInfo.cs file and click the OK button so that the file is not submitted to the SVN server, just mark the file as a file in the source library and set its status to the modified state. After that, we'll have to commit the file again, so that it can actually be submitted to the code base on the SVN server.

The above is to add a file, in fact, the steps to add a folder is the same, this is not said.

Update the native code consistent with the latest version on the SVN server

This is also very simple, as long as the need to update the folder right-click or in the blank space under the file right click, click on SVN update, you can.

Note: The update operation may fail due to a version conflict, which can be resolved by using merge "merge" or other methods, or it may fail because of locking "Get lock", which requires unlocking "release lock" first.

Rename a file or folder and commit the changes to the SVN server

Just right-click on the file or folder that needs to be renamed, click Tortisesvn=>>rename ..., enter the new name in the popup form, and click the OK button. This method is not renamed directly, but instead marks the name of the file or folder as a renamed name, and it requires that we use SVN commit to commit to the SVN server before actually renaming it.

Vii. Delete files or folders and submit changes to the SVN server

The simplest is that you delete the file or folder directly and then use SVN commit to commit the update to the SVN server. Another way is to click on the file or folder you want to delete the right button =>>tortoisesvn=>>delete Delete, this method is not directly deleted, but the status of the file or folder is deleted, we also need to use SVN Commit to the SVN server before it is actually deleted.

Description: In fact, since you moved the source code into the SVN server, each version of the data and files, even if you have deleted, you can always move out.

The above is just tortoisesvn the simplest of several functions, in fact, his function far more than these, other functions we can use in the process of slowly experience, some features I will be used in the following tutorial, then will and everyone to explain the usage.

Note: When submitting the source code to the SVN server, be sure not to submit folders such as Bin, obj, or it will be cumbersome. However, except for the bin directory of the Web project, DLLs that are generated by referencing other projects in the Bin directory of the Web project do not need to be committed.

A good habit: if the project references other third-party assemblies, such as Enterpriselibrary, FCKeditor, etc., do not simply reference them from their installation location, but in your solution, add a library directory, Copy the required assemblies here, and then refer to them from the library directory, so what are the benefits, think about it yourself!

Tortoise SVN Client Basic usage

1. Export and check out

Export Download Source code

Usage:

1, create a new empty folder, right click on it, you can see the TortoiseSVN menu and above the SVN Checkout.

2, do not control this checkout, we choose the TortoiseSVN menu under the export ..., then it will let you enter the URL.

3, such as the input "maze exploration treasure" SVN address is: http://game-rts-framework.googlecode.com/svn/trunk/

4, other options do not need to change, Omit externals do not tick, HEAD revision Select the latest version of the code, and then click OK to export the code into this directory:)

Check out meaning check out, although the same as the effect of export to the code from the server to download to the local, but checkout has a validation of the function, checkout to a place of code, will be TORTOISESVN monitoring, the file can enjoy a variety of SVN services.

2. What issues should be noted each time the code is submitted

If you update the file in the directory, the commit code needs to use the Commit function, the function of commit is not only upload, he will be compared with the server above the file, if you update a file and the server also has someone update the file, and is the update after you checkout, Then it will try to merge your updates with others ' updates (merge), if the automatic merge is unsuccessful, then report conflict, you have to manually merge, that is, your updates and other people's updates without conflicting written together.

Commit, it is best to fill in the log information, so that others can see what your update actually did write. This is equivalent to uploading files and stating that you have made those changes and that when multiple people cooperate, log is very important.

TortoiseSVN commit will only upload the original checkout and then changed the file, if you add some new files, you need to right click on the file to select Add, and then the file will appear a plus sign, At the next commit it will be upload and marked with a green checkmark. A file without a green checkmark will not be commit.

If you need to rename or move its location with a green checkmark, do not use the Windows features, right click on them, TortoiseSVN have the appropriate action. Imagine that these files are no longer your local stuff, and you must let tortoise know what you are doing.

If you modify a file but you regret it, you can right-click on it to select revert, it will be changed back to the last checkout time situation. or revert the entire project to any previous version.

Here are a few points to note when using commit:

-------------If multiple files need to be submitted at the same time, and the files in different directories, must find the shortest directory of these files click Commit,tortoisesvn will search the clicked directory and all the files in that directory, and will modify the changes in the list of files listed.

-------------carefully review the files in the list, determine which files need to be updated, if you do not need to update a file that has changed, just click on the file to right, select the restore operation; Select the files that need to be added, and do not add the temporary files to the repository.

-------------If you encounter a file conflict (conflict: The file to be submitted has been modified by someone else and submitted to the repository) to enable the conflict resolution feature.

3. How to keep the local version and server version synchronized

Use Update to synchronize the code on both the local and the server. Also right-click on SVN update and all changes will be uploaded from the server to your hard drive. Note that if someone deletes a file, then your local will be deleted after the update.

If the local code has been modified, the same as commit will be the first merge, if unsuccessful, will report conflict

4 How to switch between each branch or trunk of a project in the same

Using Tortoise Svn-->switch

Enter the URL address of the branch or trunk in the URL

5. How to compare the differences between two versions

Local changes

If you want to see what your local copy is more, just use the tortoisesvn→ to compare differences in the right-click menu in Explorer.

Differences with another branch/tag

You can use the right-click menu if you want to see what changes are in the trunk program (if you're developing on a branch) or if there are any changes to a branch (if you're developing on the trunk). Hold down the SHIFT key while you click on the file, and then select Tortoisesvn→url comparison. In the popup dialog box, the URL address of the version that will be compared to your local version will be displayed in particular.

You can also use the Repository browser to select two tree comparisons, perhaps two tags, or branches/tags and the latest version. The Mail menu allows you to compare them using a comparison version. Read section 5.9.2, "Comparing folders" for more information.

Comparison with historical versions

If you want to see the difference between a specific version and a local copy, use the Show Log dialog box, select the version you want to compare, and select compare differences with local copy in the right-click menu

Comparison of two historical versions

If you want to see the difference between any of the two historical versions that you have committed, in the Version Log dialog box, select the two versions you want to compare (typically using Ctrl-change), and then choose Compare version Differences in the context menu

If you do this in the version log of the folder, a Compare Version dialog box appears, showing a list of file modifications for this folder. Read section 5.9.2, "Comparing folders" for more information.

Submit all Changes

If you want to see all the changes in a version in one window, you can use the unified display for all comparisons (GNU fragment grooming). It will show you some of the changes. It is difficult to show a comprehensive and clear comparison, but all changes are displayed in a centralized way. In the Version Log dialog box, select a version, and then in the right-click menu, select Unified Display all comparisons.

File differences

If you want to see the differences between the two different files, you can select the two files directly in the Explorer (typically using Ctrl-modifier) and then choose tortoisesvn→ to compare the differences in the right-click menu.

diff diff between WC file/folder and URL

If you want to see the difference between any file in your local copy and any of the files in your repository,

The comparative differences between condemned information

If you want to see not only the difference but also the author, version number and date of the revision, you can compare the differences and condemn the information in the Version Log dialog box. Here are more details about section 5.20.2, "Tracing the differences".

Compare folder Differences

TortoiseSVN's built-in tools don't support viewing differences between multilevel catalogs, but you can use an external tool that supports this feature instead. Here in section 5.9.4, "Other diff/merge Tools" We can introduce some of the tools we used.

6. How to know what files you have changed when you submit your code, and what files others have changed

7. How to know which version of a file a line is modified by

8. How to create a branch or tag for an SVN master project

To create a branch use step:

1. Select the file you want to create the branch, right click, select [branch/Tag ...]

2. Rename the file to your branch file name in the [to URL (T)] input box, enter the log information that is easy to distinguish, and click Confirm.

3, in the SVN warehouse will copy a file you specify, the file name is what you named, but in your local directory can not see the new branch file name, to make your file update action on your branch, you have to select the file, right mouse button, select [Toggle ...], select the file you renamed, Click OK. This way your local file is associated with the branch file, so don't be surprised that the file name you see on your local directory is still the old one.

Experience Summary:

1, if the operation of the file has not been submitted before, and you want to submit the file to the new branch, remember to choose to switch

2, the management of the SVN branch is actually to save different branches with different files, so when you get the new version, you will find that the newest files of different branches will be taken down.

Creating a tag operation is equivalent to copying a copy of the current version of the code to a different location, and then using this place as a starting point for new development, not interfering with the original version.

For branches, tags, trunk these three directories, not subversion necessary, but is summed up a good team development habits, its use is:

1. The developer submits all the new features to the trunk. Daily changes are submitted to/trunk: new features, bug fixes and others.

2. This trunk is copied to the "release" branch. When the team thinks the software is ready for release (for example, version 1.0) then/trunk will be copied to/branches/1.0.

3, the project team continued to work in parallel, a team began to rigorous testing of the branch, while the other team in/trunk continue to new work (for example, prepare 2.0), if a bug is found in any one location, error correction needs to be transported back and forth. However, this process can sometimes end, for example, the branch has been "stalled" for the final test before release.

4, the branch has been labeled and published, when the test is finished,/branches/1.0 as a reference snapshot has been copied to the/tags/1.0.0, the label is packaged and released to the customer.

5, branch multiple maintenance. When continuing to work on/trunk for version 2.0, bug fixes continue to be shipped from/trunk to/branches/1.0, and if sufficient bug fixes have been accumulated, management decides to release 1.0.1 version: Copy/branches/1.0 to/tags/ 1.0.1, tags are packaged and released.

When the initial repository is generally established, the three directories are built, and all the code is put into the/trunk, such as: To import code from Project1 directory Repository,project1 structure is: project1/branches, Project1/tags,project1/trunk,project1/trunk/food.c,project1/trunk/egg.pc., and then import the Project1 directory into repository to create the original database. Then export back to Project1 as the local working directory.

Basic methods of TOTOISESVN use

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.