Code branch merging method and device and electronic equipment
By using an interactive interface for selection and automated code merging, the inefficiency of traditional code merging methods is solved, achieving efficient and accurate multi-branch code management.
Patent Information
- Application Number
- CN202511107134.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-07
- Publication Date
- 2025-11-14
AI Technical Summary
Traditional code merging methods rely on manual operations, which are inefficient and prone to errors, making it difficult to meet the needs of managing multiple branches of code in large projects.
This provides a code branch merging method that allows users to select candidate projects, source branch types, and intermediate branch types through an interactive interface, and automatically merges code branches. It supports custom slot functionality and merging result log generation to adapt to different project needs.
It improves the efficiency and accuracy of code merging, reduces human error, supports batch operations, and meets the multi-branch management needs of large projects.
Smart Images

Figure CN120950118A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and more specifically, to a method, apparatus and electronic device for merging code branches. Background Technology
[0002] In software development, code merging is an indispensable part of iterative development. As projects grow in size and development teams expand, the need for merging multi-branch code becomes increasingly frequent. However, traditional code merging methods rely primarily on manual operation for each project individually. This approach is not only inefficient but also prone to errors due to human factors. For example, at each iteration deployment, operators need to manually merge the code from multiple projects, which not only fails to quickly complete batch merging operations but also makes it difficult to guarantee the accuracy of code merging. Summary of the Invention
[0003] In view of the above problems, this application proposes a code branch merging method, apparatus, and electronic device to improve the efficiency of code merging. The specific solution is as follows:
[0004] Firstly, a method for merging code branches is provided, including:
[0005] In response to a trigger command, a first interactive interface is displayed. The first interactive interface includes a candidate item selection control, a source branch type selection control, and an intermediate branch type selection control. The candidate item selection control provides a set of candidate items, which contains more than one candidate item. The source branch type selection control provides at least one type of branch to be merged. The intermediate branch type selection control provides at least one type of branch to be merged.
[0006] In response to the user's operation on the first interactive interface, determine at least one target item selected by the user in the candidate item set, determine the source branch type selected by the user in the source branch type selection control, and determine the intermediate branch type selected by the user in the intermediate branch type selection control;
[0007] In response to the merge instruction, the first code branch of the source branch type and the second code branch of the intermediate branch type under the target project are obtained, and the first code branch is merged into the second code branch.
[0008] In one possible design, in another implementation of the first aspect of the embodiments of this application, the first interactive interface further includes a target branch type selection control, wherein the target branch type selection control provides at least one type of branch to be merged;
[0009] After responding to the user's action on the first interactive interface and before responding to the merge instruction, the method further includes:
[0010] Determine the target branch type selected by the user in the target branch type selection control;
[0011] Following the response to the merge instruction, the following is also included:
[0012] Obtain the third code branch of the target branch type under the target project;
[0013] Accordingly, after merging the first code branch into the second code branch, the process also includes:
[0014] The second code branch is merged into the third code branch.
[0015] In one possible design, in another implementation of the first aspect of the embodiments of this application, the candidate item selection control also provides an item select all selection control;
[0016] Determining at least one target item selected by the user from the candidate item set includes:
[0017] Determine whether the user has triggered the "select all" control. If so, select all items in the candidate item set as the target item.
[0018] If not, the project selected by the user from the candidate project set will be the target project.
[0019] In one possible design, in another implementation of the first aspect of the embodiments of this application, the source branch type selection control is further provided with a first custom slot, and the intermediate branch type selection control is further provided with a second custom slot;
[0020] Determining the source branch type selected by the user in the source branch type selection control, and determining the intermediate branch type selected by the user in the intermediate branch type selection control, includes:
[0021] Obtain the branch type input by the user in the first custom slot and use it as the source branch type; and obtain the branch type input by the user in the second custom slot and use it as the intermediate branch type.
[0022] In one possible design, in another implementation of the first aspect of the embodiments of this application, the target branch type selection control is provided with a third custom slot;
[0023] Determine the target branch type selected by the user in the target branch type selection control, including:
[0024] Obtain the branch type input by the user in the third custom slot and use it as the target branch type.
[0025] In one possible design, another implementation of the first aspect of the embodiments of this application further includes:
[0026] Generate a merge result log, which includes the number of target projects and the merge path of at least one of the target projects.
[0027] In one possible design, in another implementation of the first aspect of the embodiments of this application, the merge result log further includes any one or more of the following: merge time, user name, number of successes, number of failures, and reason for failure. The reason for failure includes any one of the following: branch does not exist, merge conflict, and target project does not exist.
[0028] In one possible design, in another implementation of the first aspect of the embodiments of this application, the first interactive interface is configured based on Jenkins tools.
[0029] Secondly, a code branch merging device is provided, including:
[0030] An interactive interface display unit is used to respond to a trigger command and display a first interactive interface, which includes a candidate item selection control, a source branch type selection control, and an intermediate branch type selection control. The candidate item selection control provides a set of candidate items, which contains more than one candidate item. The source branch type selection control provides at least one type of branch to be merged. The intermediate branch type selection control provides at least one type of branch to be merged.
[0031] The project and branch type determination unit is configured to, in response to a user's operation on the first interactive interface, determine at least one target project selected by the user in the candidate project set, determine the source branch type selected by the user in the source branch type selection control, and determine the intermediate branch type selected by the user in the intermediate branch type selection control.
[0032] A code branch merging unit is configured to, in response to a merge instruction, obtain a first code branch of the source branch type and a second code branch of the intermediate branch type under the target project, and merge the first code branch into the second code branch.
[0033] Thirdly, an electronic device is provided, comprising: a memory and a processor;
[0034] The memory is used to store programs;
[0035] The processor is configured to execute the program to implement the various steps of the code branch merging method described in any of the preceding first aspects of this application.
[0036] By employing the aforementioned technical solution, an interactive interface is displayed in response to trigger commands, allowing users to intuitively select candidate projects, source branch types, and intermediate branch types. This provides a clear operation path, reduces the complexity of user operations, and improves the user experience. The candidate project set contains multiple candidate projects, and the source branch type and intermediate branch type selection controls offer various branch types for users to choose from, thus adapting to different project needs and branch structures. This demonstrates strong dynamism and adaptability, meeting diverse code management scenarios. Users can flexibly select target projects and branch types through the interactive interface, and merge code branches using merge commands after the operation is complete. This avoids the tediousness of manual operations in traditional code management, reduces human error, improves the efficiency and accuracy of code merging, and supports batch selection of multiple target projects for merging operations, meeting the needs of multi-branch management in large projects. Attached Figure Description
[0037] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0038] Figure 1 A flowchart illustrating a code branch merging method provided in an embodiment of this application;
[0039] Figure 2 A flowchart illustrating another code branch merging method provided in an embodiment of this application;
[0040] Figure 3 A schematic diagram of a first interactive interface provided in an embodiment of this application;
[0041] Figure 4 A schematic diagram of a code branch merging device provided in an embodiment of this application;
[0042] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0043] Before introducing the proposed solution, let's first explain the English terms used in this document:
[0044] Jenkins: An open-source automation server widely used in continuous integration (CI) and continuous delivery (CD) processes. Originally developed by Kohsuke Kawaguchi and released in 2011, it has become one of the most popular CI / CD tools in the global developer community. Jenkins' core functionality is automating repetitive tasks in the software development process, such as code building, testing, and deployment. It can seamlessly integrate with various version control systems (such as Git, Subversion, etc.) and monitor codebase changes in real time.
[0045] Branches: In software development, branches are an important mechanism in version control systems (such as Git) used to isolate and manage code development. They allow developers to create independent development environments outside the main codebase (usually called the main branch, such as main or master) to develop new features, fix defects, or make experimental improvements without affecting the stability and usability of the main codebase. A branch creates a copy of the current code's state, on which developers can freely modify, commit, and test. Once the development work on the branch is complete and passes testing, the changes can be merged back into the main branch or other target branches, thus enabling code updates and iterations.
[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0047] This application provides a code branch merging method where users trigger the code merging process through an interactive interface. This interface provides candidate project selection controls, source branch type selection controls, and intermediate branch type selection controls. The candidate project selection controls display a collection of multiple candidate projects, while the source branch type selection controls and intermediate branch type selection controls provide options for the type of the branch to be merged. When the user operates on the interface, the target project, source branch type, and intermediate branch type are determined based on the user's selection. When the user issues a merge command, the source branch code and intermediate branch code under the target project are automatically retrieved, and the source branch code is merged into the intermediate branch. This not only achieves efficient batch merging of code but also reduces manual intervention through automation, lowers the probability of errors, and improves the efficiency and reliability of merging multiple branches and multiple projects.
[0048] The proposed solution can be implemented based on a terminal with data processing capabilities, such as a mobile phone, computer, or server.
[0049] Next, please refer to Figure 1 , Figure 1 This is a flowchart illustrating a code branch merging method provided in an embodiment of this application. The code branch merging method of this application can be implemented through a code branch merging system deployed on a terminal, and specifically includes the following steps:
[0050] Step S100: In response to the trigger command, the first interactive interface is displayed.
[0051] Specifically, when a user triggers a code merge operation, an interactive interface, known as the first interactive interface, can be displayed. This first interactive interface provides the user with a series of operation controls to guide them through the preparatory work for the code merge. The interface may include candidate item selection controls, source branch type selection controls, and intermediate branch type selection controls.
[0052] The candidate project selection control displays a set of candidate projects, containing one or more projects. Users can select the target project for code merging based on their needs. The source branch type selection control and the intermediate branch type selection control each provide at least one type option for the branch to be merged, allowing users to select the type of the source branch and intermediate branch, respectively. These controls enable users to clearly specify the scope and target of the code merging, laying the foundation for subsequent code merging operations.
[0053] Step S110: In response to the user's operation on the first interactive interface, determine at least one target item selected by the user, determine the source branch type selected by the user, and determine the intermediate branch type selected by the user.
[0054] Specifically, when a user operates on the first interactive interface, the merge branch and target project can be confirmed based on the user's input and selection. At least one target project selected by the user from the candidate project set can be identified. The target project is selected from multiple candidate projects provided on the interface and is the specific project the user wishes to merge. The source branch type selected by the user in the source branch type selection control can be determined, specifying the starting code branch for the merge, i.e., the branch from which the user wants to pull code for merging. The intermediate branch type selected by the user in the intermediate branch type selection control can be confirmed, i.e., the branch from which the user wants to merge the code from the source branch type. Through user operations, the project the user intends to merge, the source branch type, and the intermediate branch type can be identified, thus providing clear instructions and parameters for the subsequent automated code merging process.
[0055] Step S120: In response to the merge instruction, obtain the first code branch of the source branch type and the second code branch of the intermediate branch type under the target project, and merge the first code branch into the second code branch.
[0056] Specifically, once the user selects the project and branch in the interactive interface and triggers the merge command, the code merging process can be started automatically. Based on the target project specified by the user, a first code branch corresponding to the source branch type selected by the user will be retrieved, as well as a second code branch of the intermediate branch type specified by the user within the target project.
[0057] Then, a merge operation is performed to merge the code branch in the first code branch into the second code branch, thereby achieving efficient and automated code merging functionality.
[0058] This embodiment displays an interactive interface in response to trigger commands, allowing users to intuitively select candidate projects, source branch types, and intermediate branch types. This provides a clear operation path, reduces the complexity of user operations, and improves the user experience. The candidate project set contains multiple candidate projects, and the source branch type and intermediate branch type selection controls offer various branch types for users to choose from, thus adapting to different project needs and branch structures. It exhibits strong dynamism and adaptability, meeting diverse code management scenarios. Users can flexibly select target projects and branch types through the interactive interface, and merge code branches using merge commands after the operation is complete. This avoids the tediousness of manual operations in traditional code management, reduces human error, improves the efficiency and accuracy of code merging, and supports batch selection of multiple target projects for merging operations, meeting the needs of multi-branch management in large projects.
[0059] Furthermore, in some embodiments of this application, the user can also select a target branch, see [link to relevant documentation]. Figure 2 , Figure 2 This is a flowchart illustrating another code branch merging method provided in an embodiment of this application. The following section describes this part.
[0060] Step S200: In response to the trigger command, the first interactive interface is displayed.
[0061] Specifically, when a user triggers a code merge operation, a first interactive interface can be displayed to guide the user through the preparation work for the code merge, so as to meet the user's needs for project and branch selection during the code merge process.
[0062] See Figure 3 , Figure 3This illustration shows a first interactive interface provided in an embodiment of the present application. The first interactive interface may include a candidate item selection control, a source branch type selection control, an intermediate branch type selection control, and a target branch type selection control. Users can freely choose the order of operations according to their needs and habits, and the system can respond in real time and record the user's selection.
[0063] The candidate project selection control provides a collection of multiple candidate projects from which users can select one or more target projects for code merging. These projects can be software modules undergoing iterative development or multiple subsystems requiring synchronized code changes. Users can select projects in any order, either first or later. Each candidate project can be labeled with its name and relevant information for easy identification and selection.
[0064] The source branch type selection control, intermediate branch type selection control, and target branch type selection control each provide at least one type option for the branch to be merged. Users can select the source branch type, intermediate branch type, and target branch type according to their actual needs. Regardless of whether the user selects the source branch type first or specifies the target branch type first, the logic of the merge process can be dynamically adjusted based on the user's final selection.
[0065] The source branch type selection control provides at least one option for the type of the branch to be merged. Users can choose the source branch type from these options; it represents the starting branch for the code merge, i.e., the branch from which the user wants to pull code for the merge. The source branch type can contain newly developed features or bug fixes and forms the basis of the merge operation. The intermediate branch type selection control also provides at least one option for the type of the branch to be merged. Users can select an intermediate branch type, which can serve as a transition during the code merge process. Intermediate branches can be used to temporarily store the merged code. If the user does not select a target branch type, the intermediate branch can be the final destination for the code merge, allowing for further testing or processing to ensure code quality and stability. The target branch type selection control also provides at least one option for the type of the branch to be merged. Users can use this control to select the target branch type; it can be the final destination for the code merge, and the merged code will be pushed to this branch for subsequent deployment or release.
[0066] Alternatively, at least one of the source branch type selection controls, intermediate branch type selection controls, and target branch type selection controls may include type options for the branch to be merged, such as development branch, feature branch, fix branch, version branch, and main branch. Below are examples of source branch types, intermediate branch types, and target branch types:
[0067] Development Branch: The development branch is the main branch where team members carry out their daily development work. It typically contains the latest feature development, fixes, and improvements.
[0068] Feature Branch: A feature branch is a branch created specifically for developing new features. It is derived from a development branch or the main branch and is used to independently develop a specific feature.
[0069] Fix Branch: A fix branch is used to fix discovered defects or issues. It is usually derived from the main branch or development branch and focuses on resolving specific bugs or vulnerabilities.
[0070] Temporary Branch: A temporary branch is a branch used for short-term tasks, such as experimental development or quick fixes. It may contain code changes that have not yet been fully validated.
[0071] Release Branch: A release branch is used to prepare an upcoming software release. It contains the features and fixes to be released and is usually rigorously tested.
[0072] Main / Master Branch: The main branch is the core branch of the project and usually contains stable, releasable code.
[0073] Experimental Branch: An experimental branch is used to explore new technologies or development directions, and usually contains code that is not yet mature.
[0074] User Story Branch: A user story branch is a branch created to implement a specific user story. It focuses on the development of features required to complete a user story.
[0075] The choice of source branch type, target branch type, and intermediate branch type can depend on the specific needs and branch management strategy of the development team. It can be a development branch, feature branch, fix branch, version branch, or even the main branch itself. Users can freely select candidate branches, source branches, intermediate branches, and target branches according to the actual needs and development process of the project, thereby achieving efficient and accurate code merging operations.
[0076] Step S210: In response to the user's operation on the first interactive interface, determine at least one target item selected by the user, determine the source branch type selected by the user, determine the intermediate branch type selected by the user, and determine the target branch type selected by the user.
[0077] Optionally, when a user interacts with the primary interface, each selection can be recorded in real time to ensure the accuracy and efficiency of the code merging operation. The system can determine the target project selected by the user from the candidate project set, as well as the source branch type selected by the user in the source branch type selection control, the intermediate branch type selected by the intermediate branch type selection control, and the target branch type selected by the target branch type selection control. Regardless of the order in which the user selects, this information is accurately recorded and processed, providing clear instructions and parameters for subsequent code merging operations. This flexible and efficient design makes the code merging process more automated and reliable, and significantly improves development efficiency.
[0078] Step S220: In response to the merge instruction, obtain the first code branch of the source branch type and the second code branch of the intermediate branch type under the target project, obtain the third code branch of the target branch type under the target project, merge the first code branch into the second code branch, and merge the second code branch into the third code branch.
[0079] Once the user completes their selection and triggers the merge command in the interactive interface, the code merging process can be automatically initiated. First, based on the target project specified by the user in the first interactive interface, a first code branch corresponding to the source branch type selected by the user can be obtained. Simultaneously, a second code branch of the intermediate branch type specified by the user under the target project can also be obtained, as well as a third code branch of the target branch type specified by the user under the target project.
[0080] Then, the first merge operation can be performed, merging the code from the first code branch into the second code branch. After the merge is complete, the second code branch will contain the updated code. The code from the second code branch can then be merged into the third code branch. This ensures a smooth transition of code from the development environment to the production environment, and by using a step-by-step merging approach, it reduces the risks that might arise from directly merging into the target branch.
[0081] This embodiment further optimizes the code merging process by introducing a target branch type selection control, significantly improving the flexibility and security of code management. The phased merging strategy not only reduces the risks associated with directly merging to the target branch but also provides the development team with more verification opportunities, ensuring code quality and stability. Furthermore, the dynamic selection of the target branch type further enhances this advantage, allowing users to flexibly push code to the most suitable branch based on different project stages and needs.
[0082] Furthermore, in some embodiments of this application, the candidate item selection control also provides an item selection control, which will be described in detail below.
[0083] To further improve the efficiency and convenience of user operations, the candidate item selection control also provides a "select all" selection control; see [link / reference]. Figure 3 , Figure 3 This is a schematic diagram of a first interactive interface provided in an embodiment of this application, which allows users to quickly select all items in the candidate item set through a simple operation, thereby achieving the purpose of batch merging code.
[0084] When a user interacts with the primary interface, it can be determined whether the user has triggered the "Select All" control. If the user selects all, all projects in the candidate project set can be used as the target project, thus saving the user the tedious step of selecting projects one by one. This is suitable for scenarios that require unified code merging of multiple projects, such as during version iteration or cross-project code synchronization, and can significantly improve operational efficiency.
[0085] This embodiment introduces a project selection control, which not only provides a flexible way to select projects, but also simplifies the user's workflow through batch operations, making the code merging process more automated and efficient. It fully considers the needs of development teams in their actual work and provides strong support for batch code merging.
[0086] Furthermore, in some embodiments of this application, to further enhance the flexibility and personalization needs of users during the code merging process, custom slot functionality can be provided for the source branch type selection control, intermediate branch type selection control, and target branch type selection control. See [link to relevant documentation]. Figure 3 The following section will provide a detailed introduction to this part.
[0087] Specifically, the source branch type selection control provides a first custom slot where users can enter a custom branch name. The system can retrieve the branch type entered by the user in the first custom slot and use it as the source branch type. This allows users to not only select preset branch types (such as development branches, feature branches, etc.) but also enter specific branch names based on actual needs, such as temporary branches created for a specific function or fix.
[0088] Similarly, the intermediate branch type selection control can also provide a second custom slot. Users can enter a custom intermediate branch type in the second custom slot and use it as the intermediate branch type. Intermediate branch types can play a transition and verification role during code merging. By allowing users to customize intermediate branch types, it can better support complex development processes and multi-stage code verification needs. For example, users can create an intermediate branch specifically for integration testing, or specify different intermediate branches for different environments (such as development and testing environments).
[0089] Furthermore, the target branch type selection control can also provide a third custom slot. Users can enter the target branch type in this third custom slot, which will then be used as the target branch type. By providing custom slots, users can flexibly specify the target branch according to the project's release strategy or version management needs. For example, users can create independent target branches for different version releases, or specify different target branches for specific deployment environments (such as production and pre-production environments). Not all selection controls need to have custom slot functionality; they can be flexibly configured according to specific needs.
[0090] This embodiment introduces a custom slot feature, which not only meets the development team's needs for flexibility and personalization during code merging, but also adapts to diverse development processes and branch management strategies. Users can freely define source branches, intermediate branches, and target branches according to the actual needs of the project, thereby achieving more efficient and precise code merging operations, significantly improving the adaptability and practicality of code merging, and providing strong support for development teams.
[0091] Furthermore, in some embodiments of this application, to ensure the transparency and traceability of the code merging process, a detailed merging result log can be generated. This section will be described in detail below.
[0092] Specifically, the merge result log can include the number of target projects, which is the total number of projects selected by the user in the first interactive interface for code merging. In addition, the log will also record the merge path of the target projects, that is, the path from the source branch to the intermediate branch, or the complete path from the source branch to the intermediate branch and then to the target branch, to help users intuitively understand the merge process of each project and the branches involved.
[0093] Alternatively, the merge result log can include more information to meet users' traceability needs for the merge process. For example, the merge result log can record the execution time of the merge operation, making it easy for users to track the completion status of the merge task. The merge result log can also record the name of the user who performed the merge operation, ensuring traceability and clear accountability. The merge result log supports highlighting and timestamp recording, allowing users to quickly locate problems and view operation history. It can also add the builder's name for easier traceability and management.
[0094] Optionally, to provide an overall overview of the merge operation, the merge result log can also count the number of successfully merged projects and the number of failed projects. For failed merge operations, the reasons for failure can be recorded to help users quickly locate the problem and take appropriate measures. Reasons for failure may include, but are not limited to, non-existent branches (e.g., the source branch type, intermediate branch type, or target branch type specified by the user is not found in the target project's codebase), merge conflicts (conflicts exist between code changes that cannot be automatically resolved), and non-existent target projects (the project selected by the user is not found in the candidate project set). Even if some projects fail to merge, the merge operation of other projects will continue to be executed, and the entire process will not be interrupted by the failure of a single project.
[0095] This embodiment generates a merge result log that includes the number of target projects, merge path, merge time, user name, number of successful merges, number of failed merges, and reasons for failures. This not only provides users with a comprehensive record of the merge operation but also significantly improves troubleshooting efficiency through failure reason analysis. This makes the code merging process more transparent and reliable, while also providing strong support for the development team's continuous improvement and optimization.
[0096] Furthermore, in some embodiments of this application, not only can detailed merge result logs be generated, but the merge results can also be sent to instant messaging software to achieve automatic reminders.
[0097] Specifically, once the code merging process is complete, the merge results can be formatted into a message or file and sent to designated recipients or groups via pre-configured instant messaging software. Recipients can be the development team leader, duty manager, or the entire development team, ensuring that relevant personnel are informed of the merging operation's progress immediately.
[0098] The merge result information sent can include key merge data, such as the number of target projects, the number of successful and failed projects, the merge path, the reason for failure (e.g., non-existent branch, merge conflict, etc.), and the username and specific time of the user who performed the merge operation. This not only provides team members with an overview of the merge operation but also helps them quickly identify potential problems and take appropriate action.
[0099] This embodiment significantly improves the collaboration efficiency and response speed of the development team by sending the merge results to instant messaging software. Team members do not need to actively log in to the system to check logs; they can receive the latest merge status alerts through instant messaging software. This not only reduces the tedious steps of manual inspection but also ensures timely information delivery, enabling the team to manage and optimize the code merging process more efficiently.
[0100] Furthermore, in some embodiments of this application, a role-based permission configuration function can be provided to ensure the security of the code merging process and the accuracy of permission management. This allows system administrators or project leaders to assign different operation permissions to different users based on the responsibilities and needs of team members, thereby ensuring that each user can only perform operations within their authorized scope. This section will be described in detail below.
[0101] Specifically, the role-based permission configuration function can achieve the following:
[0102] 1. User Role Definition: Allows the definition of multiple user roles, such as administrator, project manager, developer, tester, etc., with each role corresponding to different operation permissions.
[0103] 2. Permission Assignment: Based on the user's role, corresponding permissions can be assigned. For example, administrators can configure and manage the entire merge process, project managers can approve and trigger merge operations, and developers can execute specific merge tasks.
[0104] 3. Operation Restrictions: By configuring role permissions, users can be restricted from performing certain sensitive or critical operations. For example, only administrators can modify merge policies or access merge logs, while ordinary developers can only perform merge operations.
[0105] 4. Security Audit: Role-based access control configuration also helps with security auditing because each operation is associated with a specific user role, and the executor and execution time of each operation can be recorded so that traceability can be carried out when problems occur.
[0106] This embodiment, by introducing role-based permission configuration, not only ensures the security of the code merging process but also improves operational accuracy and team collaboration efficiency. Each team member can freely perform operations within their authorized scope without worrying about insufficient permissions or exceeding authorized limits. This makes the code merging process more orderly and efficient, and adaptable to the diverse needs of different teams and projects.
[0107] Furthermore, in some embodiments of this application, the first interactive interface can be configured using the Jenkins tool. Through the flexible configuration of the Jenkins tool, the first interactive interface can not only meet the development team's basic needs for code merging operations, but also provide customized support according to specific scenarios. This flexible design allows the development team to maintain efficient operation while flexibly adjusting the code merging process according to the actual needs of the project, further improving development efficiency and code management flexibility.
[0108] The code branch merging apparatus provided in the embodiments of this application is described below. The code branch merging apparatus described below and the code branch merging method described above can be referred to in correspondence.
[0109] See Figure 4 , Figure 4 This is a schematic diagram of a code branch merging device provided in an embodiment of this application.
[0110] like Figure 4 As shown, the device may include:
[0111] The interactive interface display unit 11 is used to display a first interactive interface in response to a trigger command. The first interactive interface includes a candidate item selection control, a source branch type selection control, and an intermediate branch type selection control. The candidate item selection control provides a set of candidate items, which contains more than one candidate item. The source branch type selection control provides at least one type of branch to be merged. The intermediate branch type selection control provides at least one type of branch to be merged.
[0112] The project and branch type determination unit 12 is configured to, in response to the user's operation on the first interactive interface, determine at least one target project selected by the user in the candidate project set, determine the source branch type selected by the user in the source branch type selection control, and determine the intermediate branch type selected by the user in the intermediate branch type selection control.
[0113] The code branch merging unit 13 is used to respond to a merge instruction to obtain a first code branch of the source branch type and a second code branch of the intermediate branch type under the target project, and merge the first code branch into the second code branch.
[0114] In one possible implementation, the first interactive interface further includes a target branch type selection control, which provides at least one type of branch to be merged. After the project and branch type determination unit 12 processes the response to the user's operation on the first interactive interface, and before the code branch merging unit 13 processes the operation, the interface further includes:
[0115] The target branch type determination unit is used to determine the target branch type selected by the user in the target branch type selection control;
[0116] After the code branch merging unit 13 processes the response to the merge instruction, it also includes:
[0117] The third code branch acquisition unit is used to acquire the third code branch of the target branch type under the target project;
[0118] After the code branch merging unit 13 processes the merging of the first code branch into the second code branch, the process further includes:
[0119] The third code branch merging unit is used to merge the second code branch into the third code branch.
[0120] In one possible implementation, the candidate item selection control also provides a select all item selection control; the process by which the item and branch type determination unit 12 determines at least one target item selected by the user from the candidate item set includes:
[0121] Determine whether the user has triggered the "select all" control. If so, select all items in the candidate item set as the target item.
[0122] If not, the project selected by the user from the candidate project set will be the target project.
[0123] In one possible implementation, the source branch type selection control also provides a first custom slot, and the intermediate branch type selection control also provides a second custom slot; the process of determining the source branch type selected by the user in the source branch type selection control, and determining the intermediate branch type selected by the user in the intermediate branch type selection control, includes:
[0124] Obtain the branch type input by the user in the first custom slot and use it as the source branch type; and obtain the branch type input by the user in the second custom slot and use it as the intermediate branch type.
[0125] One possible implementation is that the target branch type selection control provides a third custom slot;
[0126] The process by which the target branch type determination unit determines the target branch type selected by the user in the target branch type selection control includes:
[0127] Obtain the branch type input by the user in the third custom slot and use it as the target branch type.
[0128] One possible implementation, according to an embodiment of this application, of a code branch merging apparatus, further includes:
[0129] The merge result log generation unit is used to generate a merge result log, which includes the number of target projects and the merge path of at least one of the target projects.
[0130] In one possible implementation, the merge result log may also include any one or more of the following: merge time, username, number of successes, number of failures, and reason for failure, wherein the reason for failure includes any one of the following: branch does not exist, merge conflict, and target project does not exist.
[0131] One possible implementation is that the first interactive interface is configured based on Jenkins tools.
[0132] This application also provides an electronic device in its embodiments. (See reference...) Figure 5 The diagram illustrates a structural schematic suitable for implementing the electronic device in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, tablets, wearable devices, etc. Figure 5 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0133] like Figure 5 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603 to implement the code branch merging method of the foregoing embodiments of this application. When the electronic device is powered on, the RAM 603 also stores various programs and data required for the operation of the electronic device. The processing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0134] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, memory cards, hard drives, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0135] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0136] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0137] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
Claims
1. A code branch merging method, characterized in that, include: In response to a trigger command, a first interactive interface is displayed. The first interactive interface includes a candidate item selection control, a source branch type selection control, and an intermediate branch type selection control. The candidate item selection control provides a set of candidate items, which contains more than one candidate item. The source branch type selection control provides at least one type of branch to be merged. The intermediate branch type selection control provides at least one type of branch to be merged. In response to the user's operation on the first interactive interface, determine at least one target item selected by the user in the candidate item set, determine the source branch type selected by the user in the source branch type selection control, and determine the intermediate branch type selected by the user in the intermediate branch type selection control; In response to the merge instruction, the first code branch of the source branch type and the second code branch of the intermediate branch type under the target project are obtained, and the first code branch is merged into the second code branch.
2. The method according to claim 1, characterized in that, The first interactive interface also includes a target branch type selection control, which provides at least one type of branch to be merged; After responding to the user's action on the first interactive interface and before responding to the merge instruction, the method further includes: Determine the target branch type selected by the user in the target branch type selection control; Following the response to the merge instruction, the following is also included: Obtain the third code branch of the target branch type under the target project; Accordingly, after merging the first code branch into the second code branch, the process also includes: The second code branch is merged into the third code branch.
3. The method according to claim 1, characterized in that, The candidate item selection control also provides an all-selection control; Determining at least one target item selected by the user from the candidate item set includes: Determine whether the user has triggered the "Select All" control. If so, select all items in the candidate item set as the target item. If not, the project selected by the user from the candidate project set will be the target project.
4. The method according to claim 1, characterized in that, The source branch type selection control also provides a first custom slot, and the intermediate branch type selection control also provides a second custom slot; Determining the source branch type selected by the user in the source branch type selection control, and determining the intermediate branch type selected by the user in the intermediate branch type selection control, includes: Obtain the branch type input by the user in the first custom slot and use it as the source branch type; and obtain the branch type input by the user in the second custom slot and use it as the intermediate branch type.
5. The method according to claim 2, characterized in that, The target branch type selection control provides a third custom slot; Determine the target branch type selected by the user in the target branch type selection control, including: Obtain the branch type input by the user in the third custom slot and use it as the target branch type.
6. The method according to claim 1, characterized in that, Also includes: Generate a merge result log, which includes the number of target projects and the merge path of at least one of the target projects.
7. The method according to claim 6, characterized in that, The merge result log also includes any one or more of the following: merge time, username, number of successes, number of failures, and reason for failure. The reason for failure includes any one of the following: branch does not exist, merge conflict, and target project does not exist.
8. The method according to any one of claims 1-7, characterized in that, The first interactive interface was configured using Jenkins tools.
9. A code branch merging device, characterized in that, include: An interactive interface display unit is used to respond to a trigger command and display a first interactive interface, which includes a candidate item selection control, a source branch type selection control, and an intermediate branch type selection control. The candidate item selection control provides a set of candidate items, which contains more than one candidate item. The source branch type selection control provides at least one type of branch to be merged. The intermediate branch type selection control provides at least one type of branch to be merged. The project and branch type determination unit is configured to, in response to a user's operation on the first interactive interface, determine at least one target project selected by the user in the candidate project set, determine the source branch type selected by the user in the source branch type selection control, and determine the intermediate branch type selected by the user in the intermediate branch type selection control. A code branch merging unit is configured to, in response to a merge instruction, obtain a first code branch of the source branch type and a second code branch of the intermediate branch type under the target project, and merge the first code branch into the second code branch.
10. An electronic device, characterized in that, include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement each step of the code branch merging method as described in any one of claims 1 to 8.