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

By interacting with the code review system on the client side and automatically obtaining and generating submission information using review identifiers, the inefficiency caused by redundant operations during code submission is solved, achieving efficient and accurate code file submission.

CN119806616BActive Publication Date: 2025-12-12HILLSTONE NETWORKS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing technologies, code submission involves redundant manual operations, resulting in low submission efficiency and issues such as selection errors and inconsistencies in information.

Method used

By interacting with the code review system on the client side, the system automatically obtains the modified difference files and code modification descriptions using review identifiers, generates commit information, and automatically submits it to the code repository, reducing manual operations.

Benefits of technology

It automates the code file submission process, improving the accuracy and efficiency of submissions and avoiding errors caused by redundant operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806616B_ABST
    Figure CN119806616B_ABST
Patent Text Reader

Abstract

The application discloses a code submission method and device, electronic equipment and computer program product, and relates to the technical field of computers.The method comprises the following steps: in response to a code submission operation of a first branch, a first audit request is sent to a code audit system; a modification difference file of a first audit identifier is obtained according to the first audit identifier generated by the code audit system based on the first audit request; after the audit result of the first audit identifier returned by the code audit system is passed, code modification description information of the first audit identifier is obtained; and based on the code modification description information, the first audit identifier and branch information of the first branch, submission information of the first branch is generated; and at least one of the modification difference file and a target code file and the submission information of the first branch are submitted to the first branch in a code repository.The application solves the technical problem that redundant manual operation exists when a code file is submitted in the related art, resulting in low submission efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular, to a code submission method and device, electronic equipment and computer program product. BACKGROUND

[0002] A centralized version control system, such as Subversion (SVN), is a widely used version control tool for storing and managing code repositories on a central server. When submitting code changes using SVN, developers need to fill in submission information, which includes descriptions of changes made and related background information, providing a way for other team members to quickly backtrack and review change history.

[0003] Currently, in order to further improve code quality and reduce potential error introduction, a code review system is introduced before each code submission. Therefore, the current code submission process usually includes the following processes: (1) selecting files to be submitted; (2) submitting files to the code review system; (3) filling in modification root cause and modification scheme; (4) waiting for approval to be completed; (5) selecting files to be submitted again; (6) filling in SVN submission information (including modification root cause and modification scheme); (7) submitting code to the code repository.

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

[0005] In view of the above problems, no effective solution has been proposed so far. SUMMARY

[0006] The embodiments of the present application provide a code submission method and device, electronic equipment and computer program product, to at least solve the technical problem of redundant manual operation when submitting code files in related technologies, resulting in low submission efficiency.

[0007] According to an aspect of some embodiments of the present application, a code submission method applied to a client is provided, including: in response to a code submission operation for a first branch, sending a first audit request to a code audit system, wherein the first audit request includes branch information of the first branch and a target code file to be submitted; obtaining a modification difference file corresponding to a first audit identifier generated by the code audit system for the first branch according to the first audit identifier, wherein the modification difference file is used to record difference information generated from modification of an original code file corresponding to the target code file to the target code file; in a case where an 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 the 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 a code repository.

[0008] Further, the submission method further includes: in response to a code synchronization operation for 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 of the second branches, the modification difference file and code modification description information corresponding to the first audit identifier; obtaining a second audit identifier generated by the code audit system for each of the second branches according to the second audit request and an audit result corresponding to each of the second audit identifiers; for each of the second branches with a passed audit result, 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; and submitting at least one of the modification difference file and the target code file and the submission information of each of the second branches to each of the second branches in the code repository.

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

[0010] Further, the submission method further includes: creating a timing task corresponding to the first audit identifier; wherein the timing task is used to query the audit result corresponding to the first audit identifier from the code audit system at a timing; or receiving the audit result corresponding to the first audit identifier returned by the code audit system.

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

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

[0013] Further, after updating the audit state corresponding to the first audit identifier, it further includes: in the case that the audit state corresponding to the first audit identifier is detected as an audit failure state, obtaining the audit result information corresponding to the first audit identifier from the code audit system; adjusting the target code file based on the audit result information, and re-determining the modification difference file based on the adjusted target code file.

[0014] According to another aspect of the embodiment of the application, a code submission device applied to a client is further provided, including: a first sending unit configured to send a first audit request to a code audit system in response to a code submission operation for a first branch, wherein the first audit request includes branch information of the first branch and a target code file to be submitted; a first obtaining unit configured to obtain a modification difference file corresponding to a first audit identifier generated by the code audit system for the first branch based on the first audit request, wherein the modification difference file is used to record difference information generated from modification of an original code file corresponding to the target code file to the target code file; a second obtaining unit configured to obtain code modification description information corresponding to the first audit identifier in the case that an audit result corresponding to the first audit identifier returned by the code audit system is passed, and generate 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; and a first submission unit configured to submit 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 a code repository.

[0015] Further, the submitting apparatus further comprises: a second sending unit, configured to send a second audit request to the code audit system in response to the code synchronization operation on the first branch and at least one second branch, wherein the second audit request comprises branch information of each second branch, the modification difference file and code modification description information corresponding to the first audit identifier; a third obtaining unit, configured to obtain second audit identifiers respectively generated by the code audit system for each second branch according to the second audit request and audit results corresponding to each second audit identifier; a first generating unit, configured to, for each second branch with a passed audit result, generate 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; and a second submitting unit, configured to submit at least one of the modification difference file and the target code file and the submission information of each second branch to each second branch in the code repository.

[0016] Further, the first obtaining unit comprises: a first obtaining module, configured to obtain the original code file corresponding to the target code file from the code repository; and a first generating module, configured to invoke a preset command provided by a local code management tool to generate difference content of the target code file compared with the original code file, so as to obtain the modification difference file corresponding to the first audit identifier.

[0017] Further, the submitting apparatus further comprises: a first creating unit, configured to create a timing task corresponding to the first audit identifier; wherein the timing task is configured to query the audit result corresponding to the first audit identifier from the code audit system at a timing; and a first receiving unit, configured to receive the audit result corresponding to the first audit identifier returned by the code audit system.

[0018] Further, the second obtaining unit comprises: a second obtaining module, configured to obtain code modification description information input by a user for the first audit identifier from the code audit system; and a first receiving module, configured to receive code modification description information input by the user on an interactive interface of the client for the first audit identifier; wherein the code modification description information at least comprises modification factor information and modification description information.

[0019] Further, the submitting apparatus further comprises: a first adding unit, configured to add the first audit identifier to a preset audit list, wherein the preset audit list is configured to record an audit state corresponding to each audit identifier; and a first updating unit, configured to update the audit state corresponding to the first audit identifier according to the audit result corresponding to the first audit identifier returned by the code audit system.

[0020] Further, the submitting apparatus further comprises: a fourth obtaining unit, configured to, after the first audit identifier corresponding audit state is updated, if it is detected that the first audit identifier corresponding audit state is an audit failure state, obtain the first audit identifier corresponding audit result information from the code audit system; and a first adjusting unit, configured to, based on the audit result information, adjust the target code file, and based on the adjusted target code file, re-determine the modification difference file.

[0021] According to another aspect of the embodiments of the present application, a computer program product is also provided, comprising a non-volatile computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the code submitting method in any of the above aspects.

[0022] According to another aspect of the embodiments of the present application, an electronic device is also provided, comprising one or more processors and a memory, the memory is configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the code submitting method in any of the above aspects.

[0023] In the present application, in response to a code submitting operation for a first branch, a first audit request is sent to a code audit system, a modification difference file corresponding to a first audit identifier generated by the code audit system based on the first audit request for the first branch is obtained, in a case where an 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 is obtained, and based on the code modification description information, the first audit identifier and branch information of the first branch, submitting information of the first branch is generated, at least one of the modification difference file and the target code file, and the submitting information of the first branch are submitted to the first branch in the code repository, thereby solving the technical problem that there is redundant manual operation in the related art when submitting a code file, resulting in low submission efficiency.

[0024] In the present application, through the audit identifier, the client can connect the code audit system in the code submitting process, and the code file audit state can be automatically obtained through the client, and the corresponding code modification description information is automatically obtained after the audit is passed, to generate submitting information, and then the determined modification difference file and the submitting information are submitted to the corresponding branch in the code repository, which can avoid redundant manual operation, realize the automatic process of the code file submission, improve the accuracy of the code file submission, and further achieve the technical effect of efficiently submitting the code file. BRIEF DESCRIPTION OF DRAWINGS

[0025] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

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

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

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

[0029] Figure 4 is a schematic diagram of an optional automated code file submission flow according to an embodiment of the application;

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

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

[0032] In order to make the personnel in the art better understand the application scheme, the technical scheme in the embodiments of the application will be described clearly and completely below in conjunction with the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor should belong to the protection scope of the application.

[0033] It should be noted that the terms "first", "second", and the like in the specification and claims of the application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.

[0034] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) collected and related to the present application are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards in the relevant region, necessary security measures are taken, do not violate public order and good customs, and provide corresponding operation portal for user selection authorization or refusal. For example, the system and the related user or institution are provided with an interface, and before obtaining the relevant information, the interface needs to send a request to the aforementioned user or institution, and after receiving the consent information feedback from the aforementioned user or institution, the relevant information is obtained.

[0035] The present application constructs a client which can be used as a tool for integrating multi-version code review, synchronization and submission, through which redundant operations in the code review and code submission process can be avoided, the personnel operation steps in the code submission process are effectively reduced, and the error submission caused by human error in selecting or selecting files is avoided, thereby improving the efficiency of code submission and review, and realizing a more efficient and automated code file submission process.

[0036] In the present application, the first submission process of the code file can be copied to other branches for synchronization, and the review information required by the code review system can be synchronized to all other branches at one key, thereby improving the efficiency of code submission and synchronization.

[0037] The present application will be described in detail below in conjunction with various embodiments.

[0038] Embodiment one

[0039] According to the embodiment of the present application, 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 the 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 application, as shown in Figure 1 The method comprises the following steps:

[0041] Step S101, in response to a code submission operation for a first branch, a first review request is sent to a code review system, wherein the first review request comprises branch information of the first branch and target code files 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 modified code version) and the branch (i.e., the first branch) to which the code file needs to be submitted can be determined first. Then, the code submission operation of the first branch can be initiated on the client, and for the code submission operation of the first branch, the client sends a first audit request to the code audit system, which includes the branch information (including the branch identifier and the like) of the first branch and the target code file to be submitted.

[0043] Optionally, the selected code file can be submitted to the code audit system on the client by using a preset submission tool. The preset submission tool is a tool that is pre-built to integrate multi-version code auditing, synchronization and submission, and can realize automatic code auditing, code submission and multi-branch code synchronization process, thereby improving the efficiency of code submission and synchronization.

[0044] In step S102, the modification difference file corresponding to the first audit identifier generated by the code audit system based on the first audit request is obtained according to the first audit identifier, wherein the modification difference file is used to record the difference information generated from the modification of the original code file corresponding to the target code file to the target code file.

[0045] In the embodiment of the application, after the code file is submitted to the code audit system (i.e., after the first audit request is sent to the code audit system), the code audit system generates a unique review id (i.e., the first audit identifier) corresponding to the target code file to be submitted and the branch to be submitted (i.e., the first branch). In this way, the audit process and the code submission process of the code file in the code audit system can be connected through the unique audit identifier in the subsequent process.

[0046] In an optional embodiment, the code audit system initiates an audit requirement request to the preset submission tool after receiving the target code file, and generates the first audit identifier based on the audit information returned by the preset submission tool based on the audit requirement request. That is, the code audit system can initiate an audit requirement request (which can carry audit requirement information such as the current code version number, modification summary and the like) to the preset submission tool after receiving the target code file. Then the preset submission tool can display the audit requirement information to the terminal of the developer and receive the audit information returned by the terminal (i.e., the audit information filled in by the terminal according to the audit requirement information). Then the code audit system generates the first audit identifier according to the returned audit information.

[0047] In the embodiment of the application, the review id generated by the code audit system can be recorded by using the preset submission tool.

[0048] In the embodiment of the present application, the modified difference file corresponding to the first review identifier can be obtained according to the first review identifier generated by the code review system based on the first review request. For example, the modified difference file corresponding to the first review identifier can be obtained by comparing 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) using a preset submission tool, and the modified difference file is recorded by using the preset submission tool. Thus, when the target code file is synchronized to other branches subsequently, the modified difference file can be directly used without being re-generated, thereby improving the synchronization efficiency.

[0049] Optionally, the preset submission tool can record the difference content of the to-be-submitted file by calling a diff command (i.e., a comparison command) provided by a local code management tool (such as SVN), such as svn diff, to obtain the modified difference file, and the branch and the generated review id are also recorded and stored in the local preset submission tool.

[0050] In the embodiment of the present application, after the code file is submitted to the code review system, the code review system can review the code file to determine whether the modification of the code file is in accordance with the specification, whether the modified code is readable and compilable, and whether there is security, and thus the review result is given.

[0051] In step S103, when the review result corresponding to the first review identifier returned by the code review system is passed, the code modification description information corresponding to the first review identifier is obtained, and the submission information of the first branch is generated 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 process of submitting the code is triggered, the code modification description information (including the code modification reason and the specific description of the code modification) corresponding to the first review identifier can be queried from the code review system, and then the queried code modification description information, the submit terminal identifier, the review id (i.e., the first review identifier) and the branch information of the first branch are combined to assemble the submission information of the SVN code (i.e., the submission information of the first branch) conforming to the standard.

[0053] In the embodiment of the present application, the code modification description information is the relevant information required in the process of reviewing the code file by the code review system, and can be input through the terminal of the developer.

[0054] At step S104, at least one of the modified difference file and the target code file and the commit information of the first branch are submitted to the first branch in the code repository.

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

[0056] In summary, through the audit identifier, the client can connect the code audit system during the code submission process, and automatically obtain the code file audit state through the client, and automatically obtain the corresponding code modification description information after the audit passes, to generate the commit information, and then submit the determined modified difference file and the commit information to the corresponding branch in the code repository, which can avoid redundant manual operation, realize the automatic process of code file submission, improve the accuracy of code file submission, achieve the technical effect of efficiently submitting the code file, and further solve the technical problem that redundant manual operation exists when submitting the code file in the related art, which leads to low submission efficiency.

[0057] In order to efficiently synchronize the code file to other branches, in the code submission method provided in Embodiment One of the present application, in response to the code synchronization operation for the first branch and at least one second branch, a second audit request is sent to the code audit system, wherein the second audit request includes the branch information of each second branch, the modified difference file and the code modification description information corresponding to the first audit identifier; the second audit identifier generated by the code audit system for each second branch according to the second audit request and the audit result corresponding to each second audit identifier are obtained; for each second branch with a passed audit result, the commit information of the second branch is generated 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; and at least one of the modified difference file and the target code file and the commit information of each second branch are submitted to each second branch in the code repository.

[0058] In the embodiment of the present application, if the target code file needs to be submitted to other branches, since the preset submission tool has recorded the modification difference file and the review id (i.e., the first audit identifier) in the process of submitting the target code file to the branch to be submitted, at this time, only the other branches (i.e., the second branches) to be submitted need to be selected, and the tool will automatically synchronize the modification difference file corresponding to the code file to the other branches to be submitted by calling the synchronization command (i.e., the preset synchronization command such as svn patch) provided by the code management tool (such as SVN). Moreover, the tool can automatically initiate an audit process for each other branch, and automatically backfill the audit information (i.e., the information used by the code audit system when auditing the target code file, such as code version number, code modification summary, etc.) corresponding to the first audit identifier into the review id (the second audit identifier) corresponding to the new other branch. After that, if it is detected that the target code file is audited in the other branches, the target code file can be synchronized to the other branches according to the modification difference file synchronized in the other branches (for example, a patch package corresponding to the modification difference file can be generated by using the svn patch command, and the patch package is applied to the other branches to be submitted, so that the difference is successfully synchronized to the other branches to be submitted). In this way, the audit process of the target code file when synchronized to the other branches can be completed without repeating the audit information, thereby improving the synchronization efficiency.

[0059] In some embodiments, when the target code file needs to be submitted to at least one second branch, the client initiates a code synchronization operation of the first branch and the at least one second branch, and then the preset submission tool sends a second audit request (including the branch information of each second branch, the modification difference file, and the code modification description information corresponding to the first audit identifier) to the code audit system on the client for the code synchronization operation of the first branch and the at least one second branch. After that, the second audit identifier generated by the code audit system for each second branch according to the second audit request and the audit result corresponding to each second audit identifier are obtained, and then for each second branch with a passed audit result, the submission information of the second branch is generated 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. Finally, at least one of the modification difference file and the target code file, and the submission information of each second branch are submitted to each second branch in the code repository, so as to complete the synchronization of the target code file to the second branch.

[0060] In the embodiment of the present application, before the target code file is synchronized to the second branch, the code file needs to be audited by the code auditing system, and the code auditing system needs to generate a corresponding second audit identifier for the target code file synchronized to each second branch. Then, the second audit identifier corresponding to the target code file and the second branch is obtained from the code auditing system by using the preset submission tool. The code modification description information corresponding to the first audit identifier is queried by using the preset submission tool, and the code modification description information is associated with the second audit identifier. In this way, the difference information extraction between different code versions can be reduced. Then, the second submission information can be generated according to the code modification description information associated with the second audit identifier, in combination with the second audit identifier and the second branch. After that, the modified difference file and the second submission information are submitted to the second branch in the code repository, so as to complete 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 is improved.

[0061] In the embodiment of the present application, 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 audit identifier, in the code submission method provided in Embodiment One of the present application, the original code file corresponding to the target code file is obtained from the code repository; a preset command provided by a local code management tool is called to generate the difference content of the target code file compared with the original code file, and the modified difference file corresponding to the first audit identifier is obtained.

[0063] In the embodiment of the present application, 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 generate the difference content of the target code file compared with the original code file by calling the diff command (i.e., the preset command) provided by the local code management tool (such as SVN), such as svn diff, to obtain the modified difference file corresponding to the first audit identifier.

[0064] In the code submission method provided in Embodiment One of the present application, a timing task corresponding to the first audit identifier is created; wherein the timing task is used to query the audit result corresponding to the first audit identifier from the code auditing system at a timing; or, the audit result corresponding to the first audit identifier returned by the code auditing system is received.

[0065] In the embodiment of the present application, the timing 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 auditing system at a timing. In addition, the code auditing system can also return the audit result of the audit identifier corresponding to the code file to the client after the code file is audited.

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

[0067] In the embodiments of the present application, after the code audit system generates the first audit identifier, the code audit system can initiate a code audit request to the preset submission tool. Then the preset submission tool can record the first audit identifier, and show the information required by the code audit request to the terminal of the developer, and then receive the code modification description information filled by the terminal according to the information required by the code audit request, including the modification factor information and the modification description information, associate the first audit identifier with the code modification description information, and send it to the code audit system, so that the code audit system audits the target code file according to the code modification description information.

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

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

[0070] In the embodiments of the present application, the first audit identifier can be added to the preset audit list, the preset audit list is used to record the audit identifier corresponding to the code file and the branch to be submitted by the code file, and the audit state (audit passed or audit failed) of each audit identifier, and the audit state corresponding to the first audit identifier can be updated according to the audit result returned by the code audit system. Then a timing task can be established, and the preset audit list is queried every preset time interval (such as one minute), if the audit state of the first audit identifier changes to audit passed, it means that the code file has passed the audit, and the subsequent submission process can be performed, and the audit identifier is removed from the preset audit list.

[0071] Optionally, when the code review system changes the corresponding review state of any review identifier to a review passed state, the code review system can send the review identifier and its corresponding review passed state to the preset submission tool, so that the preset submission tool directly performs a subsequent code submission process.

[0072] To improve the accuracy of determining the modified difference file, in the code submission method provided in Embodiment One of the present application, after updating the review state corresponding to the first review identifier, if it is detected that the review state corresponding to the first review identifier is a review failed state, the review result information corresponding to the first review identifier is obtained from the code review system; based on the review 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 the embodiment of the present application, if the review state corresponding to the first review identifier is a review failed state, the preset submission tool can obtain the review result information (including the code location, reason, etc. of the review failed) corresponding to the first review identifier from the code review system in the case of a failed state, and then can display the review result information to the terminal of the developer, and receive the corresponding review result information re-adjusted by the terminal according to the review result information; based on the review result information, the target code file is adjusted, and then the modified difference file is re-determined according to the adjusted target code file. In this way, without reselecting the file to be submitted, only the original code file is replaced by the adjusted target code file, which can reduce the step of reselecting the code file and ensure the normal completion of the submission process.

[0074] Figure 2 is a schematic diagram of an optional multi-branch code submission process in the related art, as shown in Figure 2 For branch 1, the file to be submitted needs to be selected first, the review process is initiated, the review id is generated, then the modification root cause and modification scheme are filled in the review system, and the review system is manually queried, after the review is passed, the code is submitted, then the code to be submitted is manually selected in the svn, the submission information is written, including the review id modification root cause, modification scheme, submitter, branch information, etc., and then the code is submitted. For other branches, the above submission process is repeated until the submission process of branch n (i.e. the last branch to be submitted) is completed.

[0075] 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 application, as shown in Figure 3As shown, the file to be submitted is selected, the review process is initiated, the review id is generated, and the modification reason and modification scheme are filled in the review system. After the review process is initiated and the review id is generated, the tool records the code difference and the review id, and determines whether there is a branch to be synchronized for submission. If not, the review id is directly queried for the review state, the modification reason and modification scheme are obtained from the review system, the submission information is assembled, the code difference is obtained, and the submission information is submitted to the code repository. If so, the code is synchronized to the branch to be submitted using the svn patch, a review id is generated for each branch, and the review information is synchronized to other review ids. Then, the review id is queried for the review state, the modification reason and modification scheme are obtained from the review system, the submission information is assembled, the code difference is obtained, and the submission information is submitted to the code repository.

[0076] From Figure 2 and Figure 3 It can be seen that using the preset submission tool in the embodiment, the code can be synchronized to multiple branches with one key, reducing the process of manually synchronizing the code to multiple branches, and making the code synchronization an automated process. Moreover, 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 automated code file submission process according to an embodiment of the application, as Figure 4 shown, including the following processes:

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

[0079] (2) A timing task is established to query the status of the review id at regular intervals. If the status of the review id changes to completed, it is removed from the list of review ids to be queried.

[0080] (3) The review information, modification reason, modification scheme, etc. are queried through the review id, and the submission information is assembled. Then, the stored difference information of the file to be submitted is queried, and the difference information and the submission information are automatically submitted.

[0081] (4)Judge whether there is a branch synchronization, if not, the process is completed. If multiple branches need to be submitted at the same time or the subsequent code needs to be synchronized to other branches, the branch to be submitted and the review id of the submitted code are selected (supporting selecting multiple branches to be submitted at the same time), and one-key synchronization is clicked to complete the synchronization of the code to other branches according to the svn diff information of the review id. Then, the review process of other branches is initiated, and the review information is synchronized to the newly generated review id, and the review id is added to the to-be-inquired review id list, and the subsequent process is continued.

[0082] In the embodiment of the application, the tool for integrating multi-version code review, synchronization and submission is suitable for a system that needs to maintain multiple branches at the same time, can automatically complete code synchronization and review information synchronization, improves efficiency, and reduces errors caused by manual operation. It is also suitable for a scene that needs code review before code submission, can optimize the review process and improve the review efficiency.

[0083] In the embodiment of the application, the function of one-key synchronization of the code to multiple branches can be realized, which reduces the workload and avoids the possible omission or other errors in the manual participation process. Moreover, the process of manually applying for review and manually synchronizing the review information for each branch when submitting in multiple branches can be solved, thereby effectively reducing the workload. In addition, the problem of multiple selections of to-be-submitted files in the review system and the code submission system is solved, the process of synchronizing the review information in the review system to other branches is supported, manual copy operations are reduced, and the automatic acquisition of the review id state and the submission of the code are supported, so that the submission process is more automated, and human waiting or intervention is not needed, thereby achieving the technical effects.

[0084] The following will be described in detail in combination with another embodiment.

[0085] Embodiment Two

[0086] The code submission device provided in the embodiment includes a plurality of implementation units, and each implementation unit corresponds to each implementation step in the above embodiment one.

[0087] Figure 5 is a schematic diagram of an optional code submission device according to the embodiment of the application, as shown in Figure 5 the submission device can include a first sending unit 50, a first obtaining unit 51, a second obtaining unit 52 and a first submission unit 53.

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

[0089] The first obtaining unit 51 is configured to obtain a modification difference file corresponding to a first review identifier generated by the code review system based on the first review request for the first branch, wherein the modification difference file is used to record difference information generated from modification of an original code file corresponding to the target code file to the target code file.

[0090] The second obtaining unit 52 is configured to obtain code modification description information corresponding to the first review identifier in a case where an audit 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.

[0091] The first submission unit 53 is configured to submit 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 repository.

[0092] The above submission device can connect the code review system in the code submission process through the review identifier, and automatically obtain the code file review state through the client, and automatically obtain the corresponding code modification description information after the review is passed, to generate the submission information, and then submit the determined modification difference file and the submission information to the corresponding branch in the code repository, which can avoid redundant manual operation, realize the automatic process of the code file submission, improve the accuracy of the code file submission, achieve the technical effect of efficiently submitting the code file, and further solve the technical problem that redundant manual operation exists in the related art when the code file is submitted, resulting in low submission efficiency.

[0093] Optionally, the submission apparatus further comprises: a second sending unit, configured to send, in response to the code synchronization operation on the first branch and the at least one second branch, a second audit request to the code audit system, wherein the second audit request comprises branch information of each second branch, the modification difference file, and code modification description information corresponding to the first audit identifier; a third obtaining unit, configured to obtain second audit identifiers respectively generated by the code audit system for each second branch according to the second audit request, and audit results corresponding to each second audit identifier; a first generating unit, configured to, for each second branch with a passed audit result, generate 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; and a second submission unit, configured to submit at least one of the modification 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 obtaining unit comprises: a first obtaining module, configured to obtain, from the code repository, an original code file corresponding to the target code file; and a first generating module, configured to invoke a preset command provided by a local code management tool to generate difference content of the target code file compared with the original code file, to obtain the modification difference file corresponding to the first audit identifier.

[0095] Optionally, the submission apparatus further comprises: a first creating unit, configured to create a timing task corresponding to the first audit identifier; wherein the timing task is configured to query the audit result corresponding to the first audit identifier from the code audit system at a timing; and a first receiving unit, configured to receive the audit result corresponding to the first audit identifier returned by the code audit system.

[0096] Optionally, the second obtaining unit comprises: a second obtaining module, configured to obtain, from the code audit system, code modification description information input by a user for the first audit identifier; and a first receiving module, configured to receive the code modification description information input by the user on an interactive interface of the client for the first audit identifier; wherein the code modification description information at least comprises modification factor information and modification description information.

[0097] Optionally, the submission apparatus further comprises: a first adding unit, configured to add the first audit identifier to a preset audit list; wherein the preset audit list is configured to record an audit state corresponding to each audit identifier; and a first updating unit, configured to update the audit state corresponding to the first audit identifier according to the audit result corresponding to the first audit identifier returned by the code audit system.

[0098] Optionally, the submission device further comprises: a fourth acquisition unit, configured to acquire, after updating the audit state corresponding to the first audit identifier, audit result information corresponding to the first audit identifier from the code review system in a case where it is detected that the audit state corresponding to the first audit identifier is an audit failure state; and a first adjustment unit, configured to adjust the target code file based on the audit result information, and re-determine the modification difference file based on the adjusted target code file.

[0099] The submission device described above can further comprise a processor and a memory, and the first sending unit 50, the first acquisition unit 51, the second acquisition unit 52, the first submission unit 53, etc. are all stored in the memory as program units, and the corresponding functions are realized by the processor executing the program units stored in the memory.

[0100] The processor described above comprises a kernel, and the kernel calls the corresponding program units from the memory. The kernel can be one or more, and the at least one of the modification 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 by adjusting the kernel parameters.

[0101] The memory described above can comprise a non-permanent memory in a computer readable medium, a random access memory (RAM) and / or a non-volatile memory such as a read-only memory (ROM) or a flash memory (flash RAM), and the memory comprises at least one memory chip.

[0102] According to another aspect of the embodiments of the present application, a computer program product is further provided, comprising a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the code submission method of any one of the above.

[0103] When the computer program product is executed on a data processing device, the program is adapted to perform the following method steps: in response to a code submission operation for a first branch, sending a first audit request to a code review system, acquiring a modification difference file corresponding to a first audit identifier generated by the code review system based on the first audit request, in a case where an audit result corresponding to the first audit identifier returned by the code review system is passed, acquiring 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, 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 repository.

[0104] According to another aspect of the embodiments of the present application, an electronic device is also provided, which includes one or more processors and a memory storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the code submission method described above.

[0105] Figure 6 is a hardware structure block diagram of an electronic device for a code submission method according to an embodiment of the present application. As shown in Figure 6 , the electronic device can include one or more processors (for example, processors 602a, 602b, …, 602n, etc. in Figure 6 , which can include but are not limited to processing devices such as microprocessors MCU or programmable logic devices FPGA, etc.), a memory 604 for storing data. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the I / O interface), a network interface, a keyboard, a power supply and / or a camera. Those skilled in the art can understand that Figure 6 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the electronic device can also include more or fewer components than those shown in Figure 6 , or have a different configuration from Figure 6 .

[0106] The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0107] The embodiments or examples of the present disclosure are not exhaustive, but only a part of the embodiments or examples, and are not specific limitations on the protection scope of the present disclosure. In the case of no contradiction, each step in an embodiment or example can be implemented as an independent embodiment, and the steps can be combined arbitrarily, for example, the scheme after removing part of the steps in an embodiment or example can also be implemented as an independent embodiment, and the order of the steps in an embodiment or example can be exchanged arbitrarily, in addition, the optional ways or optional examples in an embodiment or example can be combined arbitrarily; in addition, the embodiments or examples can be combined arbitrarily, for example, the steps of different embodiments or examples can be combined arbitrarily, an embodiment or example can be combined with the optional ways or optional examples of other embodiments or examples.

[0108] In the above-described embodiments of the present application, the description of each embodiment has its own emphasis, and the parts not described in detail in an embodiment can be referred to the related description of other embodiments.

[0109] In several embodiments provided by the present application, it should be understood that the disclosed technology can be implemented in other manners. For example, the described unit embodiments can be divided into other ways, for example, the units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be implemented by using some interfaces, and the indirect couplings or communication connections can be implemented in electronic, mechanical, or other forms.

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

[0111] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0112] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various program code storage media.

[0113] The above description is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.

Claims

1. A code submission method characterized by, The application is applied to a client, comprising: In response to a code submission operation for a first branch, a first audit request is sent to a code audit system, wherein the first audit request comprises branch information of the first branch and a target code file to be submitted; According to a first audit identifier generated by the code audit system for the first branch based on the first audit request, a modification difference file corresponding to the first audit identifier is obtained, wherein the modification difference file is used to record difference information generated from modification of an original code file corresponding to the target code file to the target code file; In a case where an 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 is obtained, and based on the code modification description information, the first audit identifier and branch information of the first branch, submission information of the first branch is generated; At least one of the modification difference file and the target code file and the submission information of the first branch are submitted to the first branch in a code repository; Wherein, in response to a code synchronization operation for the first branch and at least one second branch, a second audit request is sent to the code audit system, wherein the second audit request comprises branch information of each second branch, the modification difference file and code modification description information corresponding to the first audit identifier; the second audit identifier generated by the code audit system for each second branch according to the second audit request and the audit result corresponding to each second audit identifier are obtained; for each second branch with a passed audit result, the submission information of the second branch is generated 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; at least one of the modification difference file and the target code file and the submission information of each second branch are submitted to each second branch in the code repository.

2. The submission method of claim 1, wherein, Obtaining the modification difference file corresponding to the first audit identifier comprises: 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 with the original code file, and obtaining the modification difference file corresponding to the first audit identifier.

3. The method of claim 1, wherein, The submission method further comprises: Creating a timing task corresponding to the first audit identifier; wherein the timing task is used to query the audit result corresponding to the first audit identifier from the code audit system at a timing; Or, receiving the audit result corresponding to the first audit identifier returned by the code audit system.

4. The submission method of claim 1, wherein, Obtaining the code modification description information corresponding to the first audit identifier comprises: Obtaining the code modification description information input by a user for the first audit identifier from the code audit system; Alternatively, a code modification description information input by a user on an interaction 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.

5. The submission method of any one of claims 1 to 4, wherein, The submission method further includes: adding the first audit identifier to a preset audit list, wherein the preset audit list is used to record an audit state corresponding to each audit identifier; updating the audit state corresponding to the first audit identifier according to an audit result corresponding to the first audit identifier returned by the code audit system.

6. The submission method of claim 5, wherein, After updating the audit state corresponding to the first audit identifier, further includes: in the case of detecting that the audit state corresponding to the first audit identifier is an audit failure state, obtaining 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 modification difference file.

7. A code submission apparatus characterized by comprising: Applied to a client, including: a first sending unit configured to, in response to a code submission operation for a first branch, send a first audit request to a code audit system, wherein the first audit request includes branch information of the first branch and a target code file to be submitted; a first obtaining unit configured to obtain a modification difference file corresponding to a first audit identifier generated by the code audit system based on the first audit request for the first branch, wherein the modification difference file is used to record difference information generated from modification of an original code file corresponding to the target code file to the target code file; a second obtaining unit configured to, in the case of an audit result corresponding to the first audit identifier returned by the code audit system being passed, obtain 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 the branch information of the first branch; a first submission unit configured to submit 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 a code repository; The submission device further includes: a second sending unit, configured to send a second audit request to the code audit system in response to a code synchronization operation on the first branch and at least one second branch, 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; a third obtaining unit, configured to obtain second audit identifiers respectively generated by the code audit system for each second branch according to the second audit request, and an audit result corresponding to each second audit identifier; a first generating unit, configured to, for each second branch with a passed audit result, generate 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; and a second submission unit, configured to submit at least one of the modification difference file and the target code file, and the submission information of each second branch to each second branch in the code repository, respectively.

8. A computer program product, characterised in that, A non-transitory computer readable storage medium storing a computer program, the computer program being executed by a processor to implement the code submission method of any one of claims 1 to 6.

9. An electronic device, comprising: One or more processors and a memory, the memory being configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the code submission method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Code management control method and system

    CN107463371A

  • Development management method and platform and storage medium

    CN113867691A