Overview: In the development process, we sometimes need to provide code differences to others. When SVN is used for version control, there are two types of processing: local modifications that have not been submitted to the warehouse and modifications that have been submitted to the warehouse. This article explains these two situations.
1. Local modifications not submitted to the warehouse
For local modifications not submitted to the warehouse, differences can be easily exported and imported through patch.
Right-click on the directory to be exported, and click “Create patch”.
Next, check the files that need to be exported, click OK, and select the generation path. A file with the suffix .patch will be generated under the specified path, which contains the differences.
Correspondingly, if we get a patch file, how do we import it into the code? First of all, right-click the directory that needs to be imported and select “Apply patch”.
After selecting the patch to be imported, all the difference files will be listed. We can check the differences of which files to import according to our needs.
Two. Modifications that have been submitted to the repository
For the modifications that have been submitted to the repository, we cannot use the export patch The way. Therefore, it is necessary to export the difference files between the two versions and compare them with the comparison tool. Assuming that we need to obtain the 11th, 12th, and 13th versions of the modification, we need to export the corresponding files of the 10th version and the 13th version for comparison.
First open the log and select the 10th and 13th versions. Then right click and select “Compare revisions”.
All the difference files between the 10th and 13th editions will be listed in the menu. We can select the file that needs to be exported. Then right-click, select “Export selection to”, select the export path, and you can get the corresponding files of version 13 (the same directory level as the source code is still retained, which is very convenient for comparison).
Click the small arrow in the upper right corner, and then export again, you can get the corresponding version 10 File (also retains the same directory hierarchy as the source code).
Use the comparison tool to compare, you can see the difference.