How to configure and use VISUALSVN server and TORTOISESVN clients

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

I. Configuration and usage of VISUALSVN server "servers side"

After installing VISUALSVN server, "install process here", run VisualSVN Server manger, the following is the startup interface:

OK, let me add a code library "Repository", the following figure:

As shown in the above illustration, create a new code base and enter the name of the code library in the text box shown in the following illustration:

Note: If checked, the checkbox in the image above will create a trunk, branches, tags three subdirectory below the code base Startkit, and if unchecked, create an empty code base Startkit only.

Click the OK button, the code base is created successfully.

After creating the code base, nothing is inside. I'll explain how to move into the source code in the second part of this tutorial.

Now, let's start with the security settings and right click on the users on the left:

Enter the above information, click OK, we will create a user. According to the above procedure, add the user Developer1, Tester1, Manager1, OK, let's start adding these users to the project we just created:

Click on the "Add ..." button in the image above to select the user we just added in the image below and click the OK button:

Note: You may notice the groups in the following figure, yes, you can also create a group, add users to each group, and then authorize the group, the operation is relatively simple, in this skip.

Authorize the user "or group" as shown in the following illustration:

By clicking on the "OK" button, the user above has different permissions to access the Startkit code base.

Because the user starter is a newcomer in the team, and does not want him to submit new code to the code base, he can only read code in the code base and cannot submit code. Tester1 is a tester who is not responsible for code writing, so it is read-only. While Developer1 and Manager1 are developers and project managers, they naturally have read and write permissions.

In the actual project development process, developer and tester often cannot only one person, this time uses the group to authorize is more convenient, this everybody may own practice.

Second, the basic use method of TOTOISESVN

In the project management Practice tutorial, 工欲善其事, its prerequisite "Basic Tools", I have explained how to install TORTOISESVN. In the above explanation already talked about how to use VISUALSVN server, today I want to talk about, TortoiseSVN simple use method. One, check in source code to SVN server

If we use Visual Studio to create a project in the folder Startkit, we will check the source code of this project into the database on the SVN server, and first right-click the Startkit folder, the right menu is as shown in the following image:

Figure 2-2-1

Click Import to eject the form below, where http://zt.net.henu.edu.cn is the server name, and SVN is the root of the code warehouse, Startkit is a code library that we added in the last tutorial:

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

Figure 2-2-2

Clicking the OK button will pop up the form below and require credentials to be entered:

Figure 2-2-3

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

Figure 2-2-4

As shown in the figure above, all right, the source code has been successfully checked into the SVN server. At this point, team members can move out of the SVN server source code to their own machine. Second, check out the source code to this machine

Create a folder on this machine Startkit, right click on Checkout, pop up the form of the following image:

Figure 2-2-5

Enter the address of the code base in SVN server in the text box below URL of Repository: Other defaults, click the OK button and start checking out the source code.

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

It also pops up a dialog box that requires you to enter a username and password, and then you can browse the contents of the code base by verifying it.

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

Open the Startkit directory and you can see the folder structure of the following figure:

Figure 2-2-5

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

Figure 2-2-7

Let's take a look at the picture of the different states:

Figure 2-2-8

We already know how to check the source code into the SVN server, how to check out the code from the server to the local, and simply understand the different state of the corresponding pattern. Third, submit modified files to SVN server

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

Note: When submitting the source code to the server, make sure that the native code is the latest version, or else it may fail to commit or cause a version conflict.

In the Model folder on the right button or in the model file under the blank to right-click, click SVN Commit ... Eject the following form:

Figure 2-2-9

After clicking the OK button, pop up the form as shown below:

Figure 2-2-10

Iv. Add new files to SVN server

We add a new class file under the model file UserInfo.cs, click on the right button in the blank space under the model file, click SVN Commit ..., as mentioned above to submit the modified file to the SVN server, it is OK.

Alternatively, you can right-click on the file UserInfo.cs, click Tortoisesvn=>>add, and pop up 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 place it in the modified state. After that, we'll be able to commit this file again before we can actually commit it 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, here is not said. v. Update native code in line with the latest version on the SVN server

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

Note: The update operation may fail because of a version conflict, which can be resolved using merge or other methods, or it may fail because of locking "get lock", which requires unlocking "release lock" first. Six, rename the file or folder, and submit the modifications to the SVN server

Just right-click on the file or folder you want to rename, click Tortisesvn=>>rename ..., enter a new name in the form that pops up, and click the OK button. This method is also not a direct rename, but rather the name of the file or folder is marked as a renamed name, and we need to commit the SVN commit to the SVN server before we really rename it. Vii. Delete a file or folder and submit the modifications to the SVN server

The simplest is that you delete files or folders directly, and then use SVN commit to submit updates to the SVN server. Another way is to delete the file or folder you want to right-click =>>tortoisesvn=>> Delete deleted, this method is not directly deleted, but the state of the file or folder to delete, we also need to use SVN Commit commits to the SVN server before it is actually deleted.

Description: In fact, from the time you move the source code to the SVN server, each version of the data and files, even if you have deleted, can also be moved out.

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

Note: When submitting the source code to the SVN server, do not submit folders such as Bin, obj, or else it will be troublesome. However, except for the bin directory of the Web project, DLLs 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, and so on, do not simply refer to their installation location, but under your solution, add a library directory, Copy the required assembly here, and then quote from the Library directory, so what's the benefit, think about it yourself.Tortoise SVN Client Basic usage1. 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 the above SVN Checkout.
2, do not care about this checkout, we choose Export under the TortoiseSVN menu ..., and then it will let you enter the URL.
3, such as the input "maze 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 selected to indicate the latest version of the code, and then click OK to export the code to this directory:
Check out meaning check out, although with the effect of export is to download the code from the server to the local, but the checkout has the authentication function, checkout to place the code, will be TORTOISESVN monitoring, the file inside can enjoy a variety of SVN services.
  
2. What issues to pay attention to each time you submit code
If you update the file in the directory, the commit code needs to use the commit function, the commit function is not only upload, he will be compared with the file above the server, if you update a file and the server has someone updated the file, and is after you checkout update, 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 yourself, that is, put your updates and other people's updates conflict-free write together.
When you commit, it's best to fill in the log information so that others can see what your updates are doing. This is the equivalent of uploading files and stating that you have made those changes, and that log is very important when working with many people.
TORTOISESVN's commit will only upload the original checkout and then modified files, if you add some files, you need to right-click the file to select Add, and then the file will appear a plus sign, It will be upload and marked as green on the next commit. Files without a green check will not be commit.
If you need to change the name of a green check file or move it, please do not use the features of Windows, right click on them, tortoisesvn have the appropriate operation. Imagine that these files are not your local things, you must let tortoise know every move.
If you modify a file but you regret it, you can right-click it to choose Revert, it will change back to the last checkout. or revert the entire project to any previous version.
The following describes several points of attention when using commit:
-------------If multiple files need to be submitted at the same time, and the files are in a different directory, you must find the shortest directory of these files click Commit,tortoisesvn will search for the clicked directory and all the files in the directory, and make changes to the file listed in the list.
-------------take a closer look at the files in the list, determine which files need to be updated, and if you don't need to update a changed file, simply right-click on the file, select the restore operation, select the file you want to add, and do not include the temporary file in the repository.
-------------to enable conflict resolution if a file conflict is encountered (conflict: The file being submitted has been altered by someone else and submitted to a version library).
3. How to keep the local version and server version synchronized
Use Update to synchronize code on both the local and the server. Also right-click to choose SVN Update, all changes will be uploaded from the server to your hard drive. Note that if someone deletes a file, your local will be deleted after the update.
If the local code has been modified, the same as the commit will be the first merge, unsuccessful will be reported conflict
4 How to switch between the same branch or trunk of a project
Using Tortoise Svn-->switch
Enter the URL address for 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, use only the right-click menu in the Explorer to select tortoisesvn→ to compare the differences.
Difference from another branch/label
If you want to see what changes are in the backbone (if you are developing on a branch) or if you have any changes to a branch (if you develop it on the trunk), you can use the right-click menu. Hold down the SHIFT key while you click on the file and select Tortoisesvn→url comparison. In the pop-up dialog box, the URL address of the version that will be compared with your local version will be displayed in particular.
You can also use the version library browser, select two tree comparisons, perhaps two tags, or branch/tag and the latest version. The Mail menu allows you to compare them using the Compare version. Read the 5.9.2 section, "Compare folders," For more information.
Comparison with historical version of the difference
If you want to see the difference between a particular version and a local copy, use the Display Log dialog box, select the version that you want to compare, and then select the local copy in the right-click menu to compare the differences
Comparison of two historical versions
If you want to see the difference between any two historical versions that have been submitted, select the two versions you want to compare in the Version Log dialog box (typically using Ctrl-change), and then compare the version differences in the right-click menu
If you do this in the folder's version log, a comparison version dialog box appears, displaying the file modification list for this folder. Read the 5.9.2 section, "Compare folders," For more information.
Submit all Changes
If you want to view all the changes in a version in a single window, you can use a uniform display of all comparisons (GNU fragment collation). It will show some of the changes in all the modifications. It is difficult to show a comprehensive and clear comparison, but all of the changes are shown centrally. Select a version in the Version Log dialog box, and then in the right-click menu, choose to display all comparisons uniformly.
File differences
If you want to see the difference between two different files, you can select these two files directly in the Explorer (typically using Ctrl-modifier), and then right-click the menu to choose tortoisesvn→ to compare the differences.
Compare differences between WC files/folders and URLs
If you want to see the difference between any file in your local copy and any file in the version library,
Condemning the comparative differences between information
If you want to see more than just the difference and include modifying the author, version number, and date of the version, you can synthesize the diff and reprimand information in the version Log dialog. Here are a few more details on the "Retrospective difference" of section 5.20.2.
Compare folder Differences
TORTOISESVN built-in tools do not support viewing the differences between multilevel catalogs, but you can replace them with an external tool that supports this feature. Here 5.9.4 section "Other comparison/merging tools" we can introduce some of the tools we've used.
6. How to know what files you changed when you submitted the code, what files were changed by others
7. How to know a certain line of a file who is in which version of the modified
  
8. How to create a branch or tag for an SVN main project
To create a branch use step:
1, select the file you want to produce a branch, click the right mouse button, select [Branch/Mark ...]
2, in [to the URL (T)] in the input box to rename the file to your branch file name, input easy to distinguish the log information, click to confirm.
3, in the SVN warehouse will copy a file you specify, the file name is you named, but in your local directory can not see the new branch file name, to make your file updates to your branch, you have to select the file, click the right mouse button, choose [Switch ...], select the file you renamed, Click OK. This way your local file is associated with the branch file, so don't be surprised when the file name you see on the 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 that you must choose to switch
2, the SVN branch of management is actually the different branches of different files to save, so you get a new version of the time will find that the different branches of the latest files will be captured.
Creating a tag operation is equivalent to copying the current version of the code to a different location, and then taking this place as a starting point for a new development, with no interference from the original version.
For branches, tags, trunk these three directories, is not subversion required, but is summed up a good team development habits, the use of the method is:
1, developers submit all the new features to the backbone. Daily revisions are submitted to/trunk: new features, bug fixes, and more.
2, this trunk is copied to the "Publish" branch. When the team thinks the software is ready for release (e.g., version 1.0) then/trunk will be copied to/branches/1.0.
3. The project team continues to work in parallel, a team begins a rigorous test of the branch, while another team continues the new work in/trunk (e.g., prepare for 2.0) and if a bug is found in any location, error correction needs to be shipped back and forth. However, this process can sometimes end, for example, the branch has been "stalled" for the final Test before it was released.
4, the branch has been tagged and released, when the test is completed,/branches/1.0 as a reference snapshot has been copied to/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 are accumulated, management decides to release the 1.0.1 version: Copy/branches/1.0 to/tags/ 1.0.1, the label is packaged and released.
Generally set up the initial repository, the three directory, put all the code into the/trunk, such as: to the Project1 directory to import code into the 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 and build the original database. Then export back to Project1 as a local working directory.


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

Win2003 on SVN cannot use solution
The SVN server, which integrates Apache and subvision for visual svn servers,
The resolution process is:
First, find the installation directory of VISUALSVN server, the following Conf folder under the Httpd.conf file, opened in the file finally added:
<ifmodule mpm_winnt.c>
Threadsperchild 1000
Maxrequestsperchild 10000
Win32disableacceptex
</IfModule>
Second, run the netsh winsock reset command, you can not restart the computer.
After you have completed these two steps and restarted the visual SVN server servers, you find that everything is OK.
Plainly is the Apache problem, Apache in Windows 2003 will always occupy CPU high, the above method can be solved, there is the problem of Winsock.

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.