Code submission method and device, electronic equipment and computer program product

By sending audit requests to the code review system and obtaining relevant information, and automatically generating and submitting submission information of code files, the problem of redundant manual operations during the code submission process is solved, and the submission efficiency and accuracy are improved.

CN119806616AActive Publication Date: 2025-04-11HILLSTONE NETWORKS CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411774224.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-04-11
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

There are redundant manual operations during the code submission process, resulting in low submission efficiency, including repeated selection of files and filling in submission information, which can easily lead to human errors.

Method used

By sending an audit request to the code review system, obtaining the audit identifier and modifying the difference file, and automatically obtaining the code modification description information after the audit is passed, generating submission information, and directly submitting the modification difference file and submitting information to the code repository.

Benefits of technology

It avoids redundant manual operations, realizes the automated process of code file submission, and improves the accuracy and efficiency of code file submission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806616A_ABST
    Figure CN119806616A_ABST
Patent Text Reader

Abstract

The invention discloses a code submission method and device, electronic equipment and a computer program product, and relates to the technical field of computers.The method comprises the steps that in response to a code submission operation of a first branch, a first auditing request is sent to a code auditing system, according to a first auditing identifier generated by the code auditing system for the first branch based on the first auditing request, obtaining a modification difference file of the first auditing identifier, and after an auditing result of the first auditing identifier returned by the code auditing system is passing, obtaining code modification description information of the first auditing identifier, and generating submission information of the first branch based on the code modification description information, the first auditing identifier and branch information of the first branch, and submitting at least one of the modification difference file and the target code file and the submission information of the first branch to the first branch in the code warehouse. According to the method and the device, the technical problem of relatively low submission efficiency caused by redundant manual operation when the code file is submitted in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a code submission method and device, an electronic device, and a computer program product. Background Art

[0002] Centralized version control systems, such as Subversion (SVN), are widely used version control tools for storing and managing code bases on central servers. When using SVN to submit code changes, developers are required to fill in submission information, which contains a description of the changes and related background information, thus providing other team members with a way to quickly trace back and review the change history.

[0003] Currently, in order to further improve code quality and reduce potential errors, a code review system is introduced before each code submission. Therefore, the current code submission process usually includes the following process: (1) Select the file to be submitted; (2) Submit the file to the code review system; (3) Fill in the root cause of the modification and the modification plan; (4) Wait for the approval to be completed; (5) Select the file to be submitted again; (6) Fill in the SVN submission information (including the root cause of the modification and the modification plan); (7) Submit the code to the code repository.

[0004] Although the above process can improve the quality of code submission, there are some redundant operations and potential human errors. For example, developers need to select the same file twice in the code review system and SVN, which not only increases the complexity of the operation but also may lead to selection errors; repeatedly filling in submission information not only wastes time but may also lead to inconsistent information due to negligence; it is easy to miss certain files or information in manual operations, especially when dealing with a large number of code changes.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present invention provide a code submission method and device, an electronic device and a computer program product, so as to at least solve the technical problem in the related art that redundant manual operations exist when submitting code files, resulting in low submission efficiency.

[0007] According to one aspect of an embodiment of the present invention, there is provided a code submission method, which is applied to a client, and includes: in response to a code submission operation for a first branch, sending a first review request to a code review system, wherein the first review request includes branch information of the first branch and a target code file to be submitted; according to a first review identifier generated by the code review system for the first branch based on the first review request, obtaining a modified difference file corresponding to the first review identifier, wherein the modified difference file is used to record difference information generated by modifying an original code file corresponding to the target code file to the target code file; when the review result corresponding to the first review identifier returned by the code review system is passed, obtaining code modification description information corresponding to the first review identifier, and generating submission information of the first branch based on the code modification description information, the first review identifier and the branch information of the first branch; submitting the modified difference file and at least one of the target code file and the submission information of the first branch to the first branch in a code repository.

[0008] Furthermore, the submission method also includes: in response to a code synchronization operation on the first branch and at least one second branch, sending a second review request to the code review system, wherein the second review request includes branch information of each second branch, the modified difference file, and code modification description information corresponding to the first review identifier; obtaining the second review identifier generated by the code review system for each second branch according to the second review request and the review result corresponding to each second review identifier; for each second branch whose review result is passed, generating submission information of the second branch according to the code modification description information corresponding to the first review identifier, the second review identifier corresponding to the second branch, and the branch information of the second branch; submitting the modified difference file and at least one of the target code file, and the submission information of each second branch to each second branch in the code repository.

[0009] Furthermore, obtaining the modified difference file corresponding to the first audit identifier includes: obtaining the original code file corresponding to the target code file from the code repository; calling a preset command provided by a local code management tool to generate the difference content of the target code file compared to the original code file, and obtaining the modified difference file corresponding to the first audit identifier.

[0010] Furthermore, the submission method also includes: creating a scheduled task corresponding to the first audit identifier; wherein the scheduled task is used to periodically query the audit result corresponding to the first audit identifier from the code review system; or, receiving the audit result corresponding to the first audit identifier returned by the code review system.

[0011] Furthermore, obtaining the code modification description information corresponding to the first review identifier includes: obtaining the code modification description information input by the user for the first review identifier from the code review system; or, receiving the code modification description information input by the user for the first review identifier on the interactive interface of the client; wherein the code modification description information includes at least: modification factor information and modification description information.

[0012] Furthermore, the submission method also includes: adding the first review identifier to a preset review list, wherein the preset review list is used to record the review status corresponding to each review identifier; and updating the review status corresponding to the first review identifier according to the review result corresponding to the first review identifier returned by the code review system.

[0013] Furthermore, after updating the audit status corresponding to the first audit identifier, it also includes: when it is detected that the audit status corresponding to the first audit identifier is a failed audit status, obtaining the audit result information corresponding to the first audit identifier from the code audit system; based on the audit result information, adjusting the target code file, and based on the adjusted target code file, re-determining the modified difference file.

[0014] According to another aspect of an embodiment of the present invention, there is also provided a code submission device, which is applied to a client and includes: a first sending unit, which is used to send a first review request to a code review system in response to a code submission operation for a first branch, wherein the first review request includes branch information of the first branch and a target code file to be submitted; a first acquisition unit, which is used to acquire a modified difference file corresponding to a first review identifier generated by the code review system for the first branch based on the first review request, wherein the modified difference file is used to record the difference information generated by modifying an original code file corresponding to the target code file to the target code file; a second acquisition unit, which is used to acquire code modification description information corresponding to the first review identifier when the review result corresponding to the first review identifier returned by the code review system is passed, and generate submission information of the first branch based on the code modification description information, the first review identifier and the branch information of the first branch; a first submission unit, which is used to submit the modified difference file and at least one of the target code file and the submission information of the first branch to the first branch in the code repository.

[0015] Furthermore, the submission device also includes: a second sending unit, used to send a second review request to the code review system in response to a code synchronization operation on the first branch and at least one second branch, wherein the second review request includes branch information of each second branch, the modified difference file, and code modification description information corresponding to the first review identifier; a third acquisition unit, used to obtain the second review identifier generated by the code review system for each second branch according to the second review request and the review result corresponding to each second review identifier; a first generation unit, used to generate submission information of the second branch for each second branch whose review result is passed according to the code modification description information corresponding to the first review identifier, the second review identifier corresponding to the second branch, and the branch information of the second branch; a second submission unit, used to submit the modified difference file and at least one of the target code file, and the submission information of each second branch to each second branch in the code repository.

[0016] Furthermore, the first acquisition unit includes: a first acquisition module, used to obtain the original code file corresponding to the target code file from the code repository; a first generation module, used to call a preset command provided by a local code management tool to generate the difference content of the target code file compared to the original code file, and obtain a modified difference file corresponding to the first review identifier.

[0017] Furthermore, the submission device also includes: a first creation unit, used to create a scheduled task corresponding to the first audit identifier; wherein the scheduled task is used to periodically query the audit result corresponding to the first audit identifier from the code audit system; and a first receiving unit, used to receive the audit result corresponding to the first audit identifier returned by the code audit system.

[0018] Furthermore, the second acquisition unit includes: a second acquisition module, used to obtain the code modification description information entered by the user for the first review identifier from the code review system; a first receiving module, used to receive the code modification description information entered by the user for the first review identifier on the interactive interface of the client; wherein the code modification description information includes at least: modification factor information and modification description information.

[0019] Furthermore, the submission device also includes: a first adding unit, used to add the first review identifier to a preset review list, wherein the preset review list is used to record the review status corresponding to each review identifier; a first updating unit, used to update the review status corresponding to the first review identifier according to the review result corresponding to the first review identifier returned by the code review system.

[0020] Furthermore, the submission device also includes: a fourth acquisition unit, which is used to obtain the audit result information corresponding to the first audit identifier from the code audit system after updating the audit status corresponding to the first audit identifier and detecting that the audit status corresponding to the first audit identifier is a failed audit status; a first adjustment unit, which is used to adjust the target code file based on the audit result information, and redetermine the modified difference file based on the adjusted target code file.

[0021] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the code submission method described in any one of the above is implemented.

[0022] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any one of the above-mentioned code submission methods.

[0023] In the present invention, in response to a code submission operation for a first branch, a first review request is sent to a code review system, and according to a first review identifier generated by the code review system for the first branch based on the first review request, a modified difference file corresponding to the first review identifier is obtained, and when the review result corresponding to the first review identifier returned by the code review system is passed, code modification description information corresponding to the first review identifier is obtained, and based on the code modification description information, the first review identifier and the branch information of the first branch, submission information of the first branch is generated, and at least one of the modified difference file and the target code file, and the submission information of the first branch are submitted to the first branch in the code repository, thereby solving the technical problem in the related art that redundant manual operations exist when submitting code files, resulting in low submission efficiency.

[0024] In the present invention, through the review identifier, the client can connect to the code review system during the code submission process, and can automatically obtain the code file review status through the client, and automatically obtain the corresponding code modification description information after the review is passed to generate submission information, and then submit the determined modification difference file and submission information to the corresponding branch in the code repository, which can avoid redundant manual operations, realize the automation process of code file submission, improve the accuracy of code file submission, and thus achieve the technical effect of efficiently submitting code files. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0026] Figure 1 is a flow chart of an optional code submission method according to an embodiment of the present invention;

[0027] Figure 2 It is a schematic diagram of an optional multi-branch code submission process according to the related art;

[0028] Figure 3 is a schematic diagram of an optional multi-branch code submission process using a preset submission tool according to an embodiment of the present invention;

[0029] Figure 4 is a schematic diagram of an optional automatic code file submission process according to an embodiment of the present invention;

[0030] Figure 5 is a schematic diagram of an optional code submission device according to an embodiment of the present invention;

[0031] Figure 6 The present invention is a hardware structure block diagram of an electronic device for a code submission method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated, and corresponding operation entrances are provided for users to choose to authorize or refuse. For example, an interface is set between the system and the relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0035] The present invention constructs a client that can be used as a tool for integrating multi-version code review, synchronization and submission. The tool can avoid redundant operations in the code review and code submission process, effectively reduce the human operation steps in the code submission process, and avoid erroneous submissions caused by human under-selection or over-selection of files, thereby improving the efficiency of code submission and review, and further realizing a more efficient and automated code file submission process.

[0036] In the present invention, the initial submission process of the code file can be replicated to other branches for synchronization, and the audit information required by the code audit system can be synchronized to all other branches with one click, thereby improving the efficiency of code submission and synchronization.

[0037] The present invention is described in detail below in conjunction with various embodiments.

[0038] Embodiment 1

[0039] According to an embodiment of the present invention, an embodiment of a code submission method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0040] Figure 1 is a flowchart of an optional code submission method according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0041] Step S101, in response to a code submission operation for a first branch, sending a first review request to a code review system, wherein the first review request includes branch information of the first branch and a target code file to be submitted.

[0042] In step S101, the code file to be submitted (i.e., the target code file to be submitted, which contains the changed code version) and the branch to which the code file needs to be submitted (i.e., the first branch) can be determined first. Then, a code submission operation for the first branch can be initiated on the client. For the code submission operation for the first branch, the client sends a first review request to the code review system. The first review request includes branch information of the first branch (including information such as a branch identifier) ​​and the target code file to be submitted.

[0043] Optionally, you can use a preset submission tool to submit the selected code files to the code review system on the client. The preset submission tool is a pre-built integrated multi-version code review, synchronization and submission tool that can automate code review, code submission and multi-branch code synchronization processes, improving the efficiency of code submission and synchronization.

[0044] Step S102, according to the first audit identifier generated by the code audit system for the first branch based on the first audit request, obtain a modified difference file corresponding to the first audit identifier, wherein the modified difference file is used to record the difference information generated by modifying the original code file corresponding to the target code file to the target code file.

[0045] In an embodiment of the present invention, after submitting a code file to the code review system (i.e., after sending a first review request to the code review system), the code review system generates a unique review id (i.e., a first review identifier) ​​corresponding to the target code file to be submitted and the branch to be submitted (i.e., the first branch). In this way, it is convenient to subsequently connect the review process and the code submission process of the code file in the code review system through the unique review identifier.

[0046] In an optional embodiment, after receiving the target code file, the code review system initiates an audit requirement request to a preset submission tool, and generates a first audit identifier based on the audit information returned by the preset submission tool based on the audit requirement request. That is, after receiving the target code file, the code review system can initiate an audit requirement request to the preset submission tool (which can carry audit requirement information, such as the current code version number, modification overview, and other information). The preset submission tool can then display the audit requirement information to the developer's terminal and receive the audit information returned by the terminal (that is, the audit information filled in by the terminal based on the audit requirement information). The code review system then generates a first audit identifier based on the returned audit information.

[0047] In the embodiment of the present invention, a preset submission tool may be used to record the review id generated by the code review system.

[0048] In an embodiment of the present invention, a modified difference file corresponding to the first audit identifier can be obtained according to the first audit identifier generated by the code audit system for the first branch based on the first audit request. For example, a preset submission tool can be used to compare the target code file with the original code file corresponding to the target code file (the original code file is stored in the code repository) to obtain a modified difference file corresponding to the first audit identifier (the file records the difference information generated by modifying the original code file corresponding to the target code file to the target code file), and the preset submission tool is used to record the modified difference file. In this way, when the target code file is subsequently synchronized to other branches, the modified difference file can be used directly without regeneration, thereby improving synchronization efficiency.

[0049] Optionally, the preset submission tool can call the diff command (i.e., comparison command) provided by the local code management tool (such as SVN) through code, such as svn diff, to record the difference content of the files to be submitted, obtain the modified difference file, and correspondingly record the branch and the generated review id, and store them locally in the preset submission tool.

[0050] In an embodiment of the present invention, after submitting the code file to the code review system, the code review system can review the code file to determine whether the modification of the code file complies with the specifications, whether the modified code is readable and compilable, and whether there is security, etc., thereby giving a review result.

[0051] Step S103, when the review result corresponding to the first review identifier returned by the code review system is passed, obtain the code modification description information corresponding to the first review identifier, and generate the submission information of the first branch based on the code modification description information, the first review identifier and the branch information of the first branch.

[0052] In step S103, if it is detected that the review result corresponding to the first review identifier is passed, the code submission process will be triggered, and the code modification description information corresponding to the first review identifier (including the reason for the code modification and the specific description of the code modification) can be queried from the code review system, and then the queried code modification description information is merged with the submission terminal identifier, review id (i.e., the first review identifier), branch information of the first branch and other information to assemble the submission information of the SVN code that meets the standards (i.e., the submission information of the first branch).

[0053] In the embodiment of the present invention, the code modification description information is the relevant information required by the code review system during the review of the code file, and can be input through the developer's terminal.

[0054] Step S104: submit at least one of the modified difference file and the target code file, and the submission information of the first branch to the first branch in the code repository.

[0055] In step S104, the client can obtain at least one of the modified difference file and the target code file from the local of the preset submission tool, and obtain the generated first submission information, and then submit at least one of the modified difference file and the target code file, and the first submission information to the first branch in the code repository to complete the submission of the target code file.

[0056] In summary, through the review mark, the client can connect to the code review system during the code submission process, and can automatically obtain the code file review status through the client, and automatically obtain the corresponding code modification description information after the review is passed to generate submission information, and then submit the determined modification difference file and submission information to the corresponding branch in the code repository, which can avoid redundant manual operations, realize the automation process of code file submission, improve the accuracy of code file submission, and achieve the technical effect of efficiently submitting code files, thereby solving the technical problem of redundant manual operations in submitting code files in related technologies, resulting in low submission efficiency.

[0057] In order to efficiently synchronize code files to other branches, in the code submission method provided in Example 1 of the present application, in response to the code synchronization operation on a first branch and at least one second branch, a second review request is sent to the code review system, wherein the second review request includes branch information of each second branch, a modified difference file, and code modification description information corresponding to the first review identifier; the second review identifier generated by the code review system for each second branch according to the second review request and the review result corresponding to each second review identifier are obtained; for each second branch whose review result is passed, the submission information of the second branch is generated according to the code modification description information corresponding to the first review identifier, the second review identifier corresponding to the second branch, and the branch information of the second branch; and the submission information of each second branch is submitted to each second branch in the code repository.

[0058] In an embodiment of the present invention, if the target code file needs to be submitted to other branches, since the preset submission tool has recorded the modified difference file and the review id (i.e., the first review identifier) ​​in the process of submitting the target code file to the branch to be submitted, at this time, only the other branch to be submitted (i.e., the second branch) needs to be selected, and the tool will call the synchronization command (i.e., the preset synchronization command, such as svn patch) provided by the code management tool (such as SVN) to automatically synchronize the modified difference file corresponding to the code file to the other branches that need to be submitted. In addition, the tool can automatically initiate an audit process for each other branch, and automatically fill the audit information corresponding to the recorded first audit identifier (i.e., the information used by the code audit system when auditing the target code file, such as the code version number, code modification overview, etc.) into the review id (second review identifier) ​​corresponding to the new other branch. Afterwards, if it is detected that the target code file has been audited and passed in other branches, the target code file can be synchronized to other branches according to the modified difference files synchronized in other branches (for example, the modified difference file can be generated into a corresponding patch package through the svn patch command, and the patch package can be applied to other branches to be submitted, so that the difference is successfully synchronized to other branches to be submitted). In this way, there is no need to repeatedly fill in the review information to complete the review process of the target code file when it is synchronized to other branches, which improves the synchronization efficiency.

[0059] In some embodiments, when the target code file needs to be submitted to at least one second branch, a code synchronization operation between the first branch and at least one second branch is initiated on the client. Then, for the code synchronization operation between the first branch and at least one second branch, a preset submission tool sends a second review request (including branch information of each second branch, a modified difference file, and code modification description information corresponding to the first review identifier) ​​to the code review system on the client. Then, the second review identifier generated by the code review system for each second branch according to the second review request and the review result corresponding to each second review identifier are obtained. Then, for each second branch whose review result is passed, the submission information of the second branch is generated according to the code modification description information corresponding to the first review identifier, the second review identifier corresponding to the second branch, and the branch information of the second branch. Finally, the modified difference file and at least one of the target code file and the submission information of each second branch are submitted to each second branch in the code repository to complete the synchronization of the target code file to the second branch.

[0060] In an embodiment of the present invention, before synchronizing the target code file to the second branch, it is also necessary to be reviewed by the code review system, and the code review system needs to regenerate the corresponding second review identifier for the target code file synchronized to each second branch. Then, the preset submission tool is used to obtain the second review identifier corresponding to both the target code file and the second branch from the code review system. The preset submission tool is used to query the code modification description information corresponding to the first review identifier, and the code modification description information is associated with the second review identifier. In this way, the extraction of difference information between different code versions can be reduced. Then, according to the code modification description information associated with the second review identifier, combined with the second review identifier and the second branch, the second submission information can be generated, and then the modified difference file and the second submission information are submitted to the second branch in the code repository, thereby completing the process of synchronizing the target code file to the second branch. In this way, some redundant operations can be reduced and the synchronization efficiency can be improved.

[0061] In the embodiment of the present invention, if there are multiple second branches that need to be synchronized, the above process is repeated to complete the code submission of all branches.

[0062] In order to improve the accuracy of obtaining the modified difference file corresponding to the first review identifier, in the code submission method provided in Example 1 of the present application, the original code file corresponding to the target code file is obtained from the code repository; the preset command provided by the local code management tool is called to generate the difference content of the target code file compared to the original code file, and obtain the modified difference file corresponding to the first review identifier.

[0063] In an embodiment of the present invention, the preset submission tool can obtain the original code file corresponding to the target code file from the code repository on the client, and then call the diff command (i.e., the preset command) provided by the local code management tool (such as SVN) through code, such as svn diff, to generate the difference content of the target code file compared to the original code file, and obtain the modified difference file corresponding to the first review identifier.

[0064] In the code submission method provided in Example 1 of the present application, a scheduled task corresponding to a first review identifier is created; wherein the scheduled task is used to periodically query the review result corresponding to the first review identifier from the code review system; or, receive the review result corresponding to the first review identifier returned by the code review system.

[0065] In an embodiment of the present invention, a scheduled task corresponding to the first audit identifier can be created on the client to query the audit result corresponding to the first audit identifier from the code audit system at a regular interval. In addition, the code audit system can also return the audit result of the audit identifier corresponding to the code file to the client after completing the audit of the code file.

[0066] In the code submission method provided in Example 1 of the present application, obtaining code modification description information corresponding to the first review identifier includes: obtaining code modification description information input by the user for the first review identifier from the code review system; or, receiving code modification description information input by the user for the first review identifier on the interactive interface of the client; wherein the code modification description information includes at least: modification factor information and modification description information.

[0067] In an embodiment of the present invention, after generating the first review identifier, the code review system can initiate a code review request to a preset submission tool. The preset submission tool can then record the first review identifier and display the information required for the code review request to the developer's terminal, and then receive the modification factor information and modification description information filled in by the terminal according to the information required for the code review request, and after associating the first review identifier with these code modification description information, send it to the code review system, so that the code review system reviews the target code file according to these code modification description information.

[0068] In an embodiment of the present invention, in order to improve the efficiency of code synchronization, the code modification description information input by the user for the first review identifier can be obtained from the code review system, or the code modification description information input by the user for the first review identifier on the interactive interface of the client can be received.

[0069] In order to improve the accuracy and efficiency of determining the audit status, in the code submission method provided in Example 1 of the present application, the first audit identifier is added to a preset audit list, wherein the preset audit list is used to record the audit status corresponding to each audit identifier; according to the audit result corresponding to the first audit identifier returned by the code audit system, the audit status corresponding to the first audit identifier is updated.

[0070] In an embodiment of the present invention, the first audit identifier can be added to a preset audit list, which is used to record the audit identifiers corresponding to the code file and the branch to be submitted, as well as the audit status of each audit identifier (audit passed or audit failed), and the audit status corresponding to the first audit identifier can be updated according to the audit result corresponding to the first audit identifier returned by the code audit system. Afterwards, a scheduled task can be established to query the preset audit list at preset time intervals (such as one minute). If the audit status of the first audit identifier changes to audit passed, it indicates that the code file has been audited and passed, and the subsequent submission process can be carried out, and the audit identifier is removed from the preset audit list.

[0071] Optionally, when the code review system changes the review status corresponding to any review identifier to a review pass status, the code review system may send the review identifier and its corresponding review pass status to a preset submission tool so that the preset submission tool can directly proceed with the subsequent code submission process.

[0072] In order to improve the accuracy of determining the modified difference file, in the code submission method provided in Example 1 of the present application, after the audit status corresponding to the first audit identifier is updated, when it is detected that the audit status corresponding to the first audit identifier is a failed audit status, the audit result information corresponding to the first audit identifier is obtained from the code audit system; based on the audit result information, the target code file is adjusted, and based on the adjusted target code file, the modified difference file is re-determined.

[0073] In an embodiment of the present invention, if the audit status corresponding to the first audit identifier is an audit failure status, the preset submission tool can obtain the audit result information corresponding to the first audit identifier from the code audit system under the failed status (including the code location and reason of the audit failure, etc.), and then display the audit result information to the developer's terminal, and receive the corresponding audit result information readjusted by the terminal according to the audit result information; adjust the target code file based on the audit result information, and then re-determine the modified difference file according to the adjusted target code file. In this way, there is no need to reselect the file to be submitted, and only the adjusted target code file needs to be replaced with the original code file, which can reduce the step of selecting the code file again and ensure the normal completion of the submission process.

[0074] Figure 2 is a schematic diagram of an optional multi-branch code submission process according to the related art, such as Figure 2 As shown in the figure, for branch 1, you need to first select the file to be submitted, initiate the review process, generate a review id, then fill in the modification root cause and modification plan in the review system, and then manually query the review system. After the review is passed, start submitting the code, then manually select the code to be submitted in svn, write the submission information, including the review id modification root cause, modification plan, submitter, branch information, etc., and then submit the code. For other branches, continue to repeat the above submission process until the submission process of branch n (the last branch to be submitted) is completed.

[0075] Figure 3 FIG. 1 is a schematic diagram of an optional multi-branch code submission process using a preset submission tool according to an embodiment of the present invention. Figure 3As shown, select the file to be submitted, initiate the review process, generate the review id, and then fill in the root cause of the modification and the modification plan in the review system. In addition, after initiating the review process and generating the review id, the tool will record the code difference and review id, and determine whether there is a branch that needs to be submitted synchronously. If not, directly query the review status of the review id regularly, obtain the root cause of the modification and the modification plan from the review system, assemble the submission information, and then obtain the code difference, and submit it to the code repository together with the submission information. If it exists, use svn patch to synchronize to the branch to be submitted, generate a review id for each branch, and synchronize the review information to other review ids, and then query the review status of the review id regularly, obtain the root cause of the modification and the modification plan from the review system, assemble the submission information, and then obtain the code difference, and submit it to the code repository together with the submission information.

[0076] from Figure 2 and Figure 3 It can be seen that by using the preset submission tool in this embodiment, the code can be synchronized to multiple branches with one click, reducing the process of manually synchronizing the code to multiple branches and turning the code synchronization into an automated process. In addition, the tool supports synchronizing the review information to all other branches to be submitted, avoiding the process of manually filling in the review information for each branch.

[0077] Figure 4 is a schematic diagram of an optional automatic code file submission process according to an embodiment of the present invention, such as Figure 4 As shown, the following process is included:

[0078] (1) When initiating the code review process, the diff command provided by the local code management tool, such as svn diff, is called through the code to obtain the difference information of the file to be submitted (i.e., svn diff information), record the svn diff information, review id, and branch information, and add the review id to the list of review ids to be queried.

[0079] (2) Create a scheduled task to periodically query the status of the review id. If the status of the review id changes to "review completed", remove it from the list of review ids to be queried.

[0080] (3) Use the review ID to query the review information, modification reasons, modification plans, etc., and assemble the submission information. Then query the stored difference information of the files to be submitted, and automatically submit the difference information and submission information.

[0081] (4) Determine whether there is branch synchronization. If not, the process is completed. If you need to submit multiple branches at the same time or the subsequent code needs to be synchronized to other branches, you need to select the branch to be submitted and the review id of the submitted code (supports selecting multiple branches to be submitted at one time), click one-click synchronization, and batch synchronize the code to other branches based on the SVN DIFF information of the review id. Then, initiate the review process of other branches, synchronize the review information to the newly generated review id, continue to add the review id to the list of review ids to be queried, and proceed with the subsequent process.

[0082] In the embodiment of the present invention, the tool for integrating multi-version code review, synchronization and submission is applicable to systems with multiple branches that need to be maintained at the same time. It can automatically complete code synchronization and review information synchronization, improve efficiency, and reduce errors caused by manual operations. It is also applicable to scenarios where code review is required before code submission, and can optimize the review process and improve review efficiency.

[0083] In an embodiment of the present invention, the function of synchronizing code to multiple branches with one click can be realized, which not only reduces the workload, but also avoids missed submissions or other errors that may occur during manual participation. Moreover, it can solve the process of manually applying for review in each branch when submitting in multiple branches, and then manually synchronizing the review information, effectively reducing the workload. In addition, it also solves the problem of needing to select files to be submitted multiple times in the review system and the code submission system, and supports the process of synchronizing the review information in the review system to other branches, which can reduce manual copying operations, and supports automatic acquisition of review id status and submission of code, thereby making the submission process more automated, without the need for human waiting or intervention.

[0084] The following is a detailed description in conjunction with another embodiment.

[0085] Embodiment 2

[0086] A code submission device provided in this embodiment includes multiple implementation units, each of which corresponds to each implementation step in the above-mentioned embodiment 1.

[0087] Figure 5 is a schematic diagram of an optional code submission device according to an embodiment of the present invention. Figure 5 As shown, the submitting device may include: a first sending unit 50, a first obtaining unit 51, a second obtaining unit 52, and a first submitting unit 53.

[0088] The first sending unit 50 is used to send a first review request to the code review system in response to the code submission operation for the first branch, wherein the first review request includes branch information of the first branch and the target code file to be submitted;

[0089] A first acquisition unit 51 is used to acquire a modified difference file corresponding to the first audit identifier generated by the code audit system for the first branch based on the first audit request, wherein the modified difference file is used to record difference information generated by modifying the original code file corresponding to the target code file to the target code file;

[0090] The second acquisition unit 52 is used to acquire the code modification description information corresponding to the first audit identifier when the audit result corresponding to the first audit identifier returned by the code audit system is passed, and generate the submission information of the first branch based on the code modification description information, the first audit identifier and the branch information of the first branch;

[0091] The first submitting unit 53 is used to submit at least one of the modified difference file and the target code file, and the submission information of the first branch to the first branch in the code repository.

[0092] The above-mentioned submission device, through the review identifier, the client can connect to the code review system during the code submission process, and can automatically obtain the code file review status through the client, and automatically obtain the corresponding code modification description information after the review is passed to generate submission information, and then submit the determined modification difference file and submission information to the corresponding branch in the code repository, which can avoid redundant manual operations, realize the automation process of code file submission, improve the accuracy of code file submission, and achieve the technical effect of efficiently submitting code files, thereby solving the technical problem in the related technology that redundant manual operations exist when submitting code files, resulting in low submission efficiency.

[0093] Optionally, the submission device also includes: a second sending unit, used to send a second review request to the code review system in response to a code synchronization operation on the first branch and at least one second branch, wherein the second review request includes branch information of each second branch, a modified difference file, and code modification description information corresponding to the first review identifier; a third acquisition unit, used to obtain the second review identifier generated by the code review system for each second branch according to the second review request and the review result corresponding to each second review identifier; a first generation unit, used to generate submission information of the second branch for each second branch whose review result is passed according to the code modification description information corresponding to the first review identifier, the second review identifier corresponding to the second branch, and the branch information of the second branch; a second submission unit, used to submit at least one of the modified difference file and the target code file, and the submission information of each second branch to each second branch in the code repository.

[0094] Optionally, the first acquisition unit includes: a first acquisition module, used to obtain the original code file corresponding to the target code file from the code repository; a first generation module, used to call a preset command provided by a local code management tool to generate the difference content of the target code file compared to the original code file, and obtain a modified difference file corresponding to the first review identifier.

[0095] Optionally, the submission device also includes: a first creation unit, used to create a scheduled task corresponding to the first audit identifier; wherein the scheduled task is used to periodically query the audit result corresponding to the first audit identifier from the code review system; and a first receiving unit, used to receive the audit result corresponding to the first audit identifier returned by the code review system.

[0096] Optionally, the second acquisition unit includes: a second acquisition module, used to obtain code modification description information entered by the user for the first review identifier from the code review system; a first receiving module, used to receive code modification description information entered by the user for the first review identifier on the interactive interface of the client; wherein the code modification description information includes at least: modification factor information and modification description information.

[0097] Optionally, the submission device also includes: a first adding unit, used to add the first review identifier to a preset review list, wherein the preset review list is used to record the review status corresponding to each review identifier; a first updating unit, used to update the review status corresponding to the first review identifier according to the review result corresponding to the first review identifier returned by the code review system.

[0098] Optionally, the submission device also includes: a fourth acquisition unit, which is used to obtain the audit result information corresponding to the first audit identifier from the code audit system after the audit status corresponding to the first audit identifier is updated, when it is detected that the audit status corresponding to the first audit identifier is a failed audit status; a first adjustment unit, which is used to adjust the target code file based on the audit result information, and re-determine the modified difference file based on the adjusted target code file.

[0099] The above-mentioned submission device may also include a processor and a memory. The above-mentioned first sending unit 50, first acquisition unit 51, second acquisition unit 52, first submission unit 53, etc. are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.

[0100] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set to submit at least one of the modified difference file and the target code file and the submission information of the first branch to the first branch in the code repository by adjusting kernel parameters.

[0101] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash memory (fl ash RAM), and the memory includes at least one storage chip.

[0102] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above code submission methods is implemented.

[0103] When the computer program product is executed on a data processing device, it is suitable for executing a program initialized with the following method steps: in response to a code submission operation for a first branch, sending a first review request to a code review system, obtaining a modified difference file corresponding to the first review identifier according to a first review identifier generated by the code review system for the first branch based on the first review request, and when the review result corresponding to the first review identifier returned by the code review system is passed, obtaining code modification description information corresponding to the first review identifier, and generating submission information of the first branch based on the code modification description information, the first review identifier and the branch information of the first branch, and submitting at least one of the modified difference file and the target code file and the submission information of the first branch to the first branch in the code repository.

[0104] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement the above-mentioned code submission method.

[0105] Figure 6 1 is a hardware structure block diagram of an electronic device for a code submission method according to an embodiment of the present invention. Figure 6 As shown, the electronic device may include one or more processors (e.g., Figure 6 The processor 602a, processor 602b, ..., processor 602n, etc., which may include but are not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 604 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 6 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 6 More or fewer components as shown, or with Figure 6 Different configurations are shown.

[0106] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0107] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.

[0108] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0109] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0110] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0111] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0112] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0113] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A code submission method, characterized in that: Applied to the client, including: In response to a code submission operation for the first branch, sending a first review request to a code review system, wherein the first review request includes branch information of the first branch and a target code file to be submitted; According to the first audit identifier generated by the code audit system for the first branch based on the first audit request, obtaining a modified difference file corresponding to the first audit identifier, wherein the modified difference file is used to record difference information generated by modifying an original code file corresponding to the target code file to the target code file; When the audit result corresponding to the first audit identifier returned by the code audit system is passed, obtaining code modification description information corresponding to the first audit identifier, and generating submission information of the first branch based on the code modification description information, the first audit identifier, and branch information of the first branch; Submit at least one of the modified difference file and the target code file, and the submission information of the first branch to the first branch in the code repository.

2. The submission method according to claim 1, characterized in that: The submitting method further comprises: In response to the code synchronization operation on the first branch and at least one second branch, sending a second audit request to the code audit system, wherein the second audit request includes branch information of each second branch, the modification difference file, and code modification description information corresponding to the first audit identifier; Obtaining the second audit identifiers generated by the code audit system for each of the second branches according to the second audit request and the audit results corresponding to each of the second audit identifiers; For each second branch whose audit result is passed, generating submission information of the second branch according to the code modification description information corresponding to the first audit identifier, the second audit identifier corresponding to the second branch, and the branch information of the second branch; Submit at least one of the modified difference file and the target code file, and the submission information of each second branch to each second branch in the code repository respectively.

3. The submission method according to claim 2, characterized in that: Obtaining a modified difference file corresponding to the first audit identifier includes: Acquire the original code file corresponding to the target code file from the code repository; A preset command provided by a local code management tool is called to generate difference contents between the target code file and the original code file, and obtain a modified difference file corresponding to the first audit identifier.

4. The submission method according to claim 1, characterized in that: The submitting method further comprises: Creating a scheduled task corresponding to the first audit identifier; wherein the scheduled task is used to query the audit result corresponding to the first audit identifier from the code audit system at a regular interval; Alternatively, receive the audit result corresponding to the first audit identifier returned by the code audit system.

5. The submission method according to claim 1, characterized in that: Obtaining code modification description information corresponding to the first review identifier includes: Acquire, from the code review system, code modification description information input by the user for the first review identifier; Alternatively, code modification description information input by a user on an interactive interface of the client for the first audit identifier is received; wherein the code modification description information at least includes modification factor information and modification description information.

6. The submission method according to any one of claims 1 to 5, characterized in that: The submitting method further comprises: Adding the first audit identifier to a preset audit list, wherein the preset audit list is used to record the audit status corresponding to each audit identifier; The audit status corresponding to the first audit identifier is updated according to the audit result corresponding to the first audit identifier returned by the code audit system.

7. The submission method according to claim 6, characterized in that: After updating the audit status corresponding to the first audit identifier, the method further includes: When it is detected that the audit status corresponding to the first audit identifier is an audit failure status, obtaining audit result information corresponding to the first audit identifier from the code audit system; Based on the audit result information, the target code file is adjusted, and based on the adjusted target code file, the modified difference file is re-determined.

8. A code submission device, characterized in that: Applied to the client, including: A first sending unit, configured to send a first review request to a code review system in response to a code submission operation for a first branch, wherein the first review request includes branch information of the first branch and a target code file to be submitted; A first acquisition unit is used to acquire, according to a first audit identifier generated by the code audit system for the first branch based on the first audit request, a modified difference file corresponding to the first audit identifier, wherein the modified difference file is used to record difference information generated by modifying an original code file corresponding to the target code file to the target code file; a second acquisition unit, configured to acquire, when the audit result corresponding to the first audit identifier returned by the code audit system is passed, code modification description information corresponding to the first audit identifier, and generate submission information of the first branch based on the code modification description information, the first audit identifier, and branch information of the first branch; The first submission unit is used to submit at least one of the modified difference file and the target code file, and the submission information of the first branch to the first branch in the code repository.

9. A computer program product, characterized in that The invention comprises a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the code submission method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: The invention comprises one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the code submission method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Code management control method and system

    CN107463371A

  • Code auditing method, device and system and computer readable storage medium

    CN113741963A

  • Development management method and platform and storage medium

    CN113867691A