Project-level source code difference automatic statistical method and device
Through the comparison results of automated analysis and statistical code comparison tools, the problems of low statistical efficiency and high error rate of project-level source code differences in the existing technology are solved, and efficient automated statistics of project-level source code differences are achieved.
Patent Information
- Application Number
- CN202411192172.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2025-01-10
AI Technical Summary
Existing software source code comparison tools can only provide file-level differences, and cannot directly obtain project-level source code differences statistics, and require manual analysis and statistics, which are inefficient and prone to errors.
Provide an automatic statistical method of project-level source code differences, obtain comparison data through code comparison tools, and use the difference statistics tool to automatically analyze and count, calculate the total number of rows, total number of rows and number of different files of new and old projects, and realize Automated statistics on project-level source code differences.
Improve statistical efficiency, reduce error rate, and automatically obtain project-level source code differences information, improve efficiency and reduce manual errors.
Smart Images

Figure CN119292897A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of software testing, and in particular relates to a method and device for automatically counting differences in project-level source codes. Background Art
[0002] Project-level source code difference statistics are a must-do task during software testing and maintenance, and are also an important basis for calculating software development workload and analyzing software impact. In project-level source code difference statistics, the following sets of data need to be counted: total number of source code lines between the new and old projects, total number of difference lines, file types of source code differences between the new and old projects, and number of difference files.
[0003] At present, common software source code comparison tools have the following problems: the results given are file-level differences, see Figure 1 , it is impossible to directly obtain the difference statistics of the entire project; the given file-level difference results need to be manually analyzed and counted, and the difference between two files cannot be directly obtained; the file-level difference description cannot be automatically counted, and manual statistics are required. This kind of project-level source code difference can only be obtained through manual analysis, summary, and statistics to obtain file-level differences, and then summarize and count to obtain project-level difference statistics. This method is not only inefficient, but also prone to statistical errors due to manual participation. Summary of the invention
[0004] In order to solve the technical problems in the related art that the statistical efficiency of project-level source code differences is low and statistical errors are easy to occur, the present invention provides a method and device for automatically counting project-level source code differences, which automatically analyzes and counts the comparison results obtained by the code comparison tool, thereby obtaining the difference statistics of the source codes in the two projects; realizes the automatic acquisition of the number of source code difference lines of a single file; realizes the automatic statistics of the number of source code difference lines between the new and old project levels; realizes the automatic statistics of the file-level differences between the new and old projects, which improves the statistical efficiency and reduces the error rate compared with the existing technology. The technical scheme is as follows:
[0005] In a first aspect, a method for automatically counting project-level source code differences is provided, the method comprising:
[0006] Step 1: Import the new project files and the old project files into the code comparison tool;
[0007] Step 2: Set the comparison parameters in the code comparison tool to facilitate exporting the comparison data;
[0008] Step 3: Obtain comparison data through a code comparison tool to obtain a code difference comparison file and a same line comparison file;
[0009] Step 4: Import the code difference comparison file and the same line comparison file into the difference statistics tool, and the difference statistics tool performs statistical operations.
[0010] Optionally, the statistical operation in step 4 includes:
[0011] Get the mapping relationship between a single file in the new project file and a single file in the old project file, where the mapping relationship is established based on the file name;
[0012] Count the number of lines in a single file in the new project file and the number of lines in a single file in the old project file;
[0013] Based on the mapping relationship, the number of identical lines of a single file in the new project file and a single file in the old project file is obtained;
[0014] Calculate the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship;
[0015] Calculate the total number of lines, total number of identical lines, and total number of different lines in the new project file and the old project file; the total number of lines in the new project file is the sum of all lines in the new project file, the total number of lines in the old project file is the sum of all lines in the old project file, the total number of identical lines is the sum of the number of identical lines in all files, and the total number of different lines is the sum of the number of different lines in all files;
[0016] Calculate the number of difference files between the new and old projects.
[0017] Optionally, the process of counting the number of lines of a single file in the new project file and the number of lines of a single file in the old project file is:
[0018] Calculate the number of lines in a single file in the old project file M = I 最初 +U 最初 ,
[0019] Calculate the number of lines in a single file in the new project file N = I 最初 +I 添加 –I 删除 +U 最初 +U 添加 –U 删除 ,
[0020] Among them, I 最初 is the number of important original item lines of a single file in the old project file, U 最初 is the number of unimportant original item lines of a single file in the old project file, I 添加 Number of lines of significant additions to individual files in old project files, U 添加 Unimportant additions to individual files in old project files, I 删除 The number of important deleted lines for a single file in the old project file, U 删除Number of lines of unimportant deletions for individual files in old project files.
[0021] Optionally, when obtaining the same number of lines of a single file in the new project file and a single file in the old project file based on the mapping relationship, a traversal reading method is adopted.
[0022] Optionally, the process of calculating the number of difference lines between a single file in the new project file and a single file in the old project file based on the mapping relationship is:
[0023] For each group of new and old files in the mapping relationship, the difference between the number of lines of the file with a larger number of lines and the same number of lines is taken as the difference number of lines between the new and old files in the group.
[0024] Optionally, the process of calculating the number of difference files between the new and old projects is:
[0025] Traverse the mapping relationship between single files in the new project file and single files in the old project file. In the process of traversing each mapping relationship, count the number of old files, new files, changes, additions, deletions, and changes of the corresponding file type based on the number of lines of single files in the old project file, the number of lines of single files in the new project file, the number of difference lines, and the file type.
[0026] Optionally, calculate the number of difference files between the new and old projects, including:
[0027] a) Get the file type of the current file;
[0028] b) Determine whether the file type exists in the file statistics table: if it exists, proceed to c); if not, create a new file type in the file statistics table and proceed to c);
[0029] c) Under the corresponding file type, count the file information according to the changes of the current file:
[0030] If the number of lines of a single file in the old project file is > 0, the current type of file statistics "number of old files" + 1;
[0031] If the number of lines in a single file in the new project file is > 0, the current type of file statistics "number of new files" + 1;
[0032] If the number of lines of a single file in the old project file is > 0 and the number of lines of a single file in the new project file is > 0 and the number of difference lines is > 0, then the "number of changes" of the current type of file statistics is +1;
[0033] If the number of lines of a single file in the old project file = 0 and the number of lines of a single file in the new project file > 0, the "number of new files" in the current file type statistics is +1;
[0034] If the number of lines of a single file in the old project file is > 0 and the number of lines of a single file in the new project file is =0, the current type of file statistics "number of deletions" + 1;
[0035] If the number of difference lines is > 0, the "number of changes" of the current type of file statistics is increased by 1;
[0036] d) After completing the traversal of all files in the total statistics table, the difference file statistics information is obtained.
[0037] Optionally, the method further comprises:
[0038] Step 5: Display the final statistical results.
[0039] In a second aspect, a device for automatically counting project-level source code differences is provided, the device comprising:
[0040] Import module, used to import new project files and old project files into the code comparison tool;
[0041] The setting module is used to set the comparison parameters in the code comparison tool;
[0042] The acquisition module is used to obtain the comparison data through the code comparison tool to obtain the code difference comparison file and the same line comparison file;
[0043] The statistics module is used to import the code difference comparison file and the same line comparison file into the difference statistics tool, and the difference statistics tool performs statistical operations.
[0044] Optionally, the statistics module is specifically used for:
[0045] Get the mapping relationship between a single file in the new project file and a single file in the old project file, where the mapping relationship is established based on the file name;
[0046] Count the number of lines in a single file in the new project file and the number of lines in a single file in the old project file;
[0047] Based on the mapping relationship, the number of identical lines of a single file in the new project file and a single file in the old project file is obtained;
[0048] Calculate the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship;
[0049] Calculate the total number of lines, total number of identical lines, and total number of different lines in the new project file and the old project file; the total number of lines in the new project file is the sum of all lines in the new project file, the total number of lines in the old project file is the sum of all lines in the old project file, the total number of identical lines is the sum of the number of identical lines in all files, and the total number of different lines is the sum of the number of different lines in all files;
[0050] Calculate the number of difference files between the new and old projects.
[0051] The beneficial effects of the present invention are at least:
[0052] a) Use the difference statistics tool to automatically count the total number of new and old code lines, the total number of difference lines, and the total number of lines used;
[0053] b) Automatically count the number of files of various types in the old project, the number of files in the new project, the number of changes, deletions, additions, alterations, and the number of identical files;
[0054] c) Obtaining project-level code difference information through automated means improves efficiency and reduces error rates. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 This is an example diagram of the comparison results of the current code comparison tool;
[0056] Figure 2 A flow chart of a method for automatically counting project-level source code differences provided by the present invention;
[0057] Figure 3 A schematic diagram of importing old and new project files in the "old on the left and new on the right" mode provided by the present invention;
[0058] Figure 4 A schematic diagram of setting a "view display range" provided by the present invention to "display all";
[0059] Figure 5 A schematic diagram of a "folder directory structure" provided by the present invention being set to "ignore folder structure";
[0060] Figure 6 A schematic diagram of setting the export properties of a code difference comparison file provided by the present invention;
[0061] Figure 7 A schematic diagram of the same line comparison file export attribute setting provided by the present invention;
[0062] Figure 8 The tmp table style provided by the present invention;
[0063] Fig. 9 The general statistical table style provided by the present invention;
[0064] Fig.10 A schematic diagram of a process for obtaining a total statistics table from a tmp table provided by the present invention;
[0065] Fig.11 The file statistics table format provided by the present invention;
[0066] Fig.12A schematic diagram of a process for obtaining a total statistics table from a tmp table provided by the present invention;
[0067] Fig.13 A statistical table of differences provided by the present invention;
[0068] Fig.14 A difference statistics table generation process is provided by the present invention. DETAILED DESCRIPTION
[0069] The present application is further described in detail below through specific implementation methods and drawings.
[0070] The embodiment of the present invention designs and implements a difference statistics tool based on VBA (as well as Java, C, Pthyon, etc.), automatically analyzes and counts the comparison results obtained by code comparison tools (such as BeyondCompare, WinMerge, Diffuse), and thus obtains the difference statistics of the source codes in the two projects. Figure 2 As shown, in the embodiment of the present invention, the code comparison tool is BeyondCompare as an example, and the difference statistics tool is implemented by VBA for explanation. The method includes the following steps:
[0071] 1. Import the new project files and the old project files into the code comparison tool BeyondCompare;
[0072] 2. Set the comparison parameters in the code comparison tool to facilitate exporting the comparison data;
[0073] 3. Obtain comparison data through the code comparison tool to obtain code difference comparison files such as "report.csv" and same line comparison files such as "report.txt";
[0074] 4. Import the code difference comparison file (such as "report.csv") and the same line comparison file (such as "report.txt") into the difference statistics VBA tool. The difference statistics VBA tool performs the following statistical operations:
[0075] 1) Obtain a mapping relationship between a single file in the new project file and a single file in the old project file, where the mapping relationship is established based on the file name;
[0076] 2) Calculate the number of lines of a single file in the new project file and the number of lines of a single file in the old project file according to the calculation formula;
[0077] The specific calculation process is: the number of lines in a single file in the old project file M = I initially + U initially, the number of lines in a single file in the new project file is N = I initial + I addition – I deletion + U initial + U addition – U deletion. 最初is the number of important original item lines of a single file in the old project file, U 最初 is the number of unimportant original item lines of a single file in the old project file, I 添加 Number of lines of significant additions to individual files in old project files, U 添加 Unimportant additions to individual files in old project files, I 删除 The number of important deleted lines for a single file in the old project file, U 删除 Number of lines of unimportant deletions for individual files in old project files.
[0078] 3) Based on the mapping relationship, the number of identical lines of a single file in the new project file and a single file in the old project file is obtained; this step can be specifically performed in a traversal reading manner;
[0079] 4) Calculate the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship;
[0080] The specific calculation process is as follows: for each group of new and old files in the mapping relationship, the difference between the number of lines of the file with a larger number of lines and the same number of lines is taken as the difference number of lines of the new and old files in the group;
[0081] 5) Calculate the total number of lines, total number of identical lines, and total number of different lines in the new project file and the old project file; the total number of lines in the new project file is the sum of all lines in the new project file, the total number of lines in the old project file is the sum of all lines in the old project file, the total number of identical lines is the sum of the number of identical lines in all files, and the total number of different lines is the sum of the number of different lines in all files;
[0082] 6) Calculate the number of difference files between the new and old projects;
[0083] The specific calculation process is: traverse the mapping relationship between a single file in the new project file and a single file in the old project file. In the process of traversing each mapping relationship, based on the number of lines of a single file in the old project file, the number of lines of a single file in the new project file, the number of difference lines, and the file type, the "number of old files", "number of new files", "number of changes", "number of new additions", "number of deletions", and "number of changes" of the corresponding file types are counted through the designed calculation method.
[0084] 5. Display the final statistical results.
[0085] Taking the code comparison tool BeyondCompare as an example, the method provided by the embodiment of the present invention is further described, and the process is as follows:
[0086] 1. Import new and old projects into the comparison tool
[0087] Open the comparison tool and import the old and new project files into the tool in the order of "old on the left and new on the right", such as Figure 3 shown.
[0088] 2. Set the comparison parameters of the comparison tool
[0089] Set the following comparison parameters of the comparison tool to corresponding values:
[0090] 1) Set the "View Display Range" to "Show All", such as Figure 4 shown.
[0091] 2) Delete folders or files not related to source code;
[0092] 3) Set "Folder Directory Structure" to "Ignore Folder Structure", such as Figure 5 shown.
[0093] 3. Export comparison data
[0094] Select all files in the comparison tool, right-click and select "File Comparison Report" to export the following report:
[0095] 1) Export the code difference comparison file "report.csv": Select "Statistics" in "Report Layout" and "Plain Text" in "Output Options" to save the code difference comparison file (such as "report.csv"). Figure 6 shown.
[0096] 2) Export the same line comparison file "report.txt": Select "Summary" in "Report Layout" and "Plain Text" in "Output Options", and save "report.txt". Figure 7 shown.
[0097] 4. Variance Statistics VBA tool performs statistical operations
[0098] Place the code difference comparison file (such as "report.csv"), the same line comparison file (such as "report.txt") and the difference statistics VBA tool in the same folder, execute the macro designed in the statistics tool to perform statistics. The difference statistics VBA tool mainly completes the following tasks.
[0099] 4.1 Read in and export data
[0100] The Difference Statistics VBA tool reads the difference comparison file (such as "report.csv") and the same line comparison file (such as "report.txt"), and fills the data into the "tmp table" to obtain the mapping relationship between the single file in the new project file and the single file in the old project file, the file line difference statistics information, and the file same line information. For the specific style of the "tmp table", see Figure 8 .
[0101] 4.2 Counting the number of lines of code difference
[0102] Based on the "tmp table", the difference statistics VBA tool calculates the number of lines in the new project file and the number of lines in the old project file, the number of identical lines in the new project file and the old project file, and the number of different lines in the new project file and the old project file, and forms a "total statistics" table. The "total statistics" table style is as follows: Fig. 9 As shown, the table automatic generation process is as follows Fig.10 shown.
[0103] The main calculation formulas for obtaining the "Total Statistics" table from the "tmp table" include:
[0104] a) The number of lines in a single file in the old project file: M = I 最初 +U 最初 , where I 最初 is the number of important original item lines of a single file in the old project file, U 最初 The number of unimportant original item lines for a single file in the old project file;
[0105] b) The number of lines in a single file in the new project file is N = I 最初 +I 添加 –I 删除 +U 最初 +U 添加 –U 删除 , where I 添加 Number of lines of significant additions to individual files in old project files, U 添加 Unimportant additions to individual files in old project files 删除 The number of important deleted lines for a single file in the old project file, U 删除 Number of unimportant deleted item lines for individual files in old project files;
[0106] c) Number of lines of code in file differences
[0107] 1. If the number of lines of a single file in the old project file is greater than the number of lines of a single file in the new project file, the number of lines of file difference code = the number of lines of a single file in the old project file - the number of lines of a single file in the new project file;
[0108] 2. If the number of lines in a single file in the new project file is greater than or equal to the number of lines in a single file in the old project file, the number of lines of code in the file difference = the number of lines of code in the new file - the number of identical lines in the new and old files.
[0109] After completing the calculation of the number of lines and the number of different lines of a single file in all old project files and a single file in the new project files, automatic summary statistics can be performed to obtain the total number of lines, the total number of identical lines, and the total number of different lines of the old project files and the new project files.
[0110] 4.3 Count the number of difference files
[0111] Based on the "Total Statistics" table, the "File Statistics" table is calculated. The table style is shown in Fig.11 , the table automatic generation process is as follows Fig.12 shown.
[0112] The steps to count the number of difference files are as follows:
[0113] a) Traverse the files in the "Total Statistics" table one by one and obtain the file type of the current file (such as .c, .h, .cpp, etc.);
[0114] b) Determine whether the file type exists in the "File Statistics" table: if it exists, proceed to c); if not, create a new file type in the "File Statistics" table and proceed to c);
[0115] c) Under the corresponding file type, according to the changes of the current file, count the file information (number of old files, number of new files, number of changes, number of additions, number of deletions, number of changes):
[0116] 1) Statistics of the number of old project files of this type: If the number of lines of a single file in the old project file is > 0, the current type of file statistics "number of old files" + 1;
[0117] 2) Statistics of the number of new project files of this type: If the number of lines of a single file in the new project file is > 0, the current type of file statistics "number of new files" + 1;
[0118] 3) Statistics of the number of files changed of this type: If the number of lines of a single file in the old project file is > 0 and the number of lines of a single file in the new project file is > 0 and the number of difference lines is > 0, then the current type of file statistics "number of changes" + 1;
[0119] 4) Statistics of the number of newly added files of this type: If the number of lines of a single file in the old project file = 0 and the number of lines of a single file in the new project file > 0, the current type of file statistics "number of newly added files" + 1;
[0120] 5) Statistics of the number of deleted files of this type: If the number of lines of a single file in the old project file is > 0 and the number of lines of a single file in the new project file is 0, the current type of file statistics "number of deleted files" + 1;
[0121] 6) Statistics of the number of files of this type that have been changed: If the number of difference lines is > 0, the current type of file statistics "number of changes" + 1;
[0122] d) After traversing all the files in the "Total Statistics" table, the following is obtained: Fig.11 Differential file statistics.
[0123] 5. Display statistical results
[0124] The essence of displaying statistical results is to fill in the "Difference Statistics" table. The table style is shown in Fig.13 , the table generation process is shown in Fig.14 .
[0125] The embodiment of the present invention further provides a device for automatically counting project-level source code differences, the device comprising:
[0126] Import module, used to import new project files and old project files into the code comparison tool;
[0127] The setting module is used to set the comparison parameters in the code comparison tool;
[0128] The acquisition module is used to obtain the comparison data through the code comparison tool to obtain the code difference comparison file and the same line comparison file;
[0129] The statistics module is used to import the code difference comparison file and the same line comparison file into the difference statistics tool, and the difference statistics tool performs statistical operations.
[0130] Optionally, the statistics module is specifically used for:
[0131] Get the mapping relationship between a single file in the new project file and a single file in the old project file, where the mapping relationship is established based on the file name;
[0132] Count the number of lines in a single file in the new project file and the number of lines in a single file in the old project file;
[0133] Based on the mapping relationship, the number of identical lines of a single file in the new project file and a single file in the old project file is obtained;
[0134] Calculate the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship;
[0135] Calculate the total number of lines, total number of identical lines, and total number of different lines in the new project file and the old project file; the total number of lines in the new project file is the sum of all lines in the new project file, the total number of lines in the old project file is the sum of all lines in the old project file, the total number of identical lines is the sum of the number of identical lines in all files, and the total number of different lines is the sum of the number of different lines in all files;
[0136] Calculate the number of difference files between the new and old projects.
[0137] It should be noted that the execution process of the above modules can refer to the specific process of each step in the above method embodiment, which will not be repeated here.
[0138] The above only expresses the implementation methods of the present application, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present application, which all belong to the protection scope of the present application. In addition, the parts that are not detailed in this application are all conventional technologies.
Claims
1. A method for automatically counting project-level source code differences, characterized in that: The method comprises: Step 1: Import the new project files and the old project files into the code comparison tool; Step 2: Set the comparison parameters in the code comparison tool; Step 3: Obtain comparison data through a code comparison tool to obtain a code difference comparison file and a same line comparison file; Step 4: Import the code difference comparison file and the same line comparison file into the difference statistics tool, and the difference statistics tool performs statistical operations.
2. The method according to claim 1, characterized in that The statistical operations in step 4 include: Get the mapping relationship between a single file in the new project file and a single file in the old project file, where the mapping relationship is established based on the file name; Count the number of lines in a single file in the new project file and the number of lines in a single file in the old project file; Based on the mapping relationship, the number of identical lines of a single file in the new project file and a single file in the old project file is obtained; Calculate the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship; Calculate the total number of lines, total number of identical lines, and total number of different lines in the new project file and the old project file; the total number of lines in the new project file is the sum of all lines in the new project file, the total number of lines in the old project file is the sum of all lines in the old project file, the total number of identical lines is the sum of the number of identical lines in all files, and the total number of different lines is the sum of the number of different lines in all files; Calculate the number of difference files between the new and old projects.
3. The method according to claim 2, characterized in that The process of calculating the number of lines in a single file in the new project file and the number of lines in a single file in the old project file is: Calculate the number of lines in a single file in the old project file M = I 最初 +U 最初 , Count the number of lines in a single file in a new project file N=I 最初 +I 添加 –I 删除 +U 最初 +U 添加 –U 删除 , Among them, I 最初 is the number of important original item lines of a single file in the old project file, U 最初 is the number of unimportant original item lines of a single file in the old project file, I 添加 Number of lines of significant additions to individual files in old project files, U 添加 Unimportant additions to individual files in old project files, I 删除 The number of important deleted lines for a single file in the old project file, U 删除 Number of lines of unimportant deletions for individual files in old project files.
4. The method according to claim 2, characterized in that: When obtaining the same number of lines of a single file in the new project file and a single file in the old project file based on the mapping relationship, a traversal reading method is adopted.
5. The method according to claim 2, characterized in that: The process of calculating the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship is: For each group of new and old files in the mapping relationship, the difference between the number of lines of the file with a larger number of lines and the same number of lines is taken as the difference number of lines between the new and old files in the group.
6. The method according to claim 2, characterized in that The process of calculating the number of difference files between the new and old projects is: Traverse the mapping relationship between single files in the new project file and single files in the old project file. In the process of traversing each mapping relationship, count the number of old files, new files, changes, additions, deletions, and changes of the corresponding file type based on the number of lines of single files in the old project file, the number of lines of single files in the new project file, the number of difference lines, and the file type.
7. The method according to claim 6, characterized in that Calculate the number of difference files between the new and old projects, including: a) Get the file type of the current file; b) Determine whether the file type exists in the file statistics table: if it exists, proceed to c); if it does not exist, create a new file type in the file statistics table and proceed to c); c) Under the corresponding file type, count the file information according to the changes of the current file: If the number of lines of a single file in the old project file is > 0, the current type of file statistics "number of old files" + 1; If the number of lines in a single file in the new project file is > 0, the "number of new files" of the current type of file statistics will be increased by 1; If the number of lines of a single file in the old project file is > 0 and the number of lines of a single file in the new project file is > 0 and the number of difference lines is > 0, then the "number of changes" of the current type of file statistics is +1; If the number of lines of a single file in the old project file = 0 and the number of lines of a single file in the new project file > 0, the "number of new files" of the current type of file statistics is +1; If the number of lines of a single file in the old project file is > 0 and the number of lines of a single file in the new project file is 0, the current type of file statistics "number of deletions" + 1; If the number of difference lines is > 0, the "number of changes" of the current type of file statistics is +1; d) After completing the traversal of all files in the total statistics table, the difference file statistics information is obtained.
8. The method according to any one of claims 1 to 7, characterized in that: After step 4, the method further comprises: Step 5: Display the final statistical results.
9. An automatic statistical device for project-level source code differences, characterized in that: Used to perform the method according to any one of claims 1 to 8, the device comprises: Import module, used to import new project files and old project files into the code comparison tool; The setting module is used to set the comparison parameters in the code comparison tool; The acquisition module is used to obtain the comparison data through the code comparison tool to obtain the code difference comparison file and the same line comparison file; The statistics module is used to import the code difference comparison file and the same line comparison file into the difference statistics tool, and the difference statistics tool performs statistical operations.
10. The device according to claim 9, characterized in that The statistics module is specifically used for: Get the mapping relationship between a single file in the new project file and a single file in the old project file, where the mapping relationship is established based on the file name; Count the number of lines in a single file in the new project file and the number of lines in a single file in the old project file; Based on the mapping relationship, the number of identical lines of a single file in the new project file and a single file in the old project file is obtained; Calculate the number of different lines between a single file in the new project file and a single file in the old project file based on the mapping relationship; Calculate the total number of lines, total number of identical lines, and total number of different lines in the new project file and the old project file; the total number of lines in the new project file is the sum of all lines in the new project file, the total number of lines in the old project file is the sum of all lines in the old project file, the total number of identical lines is the sum of the number of identical lines in all files, and the total number of different lines is the sum of the number of different lines in all files; Calculate the number of difference files between the new and old projects.