Branch strategy generation method, device, terminal device and storage medium

By obtaining the project information entered by the user, generating branch policy templates and editing, the problem of poor accuracy in manual selection of branch policy types and managing code branches in the existing technology is solved, and more accurate and efficient branch policy management is achieved.

CN114489617BActive Publication Date: 2025-05-06CHINA MERCHANTS BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210020476.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-10
Publication Date
2025-05-06
Estimated Expiration
2042-01-10

AI Technical Summary

Technical Problem

In the prior art, users need to manually select branch policy types and manually manage code branches, resulting in inaccurate selection of branch policies and prone to errors in code branch management.

Method used

By obtaining the project information entered by the user, obtaining the branch policy template, creating a visual editing list, generating branch information based on the user's editing instructions, and performing batch branch operations to generate the target branch policy.

Benefits of technology

It improves the accuracy of using branch strategies, reduces manual management errors, and ensures project development progress and development efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114489617B_ABST
    Figure CN114489617B_ABST
Patent Text Reader

Abstract

The present invention discloses a branch strategy generation method, the method comprising: obtaining project information input by a user, and obtaining a branch strategy template according to the project information; creating a visual edit list corresponding to the branch strategy template, and obtaining the user's editing instructions for the branch strategy template based on the visual edit list; generating branch information according to the editing instructions, and performing batch branch operations according to the branch information to generate a target branch strategy. The present invention also discloses a branch strategy generation device, a terminal device, and a storage medium. The present invention templates the branch strategy, obtains the corresponding branch strategy template for the user to edit according to the project information input by the user, which not only meets the user's demand for the branch strategy, but also eliminates the need for the user to manually select the branch strategy type, thereby improving the accuracy of the use of the branch strategy and ensuring the project development progress and development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a branch strategy generation method, device, terminal equipment and storage medium. Background Art

[0002] At present, common code management methods include: management based on the warehouse dimension in public cloud scenarios, and management based on the business project dimension in enterprise internal scenarios. In public cloud scenarios, users generally select branch strategy types by themselves, and manually create, merge, and delete code branches. When users are not sure whether the selected branch strategy type is applicable, the selected branch strategy type may be inaccurate. In enterprise internal scenarios, especially in the context of system microservices, a project may contain multiple code repositories. Due to inconsistent release frequencies and other reasons, the branch strategy of each code repository is different. Manual management of code branches is cumbersome and error-prone. In other words, the existing code branch management method requires users to manually select branch strategies and manually manage code branches, resulting in inaccurate branch strategy selection and error-prone code branch management. Summary of the invention

[0003] The main purpose of the present invention is to provide a branch strategy generation method, apparatus, terminal device and storage medium, aiming to solve the existing technical problem of manually selecting branch strategy types and manually managing code branches with poor accuracy.

[0004] In addition, to achieve the above object, the present invention also provides a branch strategy generation method, the branch strategy generation method comprising the following steps:

[0005] Obtain project information input by a user, and obtain a branch strategy template according to the project information;

[0006] Creating a visual edit list corresponding to the branch strategy template, and obtaining an edit instruction of the user for the branch strategy template based on the visual edit list;

[0007] Branch information is generated according to the editing instruction, and batch branch operations are performed according to the branch information to generate a target branch strategy.

[0008] Optionally, the step of performing batch branch operations according to the branch information to generate a target branch strategy includes:

[0009] Creating and merging code branches in batches according to the branch information to generate a first branch strategy, wherein the branch information includes a branch type, a branch name, a starting flow direction of the branch, and a synchronization branch of each of the code branches in the first branch strategy;

[0010] The hierarchical configuration information of the first branch strategy is obtained, and the policy hierarchy of the first branch strategy is configured according to the hierarchical configuration information to generate a target branch strategy, wherein the policy hierarchy includes a warehouse level and a team level.

[0011] Optionally, after the step of performing batch branch operations according to the branch information and generating a target branch strategy, the step further includes:

[0012] When a project transfer instruction is detected, each code repository under the project corresponding to the project information is obtained;

[0013] Batch operations are performed on the codes of each of the code repositories according to the target branch strategy, and the batch operations include a merge operation, a create operation, a lock operation, and a delete operation.

[0014] Optionally, after the step of performing batch operations on the codes of each of the code repositories according to the target branch strategy, the step further includes:

[0015] Collecting branch dynamic information of the target branch strategy, wherein the branch dynamic information includes release frequency, version conflict information, and parallel development information;

[0016] The branch dynamic information is sent to a pre-trained analysis and decision model, and a risk assessment is performed on the target branch strategy to determine the risk value of the target branch strategy.

[0017] Optionally, after the step of performing risk assessment on the target branch strategy and determining the risk value of the target branch strategy, the step further includes:

[0018] If the risk value is greater than a preset risk threshold, a warning prompt message is output, and a recommended strategy is determined using the decision analysis model;

[0019] When a policy adjustment instruction is detected, the target branch policy is adjusted using the recommended policy, and the step of collecting branch dynamic information of the target branch policy is returned and executed until the risk value is less than or equal to a preset risk threshold.

[0020] Optionally, after the step of performing batch branch operations according to the branch information and generating a target branch strategy, the step further includes:

[0021] A new branch policy template is generated based on the target branch policy and saved.

[0022] Optionally, the step of obtaining project information input by a user and obtaining a branch strategy template according to the project information includes:

[0023] Determine a code repository associated with a project corresponding to the project information;

[0024] Determine the branch policy information used by each of the code repositories, and determine and obtain a branch policy template based on the branch policy information.

[0025] In addition, to achieve the above-mentioned purpose, the present invention further provides a branch strategy generating device, the branch strategy generating device comprising:

[0026] A template acquisition module is used to acquire project information input by a user and acquire a branch strategy template according to the project information;

[0027] A template editing module, used to create a visual editing list corresponding to the branch strategy template, and obtain the user's editing instruction for the branch strategy template based on the visual editing list;

[0028] The strategy generation module is used to generate branch information according to the editing instruction, and perform batch branch operations according to the branch information to generate a target branch strategy.

[0029] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal device, which includes: a memory, a processor, and a branch strategy generation program stored in the memory and executable on the processor, and the branch strategy generation program implements the steps of the branch strategy generation method as described above when executed by the processor.

[0030] In addition, to achieve the above purpose, the present invention also provides a computer-readable storage medium, on which a branch strategy generation program is stored, and when the branch strategy generation program is executed by a processor, the steps of the branch strategy generation method as described above are implemented.

[0031] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the branch strategy generation method as described above are implemented.

[0032] The embodiments of the present invention propose a branch strategy generation method, apparatus, terminal device and storage medium. In the prior art, it is necessary to manually select the branch strategy type and manually manage the code branches, resulting in poor accuracy in the use of the branch strategy. Compared with the prior art, in the embodiments of the present invention, by obtaining the project information input by the user, a branch strategy template is obtained according to the project information; a visual edit list corresponding to the branch strategy template is created, and the user's editing instructions for the branch strategy template based on the visual edit list are obtained; branch information is generated according to the editing instructions, and batch branch operations are performed according to the branch information to generate a target branch strategy. By templateizing the branch strategy, the corresponding branch strategy template is obtained for the user to edit according to the project information input by the user, which not only meets the user's demand for the branch strategy, but also eliminates the need for the user to manually select the branch strategy type, thereby improving the accuracy of the use of the branch strategy and ensuring the project development progress and development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of the hardware structure of a terminal device according to an embodiment of the present invention;

[0034] Figure 2 It is a flow chart of the first embodiment of the branch strategy generation method of the present invention;

[0035] Figure 3 A schematic diagram of a visual edit list of the first embodiment of the branch strategy generation method of the present invention;

[0036] Figure 4 Another schematic diagram of a visual edit list of the first embodiment of the branch strategy generation method of the present invention;

[0037] Figure 5 This is a schematic diagram of the branch strategy visualization effect of the first embodiment of the branch strategy generation method of the present invention;

[0038] Figure 6 It is a functional module diagram of an embodiment of a branch strategy generating device of the present invention.

[0039] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0040] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0041] In the subsequent description, the suffixes such as "module", "component" or "unit" used to represent elements are only used to facilitate the description of the present invention, and have no specific meanings. Therefore, "module", "component" or "unit" can be used in a mixed manner.

[0042] The branch strategy generation terminal (also called terminal, device or terminal device) in the embodiment of the present invention may be a PC, or a mobile terminal device with a display function such as a smart phone, a tablet computer and a portable computer.

[0043] like Figure 1 As shown, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0044] Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. Among them, sensors include light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor may turn off the display screen and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; of course, the mobile terminal may also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., which will not be repeated here.

[0045] Those skilled in the art will understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0046] like Figure 1 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a branch strategy generation program.

[0047] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the branch strategy generation program stored in the memory 1005. When the branch strategy generation program is executed by the processor, the operations in the branch strategy generation method provided in the following embodiment are implemented.

[0048] Based on the above device hardware structure, an embodiment of the branch strategy generation method of the present invention is proposed.

[0049] Reference Figure 2 In a first embodiment of the branch strategy generation method of the present invention, the branch strategy generation method includes:

[0050] Step S10, obtaining project information input by the user, and obtaining a branch strategy template according to the project information;

[0051] The existing code branch management model is generally based on the public cloud scenario, with code repositories as the dimension for code branch management. Users manually select from fixed branch policy types, such as trunk development branch release, branch development trunk release, etc., and then manually create, merge or delete code branches based on the selected branch policy type to generate a branch policy. It is possible that the branch policy type selected by the user is not applicable, and over time, the branch policy applicable to the code repository may change, and the number of code branches that need to be managed will gradually increase. Manual management tasks are cumbersome and prone to errors. Or based on the internal enterprise scenario, code branch management is performed based on business projects. A project may involve multiple code repositories. Each code repository uses a different branch policy type, which will make it impossible for the project team to unify branch operation specifications, resulting in chaotic code branch management, which is likely to affect development progress and efficiency.

[0052] Based on this, the present invention proposes a branch strategy generation method, which templates the branch strategy and recommends applicable branch strategy templates to users based on their project information. Users can edit the branch strategy templates to generate a target branch strategy that meets their needs.

[0053] Specifically, first obtain the project information input by the user, which includes the project name, development team, project stage, and the relationship with other projects. Among them, the stages include DEV stage (development), ST stage (System Test), UAT stage (User Acceptance Test), PRD stage (production / formal stage), etc. The user who inputs the project information can be a project member or a continuous delivery administrator of the branch strategy, which is not limited here. Determine the branch policy template applicable to the project based on the project information input by the user. The branch policy template corresponds to different branch policy types. According to the project itself and its relationship with other projects, the branch policy template that can minimize the risk of the project is determined through the branch strategies used by other projects.

[0054] Further, the refinement of step S10 includes:

[0055] Step S101, determining a code repository associated with a project corresponding to the project information;

[0056] Step S102: determining the branch policy information used by each of the code repositories, and determining and acquiring a branch policy template according to the branch policy information.

[0057] When obtaining a branch policy template, first determine the code repository associated with the project based on the project information entered by the user. More specifically, determine the code repositories associated with different stages of the project. Then determine the branch policy information used by each code repository. Based on the branch policy information used by each code repository associated with the project, determine and obtain the branch policy template that minimizes the risk of the project.

[0058] Step S20, creating a visual edit list corresponding to the branch strategy template, and obtaining the user's editing instruction for the branch strategy template based on the visual edit list;

[0059] Create a visual edit list based on the obtained branch policy template, visualize the templated branch policy, and create an edit list interface for users to edit. Obtain instructions for users to edit the branch policy in the branch policy template based on the visual edit list. Figure 3As shown, the visual edit list of the branch strategy template contains branch information for different project stages, including branch type, branch name, starting flow direction of the branch, and synchronization branch, etc. Users can edit the branch strategy in the visual edit list. The branch name can be the name information of the code branch or the naming rule of the code branch; the start of the code branch indicates the starting branch for creating the code branch, and the starting branch for the code flow when the code branch is merged; the flow direction of the code branch indicates the target branch when the code branch is merged and the target branch when the code is compiled for construction. The synchronization branch is the branch that needs to be synchronized after the code is merged, and it is merged in time to reduce the probability of version conflicts. It is understandable that in the created visual edit list, the user-editable information can be pre-generated based on the branch strategy template, and the user can adjust it according to actual needs, and change the information in the branch strategy template by clicking or text input; the user-editable information can also be blank, and the user can set it by clicking or text input according to the needs of different project stages; the user-editable information can also be partially given, and some information such as branch strategy type and branch name are given according to the branch strategy template, and the rest such as the start and flow direction of the branch are set by the user, and the user is also allowed to edit and change the given part of the information. The corresponding editing instructions are generated based on the user's editing on the visual edit list.

[0060] Step S30, generating branch information according to the editing instruction, and performing batch branch operations according to the branch information to generate a target branch strategy.

[0061] Based on the generated editing instructions, branch information is generated, and batch branch operations are performed according to the generated branch information, such as batch generation and merging of code branches, thereby generating a target branch strategy, which is a visual view. Figure 5 As shown, Figure 5 It is based on the user's Figure 4 The visual view of the branch strategy generated by the information edited in the visual editing list shown is dynamically generated according to the user's editing instructions for the branch strategy template, and can clearly display the code branches corresponding to different project stages such as DEV, ST, and UAT, as well as the starting flow of each code branch. The user can preview the branch strategy generated in real time. It is understandable that in the visual view of the branch strategy, the branch type, branch name and other branch information of each code branch can also be displayed in real time according to the user's selection, so that the user can distinguish and visualize the target branch strategy, so that the user can intuitively understand the branches, trunks, branch creation, branch merges, synchronization after branch merges, etc. contained in the branch strategy, and the user can also intuitively understand the scope of application, characteristics, advantages and disadvantages of the current branch strategy, so that the user can adjust the branch strategy according to the visual view.

[0062] Further, the refinement of step S20 includes:

[0063] Step S201, batch create and merge code branches according to the branch information to generate a first branch strategy, wherein the branch information includes a branch type, a branch name, a starting flow direction of the branch, and a synchronization branch of each code branch in the first branch strategy;

[0064] Step S202, obtaining the hierarchical configuration information of the first branch strategy, configuring the policy hierarchy of the first branch strategy according to the hierarchical configuration information, and generating a target branch strategy, wherein the policy hierarchy includes a warehouse level and a team level.

[0065] When generating the target branch strategy, code branches are created and merged in batches according to the generated branch information to generate the first branch strategy, wherein the generated branch information includes branch type, branch name, starting flow direction of the branch, and synchronization branch, etc. Based on the generated branch information, branches are created and merged in batches. As described above, the start of the code branch represents the starting branch for creating the code branch, and the starting branch of the code flow when the code branch is merged; the flow direction of the code branch represents the target branch when the code branch is merged and the target branch when the code is compiled for building, and the synchronization branch is the branch that needs to be synchronized after the code is merged. Based on the branches created in batches, merge according to the score type and starting flow direction of each code branch to generate the first branch strategy.

[0066] The user or continuous delivery administrator confirms whether the generated branch policy meets the branch management requirements based on the visual view of the branch policy. If so, the applicable policy level is selected for the used branch policy to generate the target branch policy. After the target branch policy takes effect, the corresponding code repository can be used. When configuring the policy level for the first branch policy, the level configuration information is generated according to the configuration operation of the user or continuous delivery administrator. When the level configuration information for the first branch policy is obtained, the policy level of the first branch policy is configured according to the level configuration information, thereby generating the following: Figure 5 The visualized target branch strategy is shown. The hierarchical levels include warehouse level and team level, which is a hierarchical division of branch strategies based on different dimensions to flexibly adapt to the needs of users in different dimensions.

[0067] In this embodiment, the project information input by the user is obtained, and a branch policy template is obtained according to the project information; a visual edit list corresponding to the branch policy template is created, and the user's editing instructions for the branch policy template based on the visual edit list are obtained; branch information is generated according to the editing instructions, and batch branch operations are performed according to the branch information to generate a target branch policy. By templateizing the branch policy, the corresponding branch policy template is obtained for the user to edit according to the project information input by the user, which not only meets the user's demand for branch policy, but also eliminates the need for the user to manually select the branch policy type, thereby improving the accuracy of the use of branch policies and ensuring the progress and efficiency of project development.

[0068] Furthermore, based on the above-mentioned embodiment of the present invention, a second embodiment of the branch strategy generating method of the present invention is proposed.

[0069] This embodiment is a step after step S30 in the first embodiment. Based on the above embodiment, after generating the target branch strategy, the following steps may be further included:

[0070] Step A1, when a project transfer instruction is detected, obtaining each code repository under the project corresponding to the project information;

[0071] Step A2: performing batch operations on the codes of each code repository according to the target branch strategy, wherein the batch operations include a merge operation, a create operation, a lock operation, and a delete operation.

[0072] After the generated target branch strategy takes effect, when a project transfer instruction is detected, each code repository under the project corresponding to the project information input by the user is obtained, wherein the project transfer instruction is an instruction automatically triggered by the business process initiated by the user or project member through the client's project process management tool. When the project moves from one stage to another, the project members can initiate business processes such as project stage changes through the client's project process management tool, such as ST process, UAT process, production process, etc. When the business process of the project stage is detected, the project transfer instruction is automatically triggered to obtain all code repositories under the project, and batch operations are performed on the codes in each code repository according to the generated target branch strategy. The batch operations include code branch creation, merging, locking, and deletion operations.

[0073] Specifically, the branch strategy used by each code repository is determined according to the target branch strategy. In the target branch strategy, the branch strategy of each code repository may be at the repository level or at the team level. If the current code repository does not have a repository-level branch strategy, the team-level branch strategy is used to create, merge, lock, or delete code branches based on the branch strategy of each code repository. If the current operation is a code merge operation, a code merge operation is initiated, and the code management tool performs the merge operation in batches. After the merge is successful, the pipeline build is triggered; if the operation is to create a branch, a create branch operation is initiated, and the code management tool performs the create branch operation in batches. The branch name is generated according to the name or rule edited by the user in the branch strategy. The branch strategy is driven by key nodes of project status flow or project stage changes to achieve management of code branches.

[0074] Furthermore, after step A2, the method further includes:

[0075] Step A3, collecting branch dynamic information of the target branch strategy, wherein the branch dynamic information includes release frequency, version conflict information and parallel development information;

[0076] Step A4, sending the branch dynamic information to a pre-trained analysis and decision model, performing a risk assessment on the target branch strategy, and determining a risk value of the target branch strategy.

[0077] When the branch strategy is driven by the project status flow or the key nodes of the project, the branch dynamic information of the target branch strategy is collected. The branch dynamic information includes the release frequency, version conflict information and parallel development information of each code branch on the target branch strategy. The collected branch dynamic information is sent to the pre-trained decision analysis model, and the generated target branch strategy is risk assessed to determine the risk value of the target branch strategy.

[0078] After determining the risk value of the generated target branch strategy, it also includes:

[0079] Step A5: if the risk value is greater than a preset risk threshold, outputting a warning message and determining a recommended strategy using the decision analysis model;

[0080] Step A6, when a policy adjustment instruction is detected, the target branch policy is adjusted using the recommended policy, and the step of collecting branch dynamic information of the target branch policy is returned and executed until the risk value is less than or equal to a preset risk threshold.

[0081] The risk value is compared with the preset risk threshold. If it is greater than the preset risk threshold, a warning message is output. At the same time, the analysis and decision model is used to output a recommended strategy to the user so that the user can adjust the generated target branch strategy according to the recommended strategy. Based on the adjusted branch strategy, the branch dynamic information is re-collected and risk assessment is performed until the risk value of the branch strategy is no greater than the preset risk threshold.

[0082] It is understandable that when obtaining a branch strategy template based on the project information input by the user, a pre-trained decision analysis model can also be used to analyze the collected branch dynamic information of each type of branch strategy, and select the branch strategy type with the lowest risk value as the template.

[0083] Furthermore, after step S30, the following steps may also be included:

[0084] Step B1: Generate and save a new branch policy template based on the target branch policy.

[0085] After the target branch strategy is generated, a new branch strategy template is generated and saved based on the target branch strategy, or a new branch strategy template is generated and saved based on the branch strategy with the lowest risk value after the target branch strategy is adjusted, so as to expand the template library for subsequent calls.

[0086] In this embodiment, the code branches are managed by driving the branch strategy through the project status flow or key nodes, reducing the cost of manual maintenance. In addition, the generated branch strategy is risk assessed using a decision analysis model to continuously ensure the application of the branch strategy before, during, and after the branch strategy configuration, thereby improving the accuracy of the use of the branch strategy, simplifying the management of code branches, and helping to improve the progress and efficiency of project development.

[0087] In addition, referring to the figure, an embodiment of the present invention further proposes a branch strategy generation device, the branch strategy generation device comprising:

[0088] The template acquisition module 10 is used to acquire the project information input by the user and acquire the branch strategy template according to the project information;

[0089] The template editing module 20 is used to create a visual editing list corresponding to the branch strategy template and obtain the user's editing instruction for the branch strategy template based on the visual editing list;

[0090] The strategy generation module 30 is used to generate branch information according to the editing instruction, and perform batch branch operations according to the branch information to generate a target branch strategy.

[0091] Optionally, the template acquisition module 10 is further used for:

[0092] Determine a code repository associated with a project corresponding to the project information;

[0093] Determine the branch policy information used by each of the code repositories, and determine and obtain a branch policy template based on the branch policy information.

[0094] Optionally, the strategy generation module 30 is further used to:

[0095] Creating and merging code branches in batches according to the branch information to generate a first branch strategy, wherein the branch information includes a branch type, a branch name, a starting flow direction of the branch, and a synchronization branch of each of the code branches in the first branch strategy;

[0096] The hierarchical configuration information of the first branch strategy is obtained, and the policy hierarchy of the first branch strategy is configured according to the hierarchical configuration information to generate a target branch strategy, wherein the policy hierarchy includes a warehouse level and a team level.

[0097] Optionally, the branch strategy generating device further includes a project driving module, which is used to:

[0098] When a project transfer instruction is detected, each code repository under the project corresponding to the project information is obtained;

[0099] Batch operations are performed on the codes of each of the code repositories according to the target branch strategy, and the batch operations include a merge operation, a create operation, a lock operation, and a delete operation.

[0100] Optionally, the branch strategy generating device further includes a risk assessment module, which is used to:

[0101] Collecting branch dynamic information of the target branch strategy, wherein the branch dynamic information includes release frequency, version conflict information, and parallel development information;

[0102] The branch dynamic information is sent to a pre-trained analysis and decision model, and a risk assessment is performed on the target branch strategy to determine the risk value of the target branch strategy.

[0103] Optionally, the risk assessment module is further used to:

[0104] If the risk value is greater than a preset risk threshold, a warning prompt message is output, and a recommended strategy is determined using the decision analysis model;

[0105] When a policy adjustment instruction is detected, the target branch policy is adjusted using the recommended policy, and the step of collecting branch dynamic information of the target branch policy is returned and executed until the risk value is less than or equal to a preset risk threshold.

[0106] Optionally, the branch strategy generating device further includes a template generating module, which is used to:

[0107] A new branch policy template is generated based on the target branch policy and saved.

[0108] In addition, an embodiment of the present invention further provides a computer-readable storage medium, on which a branch strategy generation program is stored. When the branch strategy generation program is executed by a processor, the operations in the branch strategy generation method provided in the above embodiment are implemented.

[0109] In addition, an embodiment of the present invention further provides a computer program product, including a computer program, which implements the operations in the branch strategy generation method provided in the above embodiment when the computer is executed by a processor.

[0110] The various embodiments of the device, computer program product, and computer-readable storage medium of the present invention may all refer to the various embodiments of the branch strategy generation method of the present invention, and will not be described in detail here.

[0111] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity / operation / object from another entity / operation / object, and do not necessarily require or imply any such actual relationship or order between these entities / operations / objects; the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0112] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment. The device embodiment described above is only illustrative, and the units described as separate components may or may not be physically separated. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the present invention. Those of ordinary skill in the art can understand and implement it without paying creative work.

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

[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the branch strategy generation method described in each embodiment of the present invention.

[0115] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A branch strategy generation method, characterized in that: The branch strategy generation method comprises the following steps: Obtain project information input by a user, and obtain a branch strategy template according to the project information; Creating a visual edit list corresponding to the branch strategy template, and obtaining an edit instruction of the user for the branch strategy template based on the visual edit list; Generate branch information according to the editing instruction, perform batch branch operations according to the branch information, and generate a target branch strategy; Collecting branch dynamic information of the target branch strategy, wherein the branch dynamic information includes release frequency, version conflict information, and parallel development information; Sending the branch dynamic information to a pre-trained analysis and decision model, performing risk assessment on the target branch strategy, and determining the risk value of the target branch strategy; If the risk value is greater than a preset risk threshold, a warning message is output, and a recommended strategy is determined using the analysis and decision model; When a policy adjustment instruction is detected, the target branch policy is adjusted using the recommended policy, and the step of collecting branch dynamic information of the target branch policy is returned and executed until the risk value is less than or equal to a preset risk threshold.

2. The branch strategy generation method according to claim 1, characterized in that: The step of performing batch branch operations according to the branch information and generating a target branch strategy includes: Creating and merging code branches in batches according to the branch information to generate a first branch strategy, wherein the branch information includes a branch type, a branch name, a starting flow direction of the branch, and a synchronization branch of each of the code branches in the first branch strategy; The hierarchical configuration information of the first branch strategy is obtained, and the policy hierarchy of the first branch strategy is configured according to the hierarchical configuration information to generate a target branch strategy, wherein the policy hierarchy includes a warehouse level and a team level.

3. The branch strategy generation method according to claim 2, characterized in that: After the step of performing batch branch operations according to the branch information and generating a target branch strategy, the method further includes: When a project transfer instruction is detected, each code repository under the project corresponding to the project information is obtained; Batch operations are performed on the codes of each of the code repositories according to the target branch strategy, and the batch operations include a merge operation, a create operation, a lock operation, and a delete operation.

4. The branch strategy generation method according to claim 1, characterized in that: After the step of performing batch branch operations according to the branch information and generating a target branch strategy, the method further includes: A new branch policy template is generated based on the target branch policy and saved.

5. The branch strategy generation method according to claim 1, characterized in that: The step of obtaining the project information input by the user and obtaining the branch strategy template according to the project information includes: Determine a code repository associated with a project corresponding to the project information; Determine the branch policy information used by each of the code repositories, and determine and obtain a branch policy template based on the branch policy information.

6. A branch strategy generation device, characterized in that: The branch strategy generating device comprises: A template acquisition module is used to acquire project information input by a user and acquire a branch strategy template according to the project information; A template editing module, used to create a visual editing list corresponding to the branch strategy template, and obtain the user's editing instruction for the branch strategy template based on the visual editing list; A strategy generation module is used to generate branch information according to the editing instruction, perform batch branch operations according to the branch information, generate a target branch strategy, and collect branch dynamic information of the target branch strategy, wherein the branch dynamic information includes release frequency, version conflict information and parallel development information, send the branch dynamic information to a pre-trained analysis and decision model, perform risk assessment on the target branch strategy, determine the risk value of the target branch strategy, output warning prompt information if the risk value is greater than a preset risk threshold, and use the analysis and decision model to determine a recommended strategy. When a strategy adjustment instruction is detected, the target branch strategy is adjusted using the recommended strategy, and the step of collecting the branch dynamic information of the target branch strategy is returned and executed until the risk value is less than or equal to the preset risk threshold.

7. A terminal device, characterized in that: The terminal device comprises: a memory, a processor, and a branch strategy generation program stored in the memory and executable on the processor, wherein the branch strategy generation program implements the steps of the branch strategy generation method according to any one of claims 1 to 5 when executed by the processor.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a branch strategy generation program, and when the branch strategy generation program is executed by a processor, the steps of the branch strategy generation method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Branch management method and device for software development, electronic equipment and medium

    CN113687859A