Detailed explanation of the whole process of SVN version server collocation (server, client) [transfer]

1. Why use VisualSVN Server instead of Subversion?

answer:

Because if you use Subversion directly, then on Windows system, if you want it to start with the system, you need to encapsulate SVN Server as a windows service, and you need to modify the configuration file to control user permissions. In addition, if you want to use the Web method [http protocol] 】Access, generally also need to install and configure Apache, if you are a novice, wouldn't it be a headache? And VisualSVN Serve integrates Subversion and Apache, saving all the troubles above. During installation, the SVN Server has been encapsulated as a windows service, and the configuration of the Apache server is only on the graphical interface, specifying the authentication method, access port and other simple operations; in addition, the management of user rights is also configured through the graphical interface.

2. Why not use TFS?

answer:

Since we started with Subversion and TortioseSVN, no other software was changed. As for TFS, I haven't used it so far. In fact, I just read some articles, and I don't know much about it.

3. Is VisualSVN Server free?

answer:

Yes, VisualSVN Server is free, while VisualSVN is paid. VisualSVN is the SVN client, integrated with Visual Studio, VisualSvn Server is the SVN server, including Subversion, Apache and user and authority management, the advantages have been mentioned above.

 

Well, let's get down to business, let's start our tutorial today.

 

First, the configuration and use of VisualSVN Server [server side]

After installing VisualSVN Server [see the installation process here ], run VisualSVN Server Manger, the following is the startup interface:

 

Ok, let me add a code repository [Repository], as shown below:

Create a new codebase as shown in the image above, and enter the codebase name in the text box shown in the image below:

Note: If the CheckBox in the above figure is selected, three subdirectories of trunk, branches, and tags will be created under the code base StartKit; if it is not selected, only the empty code base StartKit will be created.

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

After the codebase is created, there is nothing in it. I'll explain how to migrate the source code in the second part of this tutorial.

Next, we start the security settings, right-click on the Users on the left:

Enter the above information, click OK, we will create a user. According to the above process, add users Developer1, tester1, manager1 respectively. Well, let's start adding these users to the project we just created:

 

Click the "Add..." button in the picture above, select the user we just added in the picture below, and click the OK button:

Note: You may have noticed the Groups in the picture below. Yes, you can also create a group first, add users to each group, and then authorize the group. The operation is relatively simple and will be skipped here.

 

Authorize users [or groups] as shown in the following figure:

Click the "OK" button, and the above user will have different permissions to access the StartKit codebase.

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

In the actual project development process, it is often impossible for the Developer and the tester to have only one person. At this time, it is more convenient to use the group to authorize. You can practice this yourself.

2. Basic usage of TotoiseSVN

 

In the project management practice tutorial 1. If you want to do a good job, you must first sharpen your tools [Basic Tools], I have explained how to install TortoiseSVN. In the above explanation, I have already talked about how to use VisualSVN Server. Today I want to talk about the simple use of TortoiseSVN.

1. Check in the source code to the SVN server

If we use Visual Studio to create a project in the folder StartKit, we need to check the source code of this project into the code repository on SVN Server, first right-click the StartKit folder, the right-click menu at this time is as shown below :

Figure 2-2-1

Click Import to pop up the following form, where http://zt.net.henu.edu.cn is the server name, svn is the root directory of the code repository, and StartKit is a code base we added in the previous tutorial:

Note: The CheckBox in the lower left corner is not useful when checking in the source code for the first time, but it is very useful when you submit the code later.

Figure 2-2-2

 

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

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, OK, the source code has been successfully checked into the SVN server. At this time, team members can move out the source code on the SVN server to their own machines.

2. Check out the source code to this machine

Create a folder StartKit on the local machine, right-click Checkout, and the following window will pop up:

Figure 2-2-5

Enter the address of the code repository in the svn server in the text box under URL of Repository: in the above figure, other defaults, click the OK button to start checking out the source code.

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

At this time, a dialog box will also pop up, asking for a user name and password. After passing the verification, you can browse the content in the code base.

 

Get it! The source code has been successfully checked out into the newly created StartKit directory.

Open the StartKit directory and you can see the folder structure as shown below:

Figure 2-2-5

Once you make any modification to the file or folder, the displayed image of the file or folder will change. In the image below I have modified two of the files:

Figure 2-2-7

Let's take a look at the pictures corresponding to 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 local machine, and also simply understand the patterns corresponding to different states.

3. Submit the modified file to the SVN server

In Figure 2-2-7 above, I modified the two files ImageInfo.cs and NewsInfo.cs located in the Model file. The following demonstrates how to submit to the SVN server.

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

Right-click on the Model folder or right-click on the blank space under the Model file, and click SVN Commit... to pop up the following form:

Figure 2-2-9

After clicking the OK button, the following window will pop up:

Figure 2-2-10

 

Fourth, add new files to the SVN server

We add a new class file UserInfo.cs under the Model file, right-click on the blank space under the Model file, and click SVN Commit..., which is the same as submitting the modified file to the SVN server as mentioned above.

In addition, you can also right-click on the file UserInfo.cs, click TortoiseSVN=>>Add, and the following window will pop up:

Figure 2-2-11

Select the UserInfo.cs file and click the OK button. This does not submit the file to the SVN server, but only marks the file as a file in the source code repository and sets its status to modified. After that, we have to SVN Commit this file again before we can actually commit it to the code base on the SVN server.

 

The above is to add files. In fact, the steps for adding folders are the same, so I won't talk about them here.

 

5. Update the native code to be consistent with the latest version on the SVN server

This is also very simple, just right-click on the folder that needs to be updated or right-click on the blank space under the file, and click SVN Update.

Note: The update operation may fail due to version conflict, which can be resolved by using [Merge] or other methods; it may also fail due to locking [Get Lock], which requires unlocking [Release Lock] first.

6. Rename the file or folder and submit 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 pop-up form, and click the OK button. This method does not directly rename, but marks the name of the file or folder as the renamed name, and also requires us to use SVN Commit to submit to the SVN server before the actual renaming.

Seven, delete the file or folder, and submit the modification to the SVN server

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

Note: In fact, since you checked in the source code to the SVN server, the data and files of each version, even if you have deleted them, can be checked out at any time.

The above are just a few of the simplest functions of TortoiseSVN. In fact, its functions are far more than these. You can experience other functions slowly in the process of using them. I will use some functions in the following tutorials, and I will tell you about them. Clear usage.

Note: When submitting source code to the SVN server, be sure not to submit bin, obj and other folders, otherwise it will be very troublesome. Except the bin directory of the web project, but the dll generated by referencing other projects in the bin directory of the web project does not need to be submitted.

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 add a Library directory under your solution, put The required assemblies are copied here, and then referenced from the Library directory, what is the benefit of this, think about it yourself

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326528493&siteId=291194637