1. Configuration and usage of visual SVN server [server side]
Okay. Next I will add a code library [repository], for example:
Create a new code library as shown in, and enter the code library name in the text box shown in the following figure:
Note: If the checkbox in is selected, the trunk, branches, and tags subdirectories will be created under the code base startkit. If not selected, only the empty code base startkit will be created.
Click OK to create the code library.
After creating the code library, there is no content in it. I will explain how to migrate the source code in the second part of this tutorial.
Next, let's start security settings, right-click users on the left:
Enter the above information and click OK to create a user. Follow the steps above to add users Example 1, tester1, and manager1 respectively. Now, let's start adding these users to the project we just created:
Click "add...", select the user we just added in, and click OK:
Note: You may have noticed groups. Yes, you can also create a group, add users to each group, and then authorize the group. The operation is relatively simple and skipped here.
Authorize the user or group as follows:
Click "OK". The above user has different permissions to access the startkit code base.
Because starter is a newcomer to the team and does not want him to submit new code to the code library, he can only read the code in the code library and cannot submit the code. Tester1 is a tester and is not responsible for coding, so it is also a read-only permission. As developers and project managers, role 1 and manager1 naturally have the read and write permissions.
In the actual project development process, developers and tester often cannot have only one person. In this case, it is more convenient to use group authorization. You can practice it yourself.
Ii. Basic usage of toisesvn
In project management practice tutorial 1, to do a good job, you must first use the basic tools tool. I have explained how to install tortoisesvn. I have already explained how to use the visualsvn server in the above explanation. Today I want to talk about the simple usage of tortoisesvn.
I. 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 library on the svn server. First, right-click the startkit folder, the right-click menu at this time is shown in:
Figure 2-2-1
Click Import to bring up the following form, where the http://zt.net.henu.edu.cn is the server name, SVN is the root directory of the code repository, startkit is a code library we added in the previous tutorial:
Note: the checkbox in the lower-left corner is useless when the source code is checked in for the first time. However, it is very useful when you submit code later.
Figure 2-2-2
Click "OK". The following form is displayed, requiring creden:
Figure 2-2-3
In the above form, enter the user name and password, and click OK:
Figure 2-2-4
As shown in, the source code has been successfully checked into the svn server. At this time, the team members can move the source code from the svn server to their machines.
Ii. Check out the source code to the Local Machine
In the local machine, create the folder startkit and right-click checkout to bring up the following form:
Figure 2-2-5
In the text box at URL of repository: Enter the address of the code library in SVN server. By default, click OK to check out the source code.
Note: The checkout depth option in contains four options, namely, migrating out all, checking out only the sub-directories and files at the next level, checking out only files, and only checking out empty projects. The default option is the first item. In the above example, we can also access the code library in the Web way, enter http://zt.net.henu.edu.cn/svn/StartKit/ in the browser
In this case, a dialog box is displayed, asking you to enter the user name and password. After verification, you can view the content in the code library.
Done! The source code has been successfully checked out to the newly created startkit directory.
Open the startkit directory and you can see the folder structure as shown in:
Figure 2-2-5
Once you have made any changes to the file or folder, the display image of the file or folder will change. I modified two of these 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 briefly understand the pattern corresponding to different States.
3. Submit the modified file to the svn Server
In Figure 2-2-7 above, I modified the two imageinfo. CS and newsinfo. CS files in the model file. The following shows how to submit the files to the svn server.
Note: When submitting the source code to the server, make sure that the local code is the latest version. Otherwise, the submission may fail or cause version conflict.
Right-click the model folder or right-click the blank area under the model file, and click SVN commit... The following form is displayed:
Figure 2-2-9
Click OK to bring up the following form:
Figure 2-2-10
4. Add new files to the svn Server
Add a new class file userinfo. CS under the model file, right-click the blank space under the model file, and click SVN commit ..., This is the same as submitting modified files to the svn server.
In addition, you can right-click the file userinfo. CS and click tortoisesvn => Add to bring up the following form:
Figure 2-2-11
Select userinfo. CS file, click the OK button, so that the file is not submitted to the svn server, but the file is marked as a file in the source code library, and its status is changed. Then, we need to submit the svn commit file to the code library on the svn server.
The above is about adding files. In fact, the steps for adding folders are the same.
5. Update the local code to be consistent with the latest version on the svn server.
This is also very simple. You just need to right-click the folder to be updated or right-click the blank space under the file and click SVN update.
Note: The update operation may fail due to version conflict. You can use merge [merge] or another method to solve the problem. Alternatively, the update operation may fail because the get lock is locked, this is to unlock the [release lock] first ].
6. Rename the file or folder and submit the modification to the svn server.
Right-click the file or folder to be renamed, and click tortisesvn => rename ..., Enter a new name in the pop-up form and click OK. This method does not directly rename the file or folder, but marks the name of the file or folder as the name after renaming. We also need to submit it to the svn server using SVN commit to rename it.
7. delete files or folders and submit the changes to the svn server.
The easiest way is to directly delete files or folders and use SVN commit to submit updates to the svn server. Another method is to right-click the file or folder you want to delete> tortoisesvn => Delete to delete it. This method is not directly deleted, the state of the file or folder is set to delete. We also need to use SVN commit to submit it to the svn server before deleting it.
Note: In fact, from the time you migrate the source code to the svn server, data and files of each version can be moved out at any time even if you have deleted them.
The above are just the simplest functions of tortoisesvn. In fact, they are far more than these functions. You can learn about other functions in the process of using them, I will use some functions in the following tutorial. I will explain the usage in the future.
Note: When submitting source code to the svn server, do not submit folders such as bin and obj. Otherwise, it will be very troublesome. Except for the bin directory of the web project, 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 and FCKeditor, do not reference them from their installation location, but in your solution, add a library directory, copy the required assembly to this directory, and then reference it from the library directory. What are the advantages of this? Think about it for yourself!
Tortoise SVN client basic usage 1. Export and check out
Export download source code
Usage:
1. Create an empty folder and right-click it to view the tortoisesvn menu and SVN checkout above.
2. Don't worry about this checkout. We will select export... under the tortoisesvn menu, and then it will let you enter the URL.
3. For example, the svn address of the input [maze treasure] is: http://game-rts-framework.googlecode.com/svn/trunk/
4. Other options do not need to be changed. Do not select omit externals. The "head revision" option indicates the latest code version. Click "OK" to export the code to this directory :)
Check out means to check out. Although the same effect as export is to download the code from the server to the local computer, the checkout has a verification function. The code from checkout to somewhere will be monitored by tortoisesvn, the files in can enjoy various SVN services.
2. What issues should I pay attention to each code submission?
If you update files in the directory, you need to use the commit function to submit code. The commit function is not only for uploading, but will be compared with the files on the server, if you update a file and someone on the server updates the file, and the file is updated after you checkout, then it will try to integrate your updates with others' updates (merge). If the automatic merge is not successful, then report the conflict, you must manually perform merge, that is, you can write your updates in conflict with those of others.
It is best to fill in the log information during the commit, so that others can see what your updates are written. This is equivalent to uploading files and explaining the modifications made by myself. log is very important when many people work together.
Tortoisesvn commit only uploads the file that was previously checkout and modified. If you add some new files, you need to right-click the file and select Add. A plus sign will appear on the file, the next commit will be upload and marked as a green check. Files without a green check mark will not be commit.
If you need to rename or move a file with a green check box, do not use the Windows function. Right-click them and tortoisesvn has corresponding operations. Imagine that these files are no longer your local stuff. Tortoise must be aware of every action you make.
If you modify a file but you regret it, right-click it and select revert, which will change back to the last checkut. Or revert the entire project to any previous version.
Note:
------------- If multiple files need to be submitted at the same time and the files are in different directories, you must find the files in the shortest directory and Click Commit, tortoisesvn searches the clicked directory and all the files under the directory, and lists the modified files in the list.
------------- Check the files in the list carefully to determine which files need to be updated. If you do not need to update a file that has changed, right-click the file and choose restore; select the file to be added. Do not add the temporary file to the version library.
------------- In case of a file conflict (conflict: the file to be submitted has been changed by others and submitted to the version Library), enable the conflict resolution function.
3. How to synchronize local and server versions
Use update to synchronize local and server code. Right-click SVN update, and all the changes will be uploaded to your hard disk from the server. NOTE: If someone else deletes a file, you will also be deleted locally after the update.
If the local code has been modified, merge will be performed first like commit. If the Code fails, conflict will be reported.
4. How to switch between the branches or trunk of the same project
Use tortoise SVN --> Switch
Enter the branch or trunk URL in the URL
5. How to compare the differences between the two versions
Local Change
If you want to see more information about your local copy, you only need to right-click the resource manager and select tortoisesvn → compare the differences.
Differences with another branch/Tag
If you want to view the modifications to the main program (if you develop it on the branch) or the modifications to a branch (if you develop it on the trunk), you can right-click it and choose from the menu. Press the Shift key while clicking the file, and then select tortoisesvn → URL comparison. In the displayed dialog box, the URL address of the version to be compared with your local version is displayed.
You can also use the version library browser to select two directory tree comparisons, maybe two tags, or branch/Tag and the latest version. The mail menu allows you to compare them with different versions. Read section 5.9.2 "compare Folders" for more information.
Comparison with previous versions
If you want to view the differences between a specific version and local copy, select the version to be compared in the displayed log dialog box, and select compare from the context menu
Comparison of two previous versions
If you want to view the differences between any submitted two historical versions, select the two versions you want to compare in the version log dialog box (generally press Ctrl-change ), then, right-click the menu and select compare version differences.
If you do this in the version log of the folder, a compare version dialog box is displayed, showing the file modification list of the folder. Read section 5.9.2 "compare Folders" for more information.
Submit all modifications
If you want to view all changes to a version in a window, you can use the GNU snippets to display all the comparisons in a unified manner ). It displays part of all modifications. It is difficult to show a clear comparison, but all the changes will be displayed in a centralized manner. In the "version log" dialog box, select a version and choose "show all comparisons" from the context menu.
File differences
If you want to view the differences between two different files, you can directly select these two files in the Resource Manager (usually Ctrl-modifier), and right-click tortoisesvn in the menu → compare the differences.
Comparison between WC files/folders and URLs
If you want to view the differences between any file in your local copy and any file in the version library,
Comparison between condemned messages
If you want to view not only the differences but also the author, version number, and date of the modified version, you can compare the differences and condemnation information in the version log dialog box. For more information, see section 5.20.2 "difference tracing ".
Compare folder differences
The built-in tool of tortoisesvn does not support viewing the differences between multi-level directories, but you can use an external tool that supports this function. Here, section 5.9.4 "Other comparison/merge Tools" describes some of the tools we have used.
6. How do I know what files I have modified and what files others have modified when submitting code?
7. How to know who modified a certain row of a file
8. How to Create a branch or tag for an SVN master project
To create a branch, follow these steps:
1. Select the file where you want to generate the branch, right-click it, and select [branch/mark...]
2. In the [to URL (t)] input box, rename the file as your branch file name, enter the log information to facilitate differentiation, and click "OK.
3. A file you specified will be copied in the svn repository. The file name is what you named, but the new branch file name cannot be found in your local directory, to update your file to your branch, You must select a file, right-click it, and select [switch...]. select the file you want to rename and click OK. In this way, your local file is associated with the Branch file. Don't be surprised, the file name displayed on the local directory is still the old file name.
Experience summary:
1. If the file to be operated has not been submitted before, and you want to submit the file to the new branch, remember to switch.
2. SVN branch management is actually to save different branches with different files. Therefore, when you obtain the new version, you will find that the latest files of different branches will also be obtained.
The tag creation operation is equivalent to copying the current code version to other places, and then starting from this place for new development, with no interference with the original version.
For the three directories branches, tags, and trunk, it is not necessary for the subversion, but a good habit of Team Development summarized. The usage is as follows:
1. The developer submits all new features to the backbone. Daily modifications are submitted to/trunk: New features, bug fixes, and others.
2. The trunk is copied to the "publish" branch. When the team determines that the software is ready for release (for example, version 1.0),/trunk will be copied to/branches/1.0.
3. The project team continues to work in parallel. One team starts to perform rigorous tests on the branches, and the other team continues the new work at/trunk (for example, prepare 2.0 ), if a bug is found at any location, the bug fix needs to be shipped back and forth. However, this process sometimes ends. For example, the Branch is already "stuck" for the final test before release.
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. This tag is packaged and released to the customer.
5. Multiple branch maintenance. When version 2.0 continues to work on/trunk, bug fixes continue to be shipped from/trunk to/branches/1.0. If sufficient bug fixes are accumulated, the management department decides to release version 1.0.1: copy/branches/1.0 to/tags/1.0.1, And the tag is packaged and published.
Generally, when the initial repository is created, these three directories are created and all the code is put into/trunk. For example, to import the code under the project1 Directory into the repository, the structure of project1 is: project1/branches, project1/tags, project1/trunk, project1/trunk/food. c, project1/trunk/egg. PC ......, Import the project1 directory to repository to create the initial database. Then, the export is returned to project1 as the local working directory.