Code detection methods, devices, electronic equipment and readable storage media

By acquiring and comparing the merge node sets of code branches and the trunk, the synchronization and merging results of code branches are automatically detected, solving the problem of code branches not being fully synchronized or merged back to the trunk, and achieving the integrity and synchronization of code functionality.

CN115934162BActive Publication Date: 2026-03-13BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

When multiple developers work in parallel on the same program product or functional module, there may be situations where code branches are not fully synchronized with the main branch code or are not merged back into the main branch, resulting in incomplete code functionality or inability to synchronize.

Method used

By obtaining the merge node set in the target code branch and the code trunk, the synchronization and merge results of the code branch to the trunk are detected. The synchronization and merge status is judged by the inclusion relationship of the merge node set, and the standardization of the code branch is automatically identified.

Benefits of technology

Without requiring any manpower investment, it can efficiently, conveniently, and accurately identify and resolve issues such as code branches not being fully synchronized or merged back into the main branch, ensuring the integrity and synchronization of code functionality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934162B_ABST
    Figure CN115934162B_ABST
Patent Text Reader

Abstract

This disclosure provides a code inspection method, apparatus, electronic device, and storage medium, relating to the field of computer science, and particularly to NLP-based testing techniques. The specific implementation involves: obtaining a first set of merge nodes included in the target code branch; obtaining a second set of merge nodes included in the main code branch to which the target code branch belongs; and, based on the first and second sets of merge nodes, detecting the synchronization result of the target code branch with the main code branch, and the merge-back result of the target code branch within the main code branch. This technical solution can, to the greatest extent possible, avoid errors such as code branches not being fully synchronized with the main code in the main code branch, or branch code in a code branch not being merged back into the main code branch, when multiple developers are developing the same program product or functional module in parallel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer science, and more particularly to testing techniques based on NLP (Natural Language Processing), specifically to a code detection method, a code detection device, an electronic device, and a non-transitory computer-readable storage medium storing computer instructions. Background Technology

[0002] In software development, this technology requires multiple developers to collaborate on the code development of a program product or functional module. During the code development process, developers work on their respective code branches. Once a developer has completed and verified their work on their assigned branch, they can either deliver the code directly from that branch or merge the branch back into the main branch for delivery.

[0003] However, during the code development process described above, developers may forget to synchronize the main branch code in the main branch with their own code branch, resulting in incomplete or insufficient functionality of the developed code; or, developers may forget to merge the branch code they developed on their own code branch back into the main branch, resulting in the main branch or other code branches being unable to synchronize with the functionality of the code developed on that code branch. Summary of the Invention

[0004] This disclosure provides a code detection method, a code detection device, an electronic device, and a non-transitory computer-readable storage medium storing computer instructions.

[0005] According to one aspect of this disclosure, a code detection method is provided, comprising:

[0006] Obtain the first merge node set included in the target code branch, where each merge node contains new code;

[0007] Obtain the set of second merge nodes included in the main branch of the target code branch;

[0008] Based on the first merge node set and the second merge node set, detect the synchronization result of the target code branch with the code trunk, and the merge result of the target code branch in the code trunk.

[0009] According to another aspect of this disclosure, a code detection method is also provided, comprising:

[0010] Obtain the first code branch to be detected, and traverse at least one second code branch that has a dependency relationship with the first code branch according to the preset traversal level;

[0011] Detect the synchronization result of the first code branch to its corresponding first code trunk, and the merge result of the first code branch in the first code trunk;

[0012] Detect the synchronization results of each second code branch with its corresponding second code trunk, and the merge results of each second code branch with the second code trunk;

[0013] Summarize the detection results for the first code branch and each of the second code branches.

[0014] According to another aspect of this disclosure, a code detection apparatus is provided, comprising:

[0015] The first merge node set acquisition module is used to acquire the first merge node set included in the target code branch, wherein each merge node contains new code.

[0016] The second merge node set acquisition module is used to acquire the second merge node set included in the code trunk to which the target code branch belongs;

[0017] The detection module is used to detect the synchronization result of the target code branch to the code trunk and the merge result of the target code branch in the code trunk based on the first merge node set and the second merge node set.

[0018] According to another aspect of this disclosure, a code detection device is also provided, comprising:

[0019] The code branch acquisition module is used to acquire the first code branch to be detected, and to traverse at least one second code branch that has a dependency relationship with the first code branch according to a preset traversal level.

[0020] The first code branch detection module is used to detect the synchronization result of the first code branch to its corresponding first code trunk, as well as the merge result of the first code branch in the first code trunk.

[0021] The second code branch detection module is used to detect the synchronization results of each second code branch to its respective second code trunk, as well as the merge results of each second code branch to the second code trunk.

[0022] The search results aggregation module is used to aggregate the detection results for the first code branch and each of the second code branches.

[0023] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0024] At least one processor; and

[0025] A memory communicatively connected to the at least one processor; wherein,

[0026] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any embodiment of this disclosure.

[0027] According to another aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to cause a computer to perform the method as described in any embodiment of this disclosure.

[0028] According to another aspect of this disclosure, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the method as described in any embodiment of this disclosure.

[0029] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0030] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0031] Figure 1 This is a flowchart of a code detection method provided according to an embodiment of the present disclosure;

[0032] Figure 2 This is a flowchart of another code detection method provided according to an embodiment of the present disclosure;

[0033] Figure 3 This is a schematic diagram of yet another code detection method provided according to an embodiment of this disclosure;

[0034] Figure 4 This is a code testing scenario diagram provided according to an embodiment of the present disclosure;

[0035] Figure 5 This is a flowchart of a code detection method provided according to an embodiment of the present disclosure;

[0036] Figure 6 This is a flowchart of another code detection method provided according to an embodiment of the present disclosure;

[0037] Figure 7 This is a structural diagram of a code detection device provided according to an embodiment of the present disclosure;

[0038] Figure 8 This is a structural diagram of another code detection device provided according to an embodiment of the present disclosure;

[0039] Figure 9 This is a block diagram of an electronic device used to implement the code detection method of the embodiments of this disclosure. Detailed Implementation

[0040] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0041] Figure 1 This is a flowchart illustrating a code detection method according to an embodiment of this disclosure. This disclosure is applicable to situations where multiple developers are developing the same functional module in parallel, and the development code of the developers is being detected. The method can be executed by a code detection device, which can be implemented in hardware and / or software, and is generally integrated into a terminal or server with code development, submission, or release functions.

[0042] like Figure 1 As shown, the code detection method provided in this disclosure includes the following specific steps:

[0043] S110. Obtain the first merge node set included in the target code branch, wherein each merge node contains new code.

[0044] In this context, code branches are a concept distinct from the code trunk. The code trunk generally corresponds to a program product (e.g., an application) or an independent functional module within a program product. The code trunk can be understood as a tool used to record the functional iteration process of a program product (or functional module). The code trunk includes one or more merge nodes, where the code in each merge node supplements and improves the code in the previous merge node.

[0045] In an example using a program product, the first merge node on the code backbone can be understood as the prototype code or initial version code corresponding to the program product. Starting from the first merge node, each new merge node generated in the code backbone is equivalent to merging new code to improve the functionality of the prototype code based on the program code corresponding to the previous merge node; this can be understood as a new version of the code.

[0046] For example, if merge node 1, merge node 2, and merge node 3 are generated sequentially on the code branch 'a' corresponding to application A, it can be understood that merge node 1 stores the 1.0 version of application A's program code, merge node 2 stores the 2.0 version of application A's program code, and merge node 3 stores the 3.0 version of application A's program code. Each iteration generates a new version of the code, with new code being added.

[0047] Correspondingly, a code branch can be understood as a tool pulled from the main code branch, used to record the iterative process of one or more new functional components developed by a developer for a program product (or functional module).

[0048] In a specific example, if developer 1 develops a new feature for application A...

[0049] For component a, developer 1 can pull out a branch 1 from the latest merge node X in the main codebase, indicating that this branch 1 inherits and uses all the code from the merge node X.

[0050] The sequence code. And it can start from this merge node X and continue to generate one or more merge nodes on code branch 1.

[0051] The concept of a merge node on a code branch is similar to the concept of a merge node on the code trunk.

[0052] Each time a new merge node is generated in a code branch, it's equivalent to merging new code to improve functionality into the program code corresponding to the previous merge node (node ​​0) of that branch. When a certain...

[0053] After completing the development of the corresponding code functionality on a code branch, the last merge node on that branch can be merged back into the main branch. This will create a new merge node in the main branch, which will contain the new code developed on that branch. (This is achieved by introducing...)

[0054] The concepts of code trunk and code branches allow multiple developers to work in parallel on multiple functional components for the same program product (or 5 functional modules).

[0055] In this embodiment, the target code branch can be understood as the code branch that needs to be inspected among all code branches that match the set program product (or functional module). The target code branch can be obtained manually or by setting rules; this embodiment does not impose any restrictions on this method.

[0056] The first merge node set included in the target code branch 0 can be understood as the target code branch.

[0057] The set of all merge nodes included in the first merge node set. The first merge node in the first merge node set can be a merge node on the main code branch used to pull out the target code branch.

[0058] S120. Obtain the second merge node set included in the code trunk to which the target code branch belongs.

[0059] The target code branch belongs to the main branch of code 5, which is used to extract the target code branch. The second merge node set can be understood as the main branch of code to which the target code branch belongs includes...

[0060] The set of all merged nodes.

[0061] S130. Based on the first merge node set and the second merge node set, detect the synchronization result of the target code branch to the code trunk, and the merge result of the target code branch in the code trunk.

[0062] 0. The synchronization result of the target code branch with the main code branch can be understood as whether the target code branch has synchronized (inherited) all the main code in the main code branch. There are two cases for the synchronization result: one is that the target code branch has completed the synchronization with the main code branch, and the other is that the target code branch has not completed the synchronization with the main code branch.

[0063] As mentioned earlier, during code development, developers need to ensure that all the main branch code in the main branch is synchronized with their code branch. If synchronization is not complete, the target code branch will be missing parts of the main branch code, resulting in incomplete or insufficient functionality in the code developed on that target branch. Therefore, it is necessary to check the synchronization result of the target code branch with the main branch.

[0064] The merge result of the target code branch within the main code branch can be understood as whether all branches on the target code branch have been completely merged back into the main code branch. The merge result includes two cases: one is that the target code branch has been merged back into the main code branch, and the other is that the target code branch has not been merged back into the main code branch.

[0065] As mentioned earlier, developers need to merge the branch code they have developed back into the main branch. If the merge cannot be completed, the main branch or other branches will not be able to synchronize with the functionality of the code developed in that branch. Therefore, it is necessary to check the merge result of the target branch in the main branch.

[0066] In this embodiment, the synchronization result of the target code branch to the code trunk and the merge back result of the target code branch in the code trunk can be detected by comparing the merge node inclusion relationship between the first merge node set and the second merge node set.

[0067] The technical solution of this disclosure, by obtaining a first set of merge nodes included in the target code branch; obtaining a second set of merge nodes included in the code trunk to which the target code branch belongs; and detecting the synchronization result of the target code branch to the code trunk and the merge-back result of the target code branch in the code trunk based on the first set of merge nodes and the second set of merge nodes, can avoid the problems of incomplete or insufficient code functionality on the code branch caused by the code branch not being fully synchronized with the trunk code in the code trunk, or the situation where the code trunk cannot be synchronized with the code functionality developed by the code branch when multiple developers are developing the same program product or functional module in parallel. It can efficiently, conveniently, and accurately identify the standardization of code branches without any human cost.

[0068] Figure 2 This is a flowchart of another code detection method provided according to an embodiment of this disclosure. This embodiment refines the above-described embodiments, further detailing the operation of detecting the synchronization result of the target code branch with the code backbone and the merge result of the target code branch in the code backbone based on the first merge node set and the second merge node set.

[0069] like Figure 2 As shown, the code detection method provided in this disclosure includes the following specific steps:

[0070] S210. Obtain the first merge node set included in the target code branch, wherein each merge node contains new code.

[0071] S220. Obtain the second merge node set included in the code trunk to which the target code branch belongs.

[0072] S230. According to the node merging time, obtain the last merged node in the second merged node set.

[0073] The second merge node set stores all merge nodes included in the main branch of the target code branch. The node merge time specifically refers to the time when a merge node is merged into the code branch or the main branch, which can be understood as the generation time of a merge node.

[0074] Furthermore, the closer the merging time of a merged node is to the current system time, the more complete the functionality of the code in that merged node and the newer the version.

[0075] Correspondingly, based on the node merging time, the last merged node in the second merged node set can be understood as the node in the main code branch to which the target code branch was most recently merged with new code used to improve functionality. That is, this last merged node includes the most complete or latest version of the program code on the main code branch to which the target code branch belongs.

[0076] S240. Detect whether the last merge node in the second merge node set is located in the first merge node set: if yes, execute S250; otherwise, execute S260.

[0077] As mentioned earlier, the first merge node set stores all merge nodes included in the target code branch. If the first merge node set includes the last merge node from the second merge node set, it indicates that the target code branch has completed referencing the most complete code in the main code branch. Therefore, it is determined that the target code branch has completed synchronization with the main code branch.

[0078] If the first merge node set does not include the last merge node in the second merge node set, it indicates that the target code branch does not fully reference the code in the main code branch. Therefore, it is determined that the target code branch has not completed the synchronization with the main code branch.

[0079] S250, Determine that the target code branch has completed the synchronization with the main code branch, and execute S270.

[0080] S260. Determine that the target code branch has not completed synchronization with the main code branch, and execute S270.

[0081] With the above settings, the synchronization results of the target code branch with the main code branch can be obtained simply, conveniently, and accurately without manual intervention.

[0082] S270. According to the node merging time, obtain the last merged node in the first merged node set and execute S280.

[0083] Similarly, the last merge node in the first merge node set can be understood as the node in the target code branch where the new code used to improve the functionality was most recently merged. That is, the last merge node includes the most complete or latest version of the code on the target code branch.

[0084] S280. Detect whether the last merged node in the first merged node set is located in the second merged node set: if yes, execute S290; otherwise, execute S2100.

[0085] As mentioned earlier, the second merge node set stores all merge nodes included in the code trunk to which the target code branch belongs. If the second merge node set includes the last merge node from the first merge node set, it indicates that the code trunk to which the target code branch belongs has already referenced the most complete code in the target code branch. Therefore, it is determined that the target code branch has been merged back into the code trunk.

[0086] If the second merge node set does not include the last merge node in the first merge node set, it means that the reference to the most complete code in the target code branch in the code trunk to which the target code branch belongs is incomplete. Therefore, it is determined that the target code branch has not been merged back into the code trunk.

[0087] S290. Determine that the target code branch has been merged back into the main code branch.

[0088] S2100, Determine that the target code branch has not been merged back into the main code branch.

[0089] The above settings allow for a simple, convenient, and accurate acquisition of the merge result of the target code branch in the main code branch without the need for manual intervention.

[0090] The technical solution of this disclosure obtains the synchronization result of the target code branch to the code trunk by detecting whether the last merge node in the second merge node set is located in the first merge node set; and obtains the merge result of the target code branch in the code trunk by detecting whether the last merge node in the first merge node set is located in the second merge node set. This can efficiently, conveniently and accurately identify the standardization of code branches without any human cost.

[0091] Based on the above embodiments, obtaining the first merge node set included in the target code branch may include:

[0092] When it is determined that the code detection conditions that match the target code branch are met, the first merge node set included in the target code branch is obtained.

[0093] In this embodiment, the target code branch to be detected is obtained through conditional detection. Specifically, one or more code detection conditions can be set, and the code detection method described in each embodiment can be automatically applied to target code branches that meet the code detection conditions.

[0094] The above settings can further improve the automation of code detection and minimize the workload of manual intervention.

[0095] Based on the above embodiments, determining the code detection conditions that match the target code includes at least one of the following:

[0096] In response to a release request for the last merge node in the target code branch, determine the code detection conditions that match the target code branch;

[0097] In response to a commit request for the last merge node in the target code branch, determine the code detection conditions that match the target code branch; and

[0098] In response to a release request for an associated node of any merge node in the target code branch, determine code detection conditions that match the target code branch, wherein the associated node is located in other code branches; and

[0099] In response to a commit request for an associated node of any merge node in the target code branch, determine the code detection conditions that match the target code branch.

[0100] In this context, a node's publish request can be understood as a request to deploy code, while a node's submit request can be understood as a request to store code or submit it for review.

[0101] In this optional implementation, when a release request or commit request of the last merge node in any code branch is detected, the code branch is determined to be the target code branch that meets the code detection conditions.

[0102] Furthermore, if the code in the last merge node a in any code branch A has a dependency (reference) to code in other code branches, then when the last merge node a in code branch A is published or committed, the code branch it depends on will also be triggered to become the target code branch that meets the code detection conditions.

[0103] The above settings enrich the optional conditions in the code detection criteria, which can meet the code detection needs of target code branches in various application scenarios.

[0104] Figure 3 This is a flowchart of another code detection method provided according to an embodiment of the present disclosure. This embodiment refines the above-described embodiments, further detailing the operation of detecting the synchronization result of the target code branch with the code backbone and the merge result of the target code branch in the code backbone based on the first merge node set and the second merge node set.

[0105] like Figure 3 As shown, the code detection method provided in this disclosure includes the following specific steps:

[0106] S310. Obtain the first merge node set included in the target code branch, wherein each merge node contains new code.

[0107] S320. Obtain the second merge node set included in the code trunk to which the target code branch belongs.

[0108] S330. According to the node merging time, obtain the last merged node in the second merged node set.

[0109] S340. Detect whether the last merge node in the second merge node set is located in the first merge node set: if yes, execute S350; otherwise, execute S360.

[0110] S350, Determine that the target code branch has completed the synchronization with the main code branch, and execute S370.

[0111] S360. Determine that the target code branch has not completed synchronization with the main code branch, and execute S370.

[0112] S370. According to the node merging time, obtain the last merged node in the first merged node set.

[0113] S380. Obtain the number of merged node intersections that match the first merged node set and the second merged node set.

[0114] In this embodiment, the number of intersections of the first merge node set and the second merge node set is further calculated, that is, the total number of identical merge nodes included in the first merge node set and the second merge node set.

[0115] In a specific example, if the first merge node set includes merge node 3, merge node 4 and merge node 5, and the second merge node set includes merge node 1, merge node 2 and merge node 3, then the intersection of the merge nodes in the first merge node set and the second merge node set is merge node 3, and the number of merge node intersections is 1.

[0116] S390. Detect whether the last merged node in the first merged node set is located in the second merged node set and whether the number of intersections with the merged node is greater than or equal to 2. If yes, execute S3100; otherwise, execute S3110.

[0117] In this embodiment, in addition to verifying whether the last merged node in the first merged node set is located in the second merged node set, it is further verified whether the number of merged node intersections is greater than or equal to 2.

[0118] If the last merged node in the first merged node set is located in the second merged node set, and the number of merged node intersections is greater than or equal to 2, then it can be determined that the target code branch has been merged back into the code trunk.

[0119] If the last merge node in the first merge node set is not located in the second merge node set, or if the number of merge node intersections is less than 2, then it can be determined that the target code branch has not been merged back into the code trunk.

[0120] In this embodiment, the verification of whether the number of intersections of merge nodes is greater than or equal to 2 is included to ensure that the target code branch belongs to a main branch of code, rather than to other code branches. In other words, it is necessary to ensure that the target code branch is program code pulled from a main branch of code. Therefore, it is necessary to ensure that the target code branch and its main branch share at least one other common merge node, in addition to the last merge node in the first merge node set. Therefore, the judgment of whether the number of intersections of merge nodes is greater than or equal to 2 is added to further improve the code detection method.

[0121] S3100, Determine that the target code branch has been merged back into the main code branch.

[0122] S3110. Determine that the target code branch has not been merged back into the main code branch.

[0123] The technical solution of this disclosure, by simultaneously detecting whether the last merged node in the first merged node set is located in the second merged node set, and whether the number of intersections of merged nodes is greater than or equal to 2, can obtain the merge result of the target code branch in the code trunk in a more general scenario, further improving the accuracy and effectiveness of the code detection results.

[0124] Based on the above embodiments, it may also include:

[0125] If it is determined that the target code branch has not completed the synchronization with the main code branch, a first prompt message is generated and sent to the code maintainer of the target code branch;

[0126] If it is determined that the target code branch has not been merged back into the main code branch, a second prompt message (5) is generated and sent to the code maintainer of the target code branch.

[0127] Specifically, the first and second prompts can be provided to the code maintainers of the target code branch via SMS, email, or instant messaging.

[0128] The above settings enable code maintainers to automatically identify problems in the code on the target code branch and fix them promptly and effectively.

[0129] Figure 4 This is a code detection scenario diagram provided according to embodiments of this disclosure. For example... Figure 4 As shown, the main code branch corresponding to a program product or functional module is the main branch B1. Starting from the merge node N1 on the main branch B1, a code branch is pulled out, namely branch B1. Starting from the merge node N6 on the main branch B1, another code branch is pulled out, namely branch B3.

[0130] 5. In the code detection scenario described above, suppose that a merge into branch B5 within branch B2 is detected.

[0131] The code release request can trigger the code detection method of each embodiment of this disclosure, and on the basis of determining branch B2 as the target code branch, the trunk B1 is determined as the trunk branch to which the target code branch belongs.

[0132] Correspondingly, the first merge node set corresponding to branch B2 includes N1, N2 and N5, and the second merge node set corresponding to the 0 trunk B1 includes N1, N3 and N4.

[0133] Clearly, N4 does not belong to the first merge node set, which means that branch B2 has not completed the synchronization with the trunk B1. That is, the code in merge node N4 in the trunk B1 has not been introduced into branch B2. Consequently, the code developed in branch B1 is incomplete and insufficient.

[0134] Furthermore, N5 does not belong to the second merge node set, indicating that branch B2 was not merged back to trunk 5B1. Consequently, when branch B3 pulls trunk code from trunk B1, it cannot synchronize with the branch B2.

[0135] Develop the functionality of the code.

[0136] Figure 5 This is a flowchart of a code detection method provided according to an embodiment of the present disclosure. This disclosure...

[0137] This embodiment is applicable to situations where multiple developers are developing the same functional module in parallel, and when a developer selects to inspect a specific code branch, code inspection is performed on all code branches that the selected code branch depends on. This method can be executed by a code inspection device, which can be implemented in hardware and / or software, and is generally integrated into a terminal or server with code development processing capabilities.

[0138] like Figure 5As shown, the code detection method provided in this disclosure includes the following specific steps:

[0139] S510. Obtain the first code branch to be detected, and traverse at least one second code branch that has a dependency relationship with the first code branch according to the preset traversal level.

[0140] In this embodiment, the first code branch to be detected can be manually selected by the developer, or it can be a code branch that detects the commit request of the last merge node, or a code branch that detects the release request of the last merge node, etc. This embodiment does not impose any restrictions on this.

[0141] The second code branch can be understood as a code branch that includes code that has a dependency relationship with the first code branch. In other words, the code on the first code branch depends on the code on the second code branch.

[0142] In a specific example, if the code of the last merged node in code branch 1 references a functional component B, which was developed in code branch 2, then code branch 1 and code branch 2 have a dependency relationship.

[0143] The traversal level can be understood as the dependency level between dependencies. Continuing the previous example, if the code of the last merged node in code branch 1 references a functional component B, and the code of functional component B further references a functional component C, where functional component B was developed in code branch 2 and functional component C was developed in code branch 3, then code branch 1 and code branch 2 have a dependency relationship with a dependency level of 1. Simultaneously, code branch 1 and code branch 3 also have a dependency relationship with a dependency level of 2.

[0144] In this embodiment, after the traversal level is determined in advance, one or more second code branches that have a dependency relationship with the first code branch can be traversed step by step under the traversal level.

[0145] The traversal level can be preset according to the actual situation and obtained through a set code analysis tool. This embodiment does not impose any restrictions on this.

[0146] S520. Detect the synchronization result of the first code branch to its corresponding first code trunk, and the merge result of the first code branch in the first code trunk.

[0147] The synchronization result of the first code branch with the first code trunk can be understood as whether the first code branch has synchronized (inherited) all the trunk code in the first code trunk. There are two cases for the synchronization result: one is that the first code branch has completed the synchronization with the first code trunk, and the other is that the first code branch has not completed the synchronization with the first code trunk.

[0148] The merge result of the first code branch in the first code trunk can be understood as whether all branch code on the first code branch has been completely merged back into the first code trunk. The merge result includes two cases: one is that the first code branch has been merged back into the first code trunk, and the other is that the first code branch has not been merged back into the first code trunk.

[0149] S530. Detect the synchronization result of each second code branch to its respective second code trunk, and the merge result of each second code branch to the second code trunk.

[0150] The synchronization result of the second code branch with the second code trunk can be understood as whether the second code branch has synchronized (inherited) all the trunk code in the second code trunk. There are two possible synchronization results: either the second code branch has successfully synchronized with the second code trunk, or the second code branch has not.

[0151] The merge result of the second code branch within the second code trunk can be understood as whether all branch code on the second code branch has been completely merged back into the second code trunk. The merge result includes two cases: one is that the second code branch has been merged back into the second code trunk, and the other is that the second code branch has not been merged back into the second code trunk.

[0152] S540. Summarize the detection results for the first code branch and each of the second code branches.

[0153] After obtaining the synchronization results and merge results (i.e., detection results) corresponding to the first code branch, as well as the synchronization results and merge results corresponding to each of the second code branches, the above synchronization results and merge results can be summarized in a unified manner to obtain all detection results at once.

[0154] The technical solution of this disclosure obtains a first code branch to be detected and traverses at least one second code branch that has a dependency relationship with the first code branch according to a preset traversal level; detects the synchronization result of the first code branch to its first code trunk and the merge result of the first code branch in the first code trunk; detects the synchronization result of each second code branch to its second code trunk and the merge result of each second code branch in the second code trunk; and summarizes the detection results of the first code branch and each second code branch. This method can obtain the synchronization and merge results of all code branches at once when the code branch to be detected has a multi-level reference relationship with other code branches. It can directly detect whether a code branch synchronizes with and merges with the code trunk, and further detect whether other code branches that the underlying code branch depends on synchronize with and merge with the code trunk, thus further expanding the versatility and accuracy of the code detection method.

[0155] Figure 6 This is a flowchart of another code detection method provided according to an embodiment of this disclosure. This embodiment refines the above-described embodiments, specifically detailing the operation of traversing at least one second code branch that has a dependency relationship with the first code branch according to a preset traversal hierarchy.

[0156] like Figure 6 As shown, the code detection method provided in this disclosure includes the following specific steps:

[0157] S610, Obtain the first code branch to be detected.

[0158] S620. Obtain the current traversal level and the dependency type that matches the current traversal level.

[0159] The dependency types include compilation dependencies or packaging dependencies.

[0160] The current traversal level can be initialized to 1 and incremented by 1 level by level.

[0161] In this embodiment, different dependency types can be set in advance according to different traversal levels, and the second code branch can be obtained according to the acquisition method that matches the dependency type.

[0162] Compilation dependencies can be understood as the dependence of code in one code branch on code in other code branches during the compilation process. In a specific example, if code in code branch 1 references code in code branch 2, then code branch 1 has a compilation dependency on code branch 2.

[0163] The packaging dependency can be understood as the dependence of code from one code branch on code from other code branches during the packaging and release process. For example, when packaging and releasing code from code branch A, it is necessary to simultaneously add an interface component developed in code branch B and a communication component developed in code branch C. In this case, code branch A has packaging dependencies on code branches B and C.

[0164] In this embodiment, the dependency type of each traversal level of the first code branch can be determined by a preset code parsing tool or by manual setting.

[0165] S630. Following a reverse parsing method that matches the dependency type, at least one second code branch that has a dependency relationship with the first code branch is parsed and obtained at the current traversal level.

[0166] In this embodiment, different types of reverse parsing interfaces can be called according to different dependency types to obtain at least one second code branch that has a dependency relationship with the first code branch at the current traversal level.

[0167] Specifically, if the dependency type is a compile-time dependency, the branch identifier of the second code branch can be directly obtained through reverse engineering; if the dependency type is a packaged dependency, the dependency version number can be obtained through reverse engineering, and then the branch identifier of the second code branch can be obtained based on the dependency version number.

[0168] S640. Check whether the traversal of the traversal level has been completed: if yes, execute S650; otherwise, return to execute S660.

[0169] After completing the traversal of a traversal level, the current traversal level can be compared with the traversal level number. If the current traversal level reaches the traversal level number, the entire traversal process is considered complete.

[0170] S650. Detect the synchronization result of the first code branch to its corresponding first code trunk, and the merge result of the first code branch in the first code trunk, and execute S670.

[0171] The detection of the synchronization result of the first code branch to its corresponding first code trunk, and the merge result of the first code branch within the first code trunk, may include:

[0172] Based on the set of merge nodes included in the first code branch and the set of merge nodes included in the first code trunk, the synchronization result of the first code branch to its respective first code trunk and the merge back result of the first code branch in the first code trunk are detected.

[0173] Accordingly, detecting the synchronization results of each second code branch with its corresponding second code trunk, and the merge results of each second code branch with the second code trunk, may include:

[0174] Based on the merge node set included in each of the second code branches and the merge node set included in the second code trunk, the synchronization result of each of the second code branches to its respective second code trunk and the merge back result of each of the second code branches to the second code trunk are detected.

[0175] S660. After updating the current traversal level, return to execute S620.

[0176] S670. Detect the synchronization results of each second code branch with its respective second code trunk, and the merge results of each second code branch with the second code trunk, and execute S680.

[0177] S680. Summarize the detection results for the first code branch and each of the second code branches.

[0178] This embodiment of the disclosure obtains the current traversal level and the dependency type matching the current traversal level; according to the reverse parsing method matching the dependency type, it parses and obtains at least one second code branch that has a dependency relationship with the first code branch at the current traversal level; after updating the current traversal level, it returns to the operation of obtaining the current traversal level and the dependency type matching the current traversal level until the traversal of the traversal level is completed. This implementation method can accurately and comprehensively obtain all second code branches that have a dependency relationship with the first code branch under the set traversal level requirement, and thus can obtain all detection results at one time, improving the convenience and universality of detection.

[0179] Based on the above embodiments, after summarizing the detection results for the first code branch and each of the second code branches, the method may further include:

[0180] If it is determined that any one of the first code branch and each of the second code branches has not completed the synchronization with the main code branch, a first prompt message is generated and sent to the code maintainer of that code branch.

[0181] If it is determined that any of the first code branch and each of the second code branches has not been merged back into its respective code trunk, a second prompt message is generated and sent to the code maintainer of that code branch.

[0182] As an implementation of the above-described code detection methods, this disclosure also provides an optional embodiment of an execution device for implementing the above-described code detection methods.

[0183] Figure 7 This is a schematic diagram of a code detection device provided according to an embodiment of the present disclosure; as shown below. Figure 7 As shown, the code detection device includes: a first merged node set acquisition module 710, a second merged node set acquisition module 720, and a detection module 730, wherein:

[0184] The first merge node set acquisition module 710 is used to acquire the first merge node set included in the target code branch, wherein each merge node contains new code.

[0185] The second merge node set acquisition module 720 is used to acquire the second merge node set included in the code trunk to which the target code branch belongs;

[0186] The detection module 730 is used to detect the synchronization result of the target code branch to the code trunk and the merge result of the target code branch in the code trunk based on the first merge node set and the second merge node set.

[0187] The technical solution of this disclosure, by obtaining a first set of merge nodes included in the target code branch; obtaining a second set of merge nodes included in the code trunk to which the target code branch belongs; and detecting the synchronization result of the target code branch to the code trunk and the merge-back result of the target code branch in the code trunk based on the first set of merge nodes and the second set of merge nodes, can avoid the problems of incomplete or insufficient code functionality on the code branch caused by the code branch not being fully synchronized with the trunk code in the code trunk, or the situation where the code trunk cannot be synchronized with the code functionality developed by the code branch when multiple developers are developing the same program product or functional module in parallel. It can efficiently, conveniently, and accurately identify the standardization of code branches without any human cost.

[0188] Based on the above embodiments, the detection module 730 can be specifically used for:

[0189] According to the node merging time, obtain the last merged node in the second merged node set;

[0190] Detect whether the last merge node in the second merge node set is located in the first merge node set;

[0191] If yes, then it is determined that the target code branch has completed synchronization with the main code branch; otherwise, it is determined that the target code branch has not completed synchronization with the main code branch.

[0192] Based on the above embodiments, the detection module 730 can be specifically used for:

[0193] According to the node merging time, obtain the last merged node in the first merged node set;

[0194] Detect whether the last merged node in the first merged node set is located in the second merged node set;

[0195] If so, it is determined that the target code branch has been merged back into the main code branch; otherwise, it is determined that the target code branch has not been merged back into the main code branch.

[0196] Based on the above embodiments, the detection module 730 can be further specifically used for:

[0197] According to the node merging time, obtain the last merged node in the first merged node set;

[0198] Obtain the number of merge nodes that match the first merge node set and the second merge node set;

[0199] Detect whether the last merged node in the first merged node set is located in the second merged node set and whether the number of intersections between the merged node set and the merged node set is greater than or equal to 2.

[0200] If so, it is determined that the target code branch has been merged back into the main code branch; otherwise, it is determined that the target code branch has not been merged back into the main code branch.

[0201] Based on the above embodiments, the first merge node set acquisition module 710 can be specifically used for:

[0202] When it is determined that the code detection conditions that match the target code branch are met, the first merge node set included in the target code branch is obtained.

[0203] Based on the above embodiments, the first merge node set acquisition module 710 can be further used to perform at least one of the following:

[0204] In response to a release request for the last merge node in the target code branch, determine the code detection conditions that match the target code branch;

[0205] In response to a commit request for the last merge node in the target code branch, determine the code detection conditions that match the target code branch; and

[0206] In response to a release request for an associated node of any merge node in the target code branch, determine code detection conditions that match the target code branch, wherein the associated node is located in other code branches; and

[0207] In response to a commit request for an associated node of any merge node in the target code branch, determine the code detection conditions that match the target code branch.

[0208] Based on the above embodiments, a prompting module may also be included, for:

[0209] If it is determined that the target code branch has not completed the synchronization with the main code branch, a first prompt message is generated and sent to the code maintainer of the target code branch;

[0210] If it is determined that the target code branch has not been merged back into the main code branch, a second prompt message is generated and sent to the code maintainer of the target code branch.

[0211] The above-described products can perform the methods provided in any embodiment of this disclosure, and have the corresponding functional modules and beneficial effects for performing the methods.

[0212] As an implementation of the above-described code detection methods, this disclosure also provides an optional embodiment of an execution device for implementing the above-described code detection methods.

[0213] Figure 8 This is a schematic diagram of a code detection device provided according to an embodiment of the present disclosure; as shown below. Figure 8 As shown, the code detection device includes: a code branch acquisition module 810, a first code branch detection module 820, a second code branch detection module 830, and a search result aggregation module 840, wherein:

[0214] The code branch detection module 810 is used to obtain the first code branch to be detected, and to traverse at least one second code branch that has a dependency relationship with the first code branch according to a preset traversal level.

[0215] The first code branch detection module 820 is used to detect the synchronization result of the first code branch to its corresponding first code trunk, as well as the merge result of the first code branch in the first code trunk.

[0216] The second code branch detection module 830 is used to detect the synchronization results of each second code branch to its respective second code trunk, as well as the merge results of each second code branch to the second code trunk;

[0217] The retrieval result summary module 840 is used to summarize the detection results for the first code branch and each of the second code branches.

[0218] The technical solution of this disclosure obtains a first code branch to be detected and traverses at least one second code branch that has a dependency relationship with the first code branch according to a preset traversal level; detects the synchronization result of the first code branch to its first code trunk and the merge result of the first code branch in the first code trunk; detects the synchronization result of each second code branch to its second code trunk and the merge result of each second code branch in the second code trunk; and summarizes the detection results of the first code branch and each second code branch. This method can obtain the synchronization and merge results of all code branches at once when the code branch to be detected has a multi-level reference relationship with other code branches. It can directly detect whether a code branch synchronizes with and merges with the code trunk, and further detect whether other code branches that the underlying code branch depends on synchronize with and merge with the code trunk, thus further expanding the versatility and accuracy of the code detection method.

[0219] The above-described products can perform the methods provided in any embodiment of this disclosure, and have the corresponding functional modules and beneficial effects for performing the methods.

[0220] Based on the above embodiments, the code branch detection module 810 can be specifically used for:

[0221] Get the current traversal level and the dependency type that matches the current traversal level, wherein the dependency type includes compile-up dependencies or packaged dependencies;

[0222] Following the reverse parsing method that matches the dependency type, at least one second code branch that has a dependency relationship with the first code branch is obtained at the current traversal level;

[0223] After updating the current traversal level, return to execute the operation of obtaining the current traversal level and the dependency type that matches the current traversal level, until the traversal of the traversal level is completed.

[0224] Based on the above embodiments, the first code branch detection module 820 can be specifically used for:

[0225] Based on the set of merge nodes included in the first code branch and the set of merge nodes included in the first code trunk, the synchronization result of the first code branch to its respective first code trunk and the merge back result of the first code branch in the first code trunk are detected.

[0226] Based on the above embodiments, the second code branch detection module 830 can be specifically used for:

[0227] Based on the merge node set included in each of the second code branches and the merge node set included in the second code trunk, the synchronization result of each of the second code branches to its respective second code trunk and the merge back result of each of the second code branches to the second code trunk are detected.

[0228] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0229] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0230] Figure 9 A schematic block diagram of an example electronic device 900 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0231] like Figure 9 As shown, device 900 includes a computing unit 901, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 902 or a computer program loaded from storage unit 908 into random access memory (RAM) 903. RAM 903 may also store various programs and data required for the operation of device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904.

[0232] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of monitors, speakers, etc.; storage unit 908, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0233] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as implementing the code detection methods as described in the various embodiments of this disclosure. For example, in some embodiments, the code detection method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program may be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by computing unit 901, one or more steps of the code detection method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform a code detection method described above by any other suitable means (e.g., by means of firmware).

[0234] That is: obtain the first merge node set included in the target code branch, where each merge node contains new code;

[0235] Obtain the set of second merge nodes included in the main branch of the target code branch;

[0236] Based on the first merge node set and the second merge node set, detect the synchronization result of the target code branch with the code trunk, and the merge result of the target code branch in the code trunk.

[0237] Alternatively, it can be configured to perform another code detection method described above.

[0238] That is: obtain the first code branch to be detected, and traverse at least one second code branch that has a dependency relationship with the first code branch according to the preset traversal level;

[0239] Detect the synchronization result of the first code branch to its corresponding first code trunk, and the merge result of the first code branch in the first code trunk;

[0240] Detect the synchronization results of each second code branch with its corresponding second code trunk, and the merge results of each second code branch with the second code trunk;

[0241] Summarize the detection results for the first code branch and each of the second code branches.

[0242] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0243] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0244] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0245] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0246] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0247] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem that addresses the management difficulties and weak business scalability inherent in traditional physical hosting and VPS services. Servers can also be servers for distributed systems or servers integrated with blockchain technology.

[0248] Artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies mainly include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.

[0249] Cloud computing refers to a technology system that enables access to a shared pool of physical or virtual resources via a network. These resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for applications such as artificial intelligence and blockchain, as well as for model training.

[0250] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution provided in this disclosure can be achieved, and this is not limited herein.

[0251] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A code detection method, comprising: obtaining a first set of merge nodes included in a target code branch, wherein each of the merge nodes has new code merged therein; obtaining a second set of merge nodes included in a code trunk to which the target code branch belongs; detecting, according to the first set of merge nodes and the second set of merge nodes, a synchronization result of the target code branch to the code trunk and a merge-back result of the target code branch in the code trunk; wherein detecting, according to the first set of merge nodes and the second set of merge nodes, the synchronization result of the target code branch to the code trunk comprises: obtaining a last merge node in the second set of merge nodes according to a merge time of the nodes; detecting whether the last merge node in the second set of merge nodes is located in the first set of merge nodes; if yes, determining that the target code branch has completed the synchronization to the code trunk; otherwise, determining that the target code branch has not completed the synchronization to the code trunk; wherein detecting, according to the first set of merge nodes and the second set of merge nodes, the merge-back result of the target code branch in the code trunk comprises: obtaining a last merge node in the first set of merge nodes according to a merge time of the nodes; detecting whether the last merge node in the first set of merge nodes is located in the second set of merge nodes; if yes, determining that the target code branch has merged back to the code trunk; otherwise, determining that the target code branch has not merged back to the code trunk; or obtaining a last merge node in the first set of merge nodes according to a merge time of the nodes; obtaining a number of intersection merge nodes matched by the first set of merge nodes and the second set of merge nodes; detecting whether the last merge node in the first set of merge nodes is located in the second set of merge nodes and the number of intersection merge nodes is greater than or equal to 2; if yes, determining that the target code branch has merged back to the code trunk; otherwise, determining that the target code branch has not merged back to the code trunk.

2. The method of claim 1, wherein, obtaining the first set of merge nodes included in the target code branch comprises: obtaining the first set of merge nodes included in the target code branch when it is determined that a code detection condition matched by the target code branch is satisfied.

3. The method of claim 2, wherein, determining that the code detection condition matched by the target code branch is satisfied comprises at least one of: determining that the code detection condition matched by the target code branch is satisfied in response to a publishing request for a last merge node in the target code branch; determining that the code detection condition matched by the target code branch is satisfied in response to a committing request for the last merge node in the target code branch; and determining that the code detection condition matched by the target code branch is satisfied in response to a publishing request for an associated node of any merge node in the target code branch, wherein the associated node is located in another code branch; and determining that the code detection condition matched by the target code branch is satisfied in response to a committing request for the associated node of any merge node in the target code branch. 4.The method of claim 1, further comprising: ​ ​ if it is determined that the target code branch does not complete synchronization with the code trunk, generating a first prompt information and sending the first prompt information to a code maintainer of the target code branch; if it is determined that the target code branch does not merge back to the code trunk, generating a second prompt information and sending the second prompt information to the code maintainer of the target code branch.

5. A code detection method, comprising: obtaining a first code branch to be detected, and traversing at least one second code branch having a dependency relationship with the first code branch according to a preset traversal level; detecting a synchronization result of the first code branch to a first code trunk and a merge back result of the first code branch in the first code trunk by using the code detection method of claim 1; detecting a synchronization result of each second code branch to a second code trunk and a merge back result of each second code branch to the second code trunk by using the code detection method of claim 1; summarizing the detection results of the first code branch and each second code branch.

6. The method of claim 5, wherein, traversing at least one second code branch having a dependency relationship with the first code branch according to a preset traversal level, comprising: obtaining a current traversal level and a dependency type matched with the current traversal level, wherein the dependency type includes a compilation dependency or a packaging dependency; resolving at least one second code branch having a dependency relationship with the first code branch at a current traversal level according to a reverse resolution mode matched with the dependency type; updating the current traversal level and returning to perform the operation of obtaining the current traversal level and the dependency type matched with the current traversal level until the traversal of the preset traversal level is completed.

7. The method of claim 5, wherein, detecting a synchronization result of the first code branch to a first code trunk and a merge back result of the first code branch in the first code trunk, comprising: detecting the synchronization result of the first code branch to the first code trunk and the merge back result of the first code branch in the first code trunk according to a merge-in node set included in the first code branch and a merge-in node set included in the first code trunk; detecting a synchronization result of each second code branch to a second code trunk and a merge back result of each second code branch to the second code trunk, comprising: detecting the synchronization result of each second code branch to the second code trunk and the merge back result of each second code branch to the second code trunk according to a merge-in node set included in each second code branch and a merge-in node set included in the second code trunk.

8. A code detection device, comprising: a first merge-in node set obtaining module configured to obtain a first merge-in node set included in a target code branch, wherein each merge-in node includes new code; a second merge-in node set obtaining module configured to obtain a second merge-in node set included in a code trunk to which the target code branch belongs. detecting, according to the first set of merged nodes and the second set of merged nodes, a synchronization result of the target code branch to the code trunk and a merging back result of the target code branch in the code trunk; wherein the detecting module is specifically configured to acquire a last merged node in the second set of merged nodes according to a node merging time; detect whether the last merged node in the second set of merged nodes is located in the first set of merged nodes; if yes, determine that the target code branch completes the synchronization to the code trunk; otherwise, determine that the target code branch does not complete the synchronization to the code trunk. The detecting module is specifically further configured to acquire a last merged node in the first set of merged nodes according to the node merging time; detect whether the last merged node in the first set of merged nodes is located in the second set of merged nodes; if yes, determine that the target code branch has merged back to the code trunk; otherwise, determine that the target code branch has not merged back to the code trunk; or, acquire a last merged node in the first set of merged nodes according to the node merging time; acquire a number of intersection nodes matched with the first set of merged nodes and the second set of merged nodes; detect whether the last merged node in the first set of merged nodes is located in the second set of merged nodes and the number of intersection nodes is greater than or equal to 2; if yes, determine that the target code branch has merged back to the code trunk; otherwise, determine that the target code branch has not merged back to the code trunk. 9.A code detecting device, comprising: a detecting code branch acquiring module configured to acquire a first code branch to be detected by using the device of claim 8 and traverse at least one second code branch having a dependency relationship with the first code branch according to a preset traversal level; a first code branch detecting module configured to detect, by using the device of claim 8, a synchronization result of the first code branch to a first code trunk and a merging back result of the first code branch in the first code trunk; a second code branch detecting module configured to detect a synchronization result of each second code branch to a second code trunk and a merging back result of each second code branch to the second code trunk; a search result summarizing module configured to summarize the detection results of the first code branch and each second code branch. 10.An electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method of any one of claims 1-4 or the method of any one of claims 5-7.

11. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to execute the method of any one of claims 1-4 or the method of any one of claims 5-7.

12. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-4, or implements the steps of the method of any one of claims 5-7.

Citation Information

Patent Citations

  • Code synchronizing method and apparatus

    CN105302533A

  • Synchronizing a set of code branches

    US20190163478A1