Branch management method and device, electronic equipment and computer readable storage medium
By receiving test requests in the code compilation interface and calling branch management tools, automatically managing code branches, the problems of complexity and high error rate of code branch management in distributed version control systems are solved, and more efficient code transfer and management are achieved.
Patent Information
- Application Number
- CN202411249561.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-13
AI Technical Summary
In distributed version control systems, developers need to remember and manage tag information from multiple code branches, resulting in increased memory burden and increased possibility of code branch transfer errors.
Provides a branch management method, by receiving test requests in the code compilation interface, calling branch management tools to obtain version information in the remote code repository, establishing and saving the association relationship between the requirement name and version information, and automatically incorporating the code into the target test branch. Simplify the management process of branch code.
It reduces the memory burden of developers, reduces the problems of branch code transfer disorders and errors, and improves the efficiency and accuracy of code management.
Smart Images

Figure CN119127702A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a branch management method, device, electronic device and computer-readable storage medium. Background Art
[0002] As computer software is used in more and more scenarios, the amount of code involved in software is increasing to meet the growing demand for use and to ensure the user experience. The development and maintenance of software code are facing challenges. At present, distributed version control systems can facilitate developers to track and manage code versions and enable collaboration between different developers.
[0003] However, in the face of gradually growing software projects, each developer may need to deal with the development tasks of one or more code branches, and each development task also involves necessary processes such as development, testing and merging. Based on the current distributed version control system, there is no unified specification for the marking information of each code branch. When transferring code branches, developers not only need to remember the marking information of the code branches they are responsible for, but also need to call the code multiple times before they can transfer the code branches to the target location. Therefore, the current management method for branch codes not only brings a memory burden to developers, but also easily leads to confusion in the transfer of code branches. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a branch management method, device, electronic device and computer-readable storage medium, which can reduce the memory burden of developers, simplify the management cost of branch codes, and effectively reduce the problem of chaotic and erroneous branch code transfer.
[0005] The embodiment of the present application provides a branch management method, which is applied to a terminal device, and the terminal is configured with a branch management tool; the method includes:
[0006] When a code compilation interface is displayed and the code compilation interface includes the code of the application requirement, a test request is received, wherein the test request includes a test command, and the code includes a development identifier and a first requirement name; in response to the test request, a branch management tool is called, and version information corresponding to each test branch in the remote code repository is obtained through the branch management tool; each version information is displayed; in response to receiving the first version information selected in the version information, an association relationship between the first requirement name and the first version information is established and saved through the branch management tool, and the code is merged into a target test branch, wherein the target test branch corresponds to the first version information.
[0007] Optionally, before receiving the test request, the method also includes: when the code compilation interface does not include the code of the application requirement, receiving a branch creation request for the application requirement based on the code compilation interface, the branch creation request includes a creation command and a first requirement name; in response to the creation command, calling a branch management tool, and creating a project development branch locally through the branch management tool, the project development branch includes a development identifier and a first requirement name; displaying the development identifier and the first requirement name on the code compilation interface to obtain the code of the application requirement compiled based on the development identifier and the first requirement name.
[0008] Optionally, the method also includes: in response to a test request, displaying at least one approval account; before merging the code into a target test branch, the method also includes: in response to receiving a target approval account selected from at least one approval account information, calling a branch management tool, and pushing a test request for the application requirement to the target approval account through the branch management tool; merging the code into the target test branch, including: obtaining feedback results from the target approval account through the branch management tool; when the feedback result from the target approval account is to allow testing, merging the code into the target test branch through the branch management tool; and establishing and saving an association relationship between the target approval account and the first requirement name.
[0009] Optionally, after the code is merged into the target test branch, the method further includes: based on the code compilation interface, receiving a branch repair request, wherein the branch repair request includes a repair command and a first requirement name; in response to the repair command, calling a branch management tool, obtaining the target version information associated with the first requirement name through the branch management tool, and creating a repair branch based on the code included in the target test branch, wherein the repair branch includes a repair identifier and a first requirement name; displaying the repair identifier and the first requirement name on the code compilation interface to obtain repair code compiled based on the repair identifier and the first requirement name.
[0010] Optionally, after merging the code into the target test branch, the method also includes: based on the code compilation interface, receiving a branch online request, wherein the branch online request includes an online command and a first requirement name; in response to the online command, calling a branch management tool, obtaining the target version information associated with the first requirement name through the branch management tool, and obtaining the code included in the project development branch; generating a branch merge request through the branch management tool, so that after the branch merge request is passed, the code included in the project development branch is merged into the main branch of the online application in the remote code repository.
[0011] Optionally, the method also includes: receiving a local branch deletion request based on displaying the code compilation interface, wherein the branch deletion request includes a second requirement name and a local branch deletion instruction; in response to the local branch deletion request, calling a branch management tool, and determining the second version information corresponding to the second requirement name through the branch management tool; when the project development branch corresponding to the second version information is found locally, deleting the project development branch corresponding to the second version information; when the test branch corresponding to the second version information is found locally, deleting the test branch corresponding to the second version information; when the repair branch corresponding to the second version information is found locally, deleting the repair branch corresponding to the second version information.
[0012] Optionally, the method also includes: receiving a remote branch deletion request based on displaying the code compilation interface, wherein the branch deletion request includes a second requirement name and a remote branch deletion instruction; in response to the remote branch deletion instruction, calling a branch management tool, and determining the second version information corresponding to the second requirement name through the branch management tool; accessing the remote code tool through the branch code tool, and deleting the project development branch corresponding to the second version information when the project development branch corresponding to the second version information is found in the remote code repository; deleting the test branch corresponding to the second version information when the test branch corresponding to the second version information is found in the remote code repository; and deleting the repair branch corresponding to the second version information when the repair branch corresponding to the second version information is found in the remote code repository.
[0013] An embodiment of the present application provides a branch management device, including: a display module, used to receive a test request when displaying a code compilation interface, and the code compilation interface includes the code of the application requirement, wherein the test request includes a test command, and the code includes a development identifier and a first requirement name; a processing module, used to call a branch management tool in response to the test command, and obtain version information corresponding to each test branch in a remote code repository through the branch management tool; the display module is also used to display each version information; the branch management tool is used to establish and save an association relationship between the first requirement name and the first version information in response to receiving the first version information selected in the version information, and merge the code into a target test branch, wherein the target test branch corresponds to the first version information.
[0014] An embodiment of the present application provides an electronic device, which includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the above method are implemented.
[0015] An embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the above method are implemented.
[0016] An embodiment of the present application provides a computer program product, which includes computer program instructions. When the computer program instructions are executed by a processor, the steps of the above method are implemented.
[0017] According to the embodiment of the present application, when a developer needs to transfer the code of the application requirement, he only needs to enter a test request in the code compilation interface including the code of the application requirement. Since the test request includes the development identification and the first requirement name, the terminal can respond to the test command in the test request, automatically call the branch management tool installed by the terminal, and obtain the version information corresponding to each test branch in the remote code repository through the branch management tool, so as to actively display the existing version information. In this way, the developer only needs to select the required version information, that is, the first version information, and the branch management tool can automatically establish and save the association between the first requirement name and the first version information, and at the same time, merge the code into the target test branch. After that, the developer only needs to enter the requirement name each time he needs to process or transfer the branch code, thereby reducing the memory burden of the developer, simplifying the management cost of the branch code, and effectively reducing the problem of confusion and error in the transfer of branch code. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following briefly introduces the drawings in the embodiments of the present application.
[0019] Figure 1 It is a schematic diagram of the system architecture of an embodiment of the present application.
[0020] Figure 2 It is a flowchart of the branch management method of an embodiment of the present application.
[0021] Figure 3 It is a structural block diagram of the branch management of the embodiment of the present application.
[0022] Figure 4 It is a schematic diagram of an electronic device used to implement the branch management method of an embodiment of the present application. DETAILED DESCRIPTION
[0023] The principles and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that the purpose of providing these embodiments is to make the principles and spirit of the present application clearer and more thorough, so that those skilled in the art can better understand and implement the principles and spirit of the present application. The exemplary embodiments provided herein are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by ordinary technicians of the art without creative work are within the scope of protection of this application.
[0024] In this document, terms such as first, second, third, etc. are only used to distinguish one entity (or operation) from another entity (or operation), but not to require or imply any order or relationship between these entities (or operations).
[0025] It should be noted that the acquisition, storage, use, and processing of data in the embodiments of the present application are in compliance with the relevant provisions of national laws and regulations.
[0026] Embodiments of the present application relate to terminal devices and / or servers. Those skilled in the art will appreciate that the embodiments of the present application may be implemented as a system, apparatus, device, method, computer-readable storage medium, or computer program product. Therefore, the present disclosure may be specifically implemented in at least one of the following forms: complete hardware, complete software, or a combination of hardware and software. According to the embodiments of the present application, the present application claims protection for a branch management method, apparatus, electronic device, and computer-readable storage medium. Figure 1 A schematic diagram of a system architecture of an embodiment of the present application is shown. Figure 1 As shown, the system includes a terminal device 102 and a server 104. The terminal device 102 may include at least one of the following: a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, various wearable devices, an augmented reality AR device, a virtual reality VR device, etc. A command terminal tool may be installed on the terminal device 102, and developers may operate on the terminal device 102 and use the command terminal tool. For example, developers may open a command terminal interaction page on the terminal device 102 and enter instructions on the command terminal interaction page. After the terminal device 102 receives the instruction entered by the developer, it responds to the information included in the instruction and executes the function corresponding to the information included in the instruction.
[0027] Exemplarily, developers can exchange information with server 104 through the command terminal interaction page displayed on terminal device 102. For example, server 104 can be used as a remote code repository. The remote code repository can include a distributed version control system that facilitates developers to track and manage code versions, and supports the development of different functions based on different branches. Thus, multiple β branches can be developed in parallel without interfering with each other.
[0028] The instructions input by the developer on the terminal device 102 are used to synchronize data to the server 104. Thus, the code and other data of the terminal device 102 can be synchronized to the server 104, and then the server 104 performs corresponding processing based on the received data. Based on this, the developer's instructions are completed through a series of data processing and information interaction.
[0029] The following continues to introduce the good branch management method provided by the embodiment of the present application in conjunction with the accompanying drawings. In the embodiment of the present application, the terminal device can be configured with a branch management tool, which can reduce the memory burden of developers, simplify the management cost of branch codes, and effectively reduce the problem of chaotic and erroneous branch code transfer.
[0030] Figure 2 A schematic flow chart of a branch management method according to an embodiment of the present application is shown. The method includes the following steps 201 to 204 .
[0031] Step 201, when a code compilation interface is displayed and the code compilation interface includes a code of an application requirement, a test request is received, wherein the test request includes a test command, and the code includes a development identifier and a first requirement name;
[0032] Step 202: In response to the test request, call the branch management tool to obtain version information corresponding to each test branch in the remote code repository through the branch management tool;
[0033] Step 203, display each version information;
[0034] Step 204, in response to receiving the first version information selected in the version information, establish and save the association relationship between the first requirement name and the first version information through the branch management tool, and merge the code into the target test branch, wherein the target test branch corresponds to the first version information.
[0035] The above steps are described in detail below in conjunction with specific embodiments, as shown below.
[0036] In step 201, each developer can handle the development tasks of one or more required code branches, and each development task can correspond to an application requirement. Based on this, each application requirement can correspond to a code branch, so that different developers can perform their respective development tasks. Optionally, the developer can perform development tasks on the terminal device, that is, the terminal device can be used as a local code repository to store the relevant data involved in software development such as the code compiled on the developer's local terminal device. Therefore, the developer can modify, submit and manage the code locally, and can perform development work without the need to connect to the Internet.
[0037] The code compilation interface can be used as an operation window for inputting, editing and compiling codes in the development environment. Optionally, after the developer understands the development task of the application requirement he is responsible for, he can write the code of the application requirement into the code editing interface on the local terminal device. Exemplary application requirements include but are not limited to verifying user identity, display mode of job information, etc., and no specific restrictions are imposed on application requirements here.
[0038] Specifically, when developers write code for application requirements, they can create a code branch corresponding to the application requirements based on the development identifier and the first requirement name, so that the development identifier and the first requirement name can be included in the code compiled by the developer. Exemplarily, based on the creation of code branches on the git platform, the code branch corresponding to the application requirement can be a main function starting with feature / <first requirement name>, where "feature / " is the development identifier.
[0039] Optionally, the first requirement name can be set according to the developer's own application requirements or naming habits. There is no specific restriction on the naming method of the first requirement name. It should be noted that "first" is only used to distinguish the requirement names used in different operation steps, and does not require or imply any order or association between these steps.
[0040] In order to improve the service quality of application requirements after going online, as well as the stability of the application requirements in various operating environments, developers need to test the code they have written after completing the compilation of the code for application requirements. After the test passes, they can enter the online process.
[0041] In some embodiments of the present application, after completing the code compilation work, the developer can enter a test request in the code compilation interface, thereby instructing the terminal device to transfer the code of the application requirements included in the code compilation interface to the test end. For example, taking the transfer code test based on the git platform as an example, the test command in the test request can be "acsubmit".
[0042] Next, the terminal device transfers the code of the application requirements included in the code compilation interface to the test end, which involves the above step 202. Specifically, the remote code repository is stored on a remote server, which can be a server provided by the code hosting platform or a self-built server. Optionally, the code hosting platform is such as GitHub, GitLab, etc. The remote code repository can be used for multi-person collaborative development and code backup. Developers can push the code of the local code repository to the remote code repository, or pull the latest code from the remote code repository.
[0043] All version information related to software development can be recorded in the remote code repository, including the version information corresponding to each test branch. For example, the branches starting with test / in the remote code repository can be used as candidates, and the version information corresponding to the branches starting with test / is obtained for the developer to select.
[0044] After the branch management tool obtains the version information corresponding to each test branch, the above steps 203 and 204 are involved. These version information can be displayed in the code compilation interface, so that developers can select the version information corresponding to the current application requirements, that is, the first version information.
[0045] In response to receiving the first version information selected by the developer in the code compilation interface, the terminal device can automatically merge the code of the application requirement into the target test branch, that is, merge the code of the application requirement into the test branch corresponding to the first version information, so that the test end can test the code of the application requirement submitted by the developer. Compared with the traditional method of creating test requests, which requires developers to access the remote code repository through the web page and then find the required test branch in the test branches corresponding to the numerous application requirements in the remote repository, the management method provided in the embodiment of the present application effectively simplifies the process of transferring the code of the application requirement to the test branch, and is less prone to errors.
[0046] On the other hand, the association between the first requirement name and the first version information is automatically established and saved through the branch management tool. After that, the developer only needs to enter the requirement name each time he needs to process or transfer the branch code of the application requirement. This reduces the memory burden of the developer, simplifies the management cost of the branch code, and effectively reduces the problem of confusion and errors in the transfer of branch code.
[0047] In some embodiments of the present application, the method may further include the following steps: in response to a test request, displaying at least one approval account; accordingly, before merging the code into the target test branch, the method also includes: in response to receiving a target approval account selected from at least one approval account, calling a branch management tool, and pushing a test request for the application requirement to the target approval account through the branch management tool.
[0048] Based on this, merging the code into the target test branch can specifically include: obtaining the feedback result of the target approval account through the branch management tool; when the feedback result of the target approval account is to allow testing, merging the code into the target test branch through the branch management tool; and establishing and saving the association relationship between the target approval account and the first requirement name.
[0049] Specifically, the approval account may be an account identifier of a project administrator, and the account identifier includes but is not limited to any one of the project administrator's name, nickname, number, and other information.
[0050] Exemplarily, each project administrator may manage one or more development tasks of application requirements, including but not limited to whether to allow the code of the application requirement to be transferred for testing, whether to put the code of the application requirement into online application, etc.
[0051] In an embodiment of the present application, in order to facilitate developers to find the target approval account, after receiving the test request and calling the branch management tool, the branch management tool can also obtain the approval account included in the software development team. Optionally, the branch management tool can determine the project administrator corresponding to the application requirements of the current developer in combination with the hierarchical relationship of the members of the development team, and obtain the account information of the project administrator. It is understandable that information such as the members of the software development team, the hierarchical relationship between the members, and the approval authority can be pre-stored in a specific storage space, and the branch management tool can access the specific storage space and read this information. Among them, the specific storage space includes but is not limited to the storage space set in the remote code repository, and the storage space set in the local terminal device.
[0052] After the branch management tool obtains the approval accounts, these approval accounts can be displayed in the code compilation interface, so that developers can easily select the target approval accounts.
[0053] In response to receiving the target approval account required by the developer, the terminal device can call the branch management tool and push the test request of the application requirement to the target approval account through the branch management tool.
[0054] Based on the branch management method provided in the embodiment of the present application, before the code of the application requirement is transferred to the test, the project manager can review and approve the code of the development task under his management. Optionally, during the review and approval process, the code is reviewed and approved to see whether it meets the requirements and whether there are any errors. In this way, the code quality problems caused by the personal coding habits or understanding differences of the developers can be effectively reduced, thereby improving the code quality and the efficiency of the entire development process.
[0055] After pushing the test request of the application requirement to the target approval account, the feedback result of the target approval account is automatically obtained through the branch management tool. Among them, the feedback result of the target approval account is to allow the test, that is, the test request is passed. Next, the branch management tool can automatically merge the code into the target test branch; and establish and save the association relationship between the target approval account and the first requirement name.
[0056] According to the embodiment of the present application, the branch management tool establishes and saves the association between the target approval account and the first requirement name. Thereafter, the developer only needs to enter the requirement name at the approval node before processing or transferring the branch code each time, and the target approval account can be automatically obtained without the developer having to search and edit it again. This reduces the memory burden of the developer, simplifies the management cost of the branch code, and effectively reduces the problem of disordered and erroneous branch code transfer.
[0057] In some embodiments of the present application, in order to simplify the process of developers creating branches, as well as development efficiency and the standardization of branch creation, before receiving a test request, the branch management method may further specifically include the following steps 301 to 303.
[0058] Step 301 : When the code compilation interface does not include the code of the application requirement, a branch creation request of the application requirement is received based on the code compilation interface, where the branch creation request includes a creation command and a first requirement name.
[0059] Step 302: In response to the creation command, a branch management tool is called to create a project development branch locally through the branch management tool. The project development branch includes a development identifier and a first requirement name.
[0060] Step 301: Display the development identifier and the first requirement name on the code compilation interface to obtain the code of the application requirement compiled based on the development identifier and the first requirement name.
[0061] Specifically, before the developer writes code according to application requirements, the developer may input a branch creation request in the code compilation interface.
[0062] In the branch creation request, the creation command is an instruction that can be used to trigger the branch creation operation. In response to the creation command, the terminal device can call a branch management tool to create a project development branch locally through the branch management tool.
[0063] The branch management tool creates a project development branch locally, including a development identifier and a first requirement name. The development identifier can be used to quickly identify the stage of the branch during the project development process, for example, the development stage.
[0064] In the branch creation request, the first requirement name can be directly used as the name of the application requirement. When naming, developers can combine their own naming habits, or name the specific functions to be implemented by the application requirement. There is no specific restriction on the name.
[0065] As a specific example, taking the creation of a project development branch based on the git platform as an example, the branch creation request can be "ac feature <first requirement name>", where "ac feature" is the creation command. The terminal device responds to the instruction by calling the branch management tool, which accesses the remote code repository and creates a project development branch based on the latest main branch in the remote code repository, and includes the development identifier and the first requirement name in the project development branch. Optionally, the project development branch can be a branch that starts with "feature / <first requirement name>", where "feature / " is the development identifier.
[0066] Next, the development identifier and the first requirement name can be displayed on the code compilation interface, based on which the developer can clearly understand the development branch currently in the development stage, which can effectively reduce the probability of errors when the developer switches between multiple branches. After that, the developer can write code related to the application requirements based on the development identifier and the first requirement name.
[0067] In the branch management method provided in the embodiment of the present application, the number of instructions input by the developer during the branch creation process is effectively reduced, that is, the complexity of the developer's manual operation can be reduced, and the risk of branch creation errors caused by misoperation or information confusion can be reduced, which is beneficial to improving the quality of the code, while also increasing the speed of branch creation and improving development efficiency.
[0068] Moreover, in the branch management method provided in the embodiment of the present application, the project development branch is automatically created based on the latest main branch in the remote code repository through the branch management tool, which can reduce the risk of conflict between the newly created branch and the main branch. In addition, the created branches all use the development identifier as the branch, effectively improving the standardization of the development branch.
[0069] In some embodiments of the present application, after the code is incorporated into the target test branch, the test end tests the running effect of the code required by the application and generates a test result. If the test result indicates that the running effect of the code required by the application is not good, the developer can continue to adjust the code required by the application. Specifically, in the embodiment of the present application, the method also includes the following steps 401 to 403.
[0070] Step 401: receiving a branch repair request based on a code compilation interface, wherein the branch repair request includes a repair command and a first requirement name.
[0071] Step 402, in response to the repair command, call the branch management tool, obtain the target version information associated with the first requirement name through the branch management tool, and create a repair branch based on the code included in the target test branch, the repair branch includes a repair identifier and the first requirement name.
[0072] Step 403: Display the repair identifier and the first requirement name on the code compilation interface to obtain the repair code compiled based on the repair identifier and the first requirement name.
[0073] Specifically, the branch repair request may include a repair command and a first requirement name. Thus, the terminal device may call the branch management tool in response to the repair command, automatically obtain the target version information associated with the first requirement name through the branch management tool, and create a repair branch based on the code included in the target test branch, the repair branch including the repair identifier and the first requirement name.
[0074] As a result, developers do not need to search for the branch code they want to repair among numerous test branches by themselves. A repair branch can be automatically created for the developer, thereby reducing the risk of confusing different application requirements or modifying targets during the repair process.
[0075] After creating a repair branch, the repair mark and the first requirement name can be displayed on the code compilation interface, so that developers can easily identify the application requirements that need to be adjusted, and developers can quickly understand the branch that needs to be repaired and the error probability when switching between multiple branches. After that, developers can continue to enter the adjusted code related to the application requirements based on the repair mark and the first requirement name.
[0076] Exemplarily, taking the creation of a repair branch based on the git platform as an example, the branch repair request may be "ac bugfix <first requirement name>", where "ac bugfix" is a repair command. Through the branch management tool, a repair branch of "bugfix / <first requirement name>" may be automatically created. It is understandable that, although the code compilation interface may not display all the codes included in the project development branch corresponding to the first requirement name, the repair branch corresponding to the first requirement name may still be part of the project development branch corresponding to the first requirement name.
[0077] According to the embodiment of the present application, the developer only needs to input the repair command and the first requirement name in the code compilation interface, and the terminal device automatically calls the branch management tool to quickly and automatically create a repair branch, effectively reducing the time consumption on branch operations and version control during the development process, thereby reducing development costs. At the same time, in the embodiment of the present application, by timely presenting the repair mark and the first requirement name, the risk of editing confusion caused by branch confusion can also be reduced.
[0078] In addition, in some embodiments of the present application, after the developer completes the code repair work of the repair branch, the developer needs to test the repaired code. Since the repair branch includes the repair identifier and the first requirement name, the developer only needs to input the test request including the test command (for example, ac submit) again to trigger the terminal device to automatically call the branch management tool, and the branch management tool finds the target test branch according to the association relationship between the saved first requirement name and the first version information, and moves the repaired code to the target test branch, so that the test end can test the repaired code.
[0079] Optionally, the branch management tool also records the association between the target approval account and the name of the first requirement. Therefore, before the repaired code is moved to the target test branch, the test request for the application requirement can be automatically pushed to the target approval account, and when the feedback result of the target approval account is to allow testing, the repaired code will be moved to the target test branch so that the test end can test the repaired code.
[0080] According to the embodiment of the present application, since the association relationship between the first requirement name and the first version information is automatically established and saved through the branch management tool, when the developer needs to process or transfer the related branch code of the application requirement, he only needs to enter the requirement name to realize automatic transfer, thereby reducing the memory burden of the developer, simplifying the management cost of the branch code, and effectively reducing the problem of disordered and erroneous branch code transfer.
[0081] In some embodiments of the present application, after the code included in the project development branch of the application requirement passes the test, the application requirement can be submitted online. Based on this, after the code is merged into the target test branch, the method further includes:
[0082] Based on the code compilation interface, a branch online request is received, wherein the branch online request includes an online command and a first requirement name; in response to the online command, a branch management tool is called, and the target version information associated with the first requirement name is obtained through the branch management tool, and the code included in the project development branch is obtained; a branch merge request is generated through the branch management tool, so that after the branch merge request is passed, the code included in the project development branch is merged into the main branch of the online application in the remote code repository.
[0083] Specifically, the project development branch of the application requirement includes all codes written based on the development identifier and the first requirement name, that is, including the first written code and one or more later repair codes. The code included in the project development branch is stored in a preset storage space in the local terminal device, and the storage space is not specifically limited here.
[0084] After the test is passed, the developer can enter a branch launch request in the code compilation interface, whereby the terminal device responds to the launch command in the branch launch request and calls the branch management tool, thereby automatically obtaining the target version information associated with the first requirement name through the branch management tool, and obtaining the code included in the project development branch. For example, based on the git platform, the branch launch request can be "ac publish <first requirement name>", where "acpublish" is the launch command.
[0085] Next, the branch management tool can automatically generate a branch merge request to merge the code included in the target test branch into the main branch of the online application in the remote code repository after the branch merge request is approved. Optionally, the branch merge request can be pushed to the target application account, and the approval result of the target approval account is to allow the launch, that is, the launch request is approved. Next, the branch management tool can automatically merge the code included in the project development branch into the main branch of the online application in the remote code repository.
[0086] During this process, developers only need to enter concise instructions and requirement names, without having to manually search for codes, to complete the online request process for the project development branch. This reduces the memory burden of developers, simplifies the management cost of branch codes, and effectively reduces the problem of chaotic and erroneous branch code transfer.
[0087] In some embodiments, as software development projects involve more and more content, many unnecessary branches that are no longer needed may accumulate in remote repositories and local repositories, such as merged temporary branches or old published branches. Moreover, the storage space of these unnecessary branches affects the performance of warehouse operations.
[0088] Based on this, in some embodiments of the present application, the branch management method may further include the following steps: based on the display code compilation interface receiving Local branch deletion request , wherein the branch deletion request includes a second requirement name and a local branch deletion instruction; in response to the local branch deletion request, the branch management tool is called, and the second version information corresponding to the second requirement name is determined through the branch management tool; when the project development branch corresponding to the second version information is found locally, the project development branch corresponding to the second version information is deleted; when the test branch corresponding to the second version information is found locally, the test branch corresponding to the second version information is deleted; when the repair branch corresponding to the second version information is found locally, the repair branch corresponding to the second version information is deleted.
[0089] Specifically, the application requirement corresponding to the second requirement name may be an application requirement that has been completed online. Optionally, developers can clean up branches such as development, testing, and bug fixing. According to the branch management method provided in the embodiment of the present application, developers only need to enter a local branch deletion request including the second requirement name and a local branch deletion instruction. For example, taking branch cleanup based on the git platform as an example, the local branch deletion request is such as "git branch-d <second requirement name>", where "git branch-d" is the local branch deletion instruction.
[0090] Based on this, the terminal device can automatically call the branch management tool, and the branch management tool finds the project development branch corresponding to the second requirement name according to the corresponding association relationship between the requirement name and the version information stored in it, and deletes the local project development branch.
[0091] It can be seen that compared with the traditional cleaning method, in which developers need to enter commands separately for each branch such as development, testing, and bug fixing, the branch management method provided in the embodiment of the present application can effectively reduce the number of instructions entered by developers, that is, reduce the complexity of manual operations of developers, and reduce the risk of branch deletion errors caused by misoperation or information confusion.
[0092] In addition, the branch management method may also include the following steps: receiving a remote branch deletion request based on displaying the code compilation interface, wherein the branch deletion request includes a second requirement name and a remote branch deletion instruction; in response to the remote branch deletion instruction, calling a branch management tool, and determining the second version information corresponding to the second requirement name through the branch management tool; accessing the remote code tool through the branch code tool, and deleting the project development branch corresponding to the second version information when the project development branch corresponding to the second version information is found in the remote code repository; deleting the test branch corresponding to the second version information when the test branch corresponding to the second version information is found in the remote code repository; and deleting the repair branch corresponding to the second version information when the repair branch corresponding to the second version information is found in the remote code repository.
[0093] Specifically, when it is necessary to clean up branches such as development, testing, and bug fixing in the remote repository, according to the branch management method provided in the embodiment of the present application, the developer only needs to enter a remote branch deletion request including the second requirement name and a remote branch deletion instruction. For example, taking branch cleaning based on the git platform as an example, a local branch deletion request is such as "ac remove <second requirement name>", where "ac remove" is a local branch deletion instruction.
[0094] Based on this, the terminal device can automatically call the branch management tool, and the branch management tool finds the project development branch corresponding to the second requirement name according to the corresponding association relationship between the requirement name and the version information stored in it, and deletes the remote project development branch.
[0095] It can be seen that compared with the traditional cleaning method, in which developers need to enter commands separately for each branch such as development, testing, and bug fixing, the branch management method provided in the embodiment of the present application can effectively reduce the number of instructions entered by developers, that is, reduce the complexity of manual operations of developers, and reduce the risk of branch deletion errors caused by misoperation or information confusion.
[0096] It can be understood that in the embodiments of the present application, all the specific instructions listed are only for facilitating the understanding of the branch management method provided in the embodiments of the present application, and are not specific limitations on the embodiments of the present application. In the actual application of the branch management method, the specific instructions can be set according to the actual application requirements.
[0097] Corresponding to the method embodiment of the present application, the present application also provides a branch management device, such as Figure 3 As shown, the branch management device 300 includes: a display module 301 , a processing module 302 and a branch management tool 303 .
[0098] The display module 301 is used to receive a test request when displaying a code compilation interface, and the code compilation interface includes a code of an application requirement, wherein the test request includes a test command, and the code includes a development identifier and a first requirement name;
[0099] The processing module 302 is used to call the branch management tool 303 in response to the test command, and obtain the version information corresponding to each test branch in the remote code repository through the branch management tool 303;
[0100] The display module 301 is also used to display each version information;
[0101] The branch management tool 303 is used to establish and save the association between the first requirement name and the first version information in response to receiving the first version information selected in the version information, and merge the code into the target test branch, wherein the target test branch corresponds to the first version information.
[0102] In some embodiments, the display module 301 is further used to receive a branch creation request of the application requirement based on the code compilation interface when the code compilation interface does not include the code of the application requirement, the branch creation request including a creation command and a first requirement name;
[0103] The processing module 302 is further used to call a branch management tool 303 in response to a creation command;
[0104] The branch management tool 303 is also used to create a project development branch locally, where the project development branch includes a development identifier and a first requirement name;
[0105] The display module 301 is further used to display the development identifier and the first requirement name on the code compilation interface to obtain the code of the application requirement compiled based on the development identifier and the first requirement name.
[0106] In some embodiments, the display module 301 is further configured to display at least one approval account in response to the test request;
[0107] The processing module 302 is further used to call the branch management tool 303 in response to receiving the target approval account selected from the at least one approval account information, and push the test request of the application requirement to the target approval account through the branch management tool 303;
[0108] The branch management tool 303 is also used to obtain feedback results from the target approval account;
[0109] The branch management tool 303 is also used to merge the code into the target test branch when the feedback result of the target approval account is that the test is allowed; and to establish and save the association relationship between the target approval account and the first requirement name.
[0110] In some embodiments, the display module 301 is further used to receive a branch repair request based on the code compilation interface, wherein the branch repair request includes a repair command and a first requirement name;
[0111] The processing module 302 is further used to call the branch management tool 303 in response to the repair command;
[0112] The branch management tool 303 is further used to obtain the target version information associated with the first requirement name, and create a repair branch based on the code included in the target test branch, where the repair branch includes a repair identifier and the first requirement name;
[0113] The display module 301 is further used to display the repair identifier and the first requirement name on the code compilation interface to obtain the repair code compiled based on the repair identifier and the first requirement name.
[0114] In some embodiments, the display module 301 is further used to receive a branch online request based on the code compilation interface, wherein the branch online request includes an online command and a first requirement name;
[0115] The processing module 302 is further used to call the branch management tool 303 in response to the online command;
[0116] The branch management tool 303 is further used to obtain the target version information associated with the first requirement name and obtain the code included in the project development branch;
[0117] The branch management tool 303 is also used to generate a branch merge request so that after the branch merge request is approved, the code included in the project development branch is merged into the main branch of the online application in the remote code repository.
[0118] In some embodiments, the display module 301 is further used to receive a local branch deletion request based on the display code compilation interface, wherein the branch deletion request includes the second requirement name and the local branch deletion instruction;
[0119] The processing module 302 is further used to call a branch management tool 303 in response to a local branch deletion request;
[0120] The branch management tool 303 is further used to determine the second version information corresponding to the second requirement name;
[0121] Processing module 302 is also used to delete the project development branch corresponding to the second version information when the project development branch corresponding to the second version information is found locally; to delete the test branch corresponding to the second version information when the test branch corresponding to the second version information is found locally; and to delete the repair branch corresponding to the second version information when the repair branch corresponding to the second version information is found locally.
[0122] In some embodiments, the display module 301 is further used to receive a remote branch deletion request based on the display code compilation interface, wherein the branch deletion request includes the second requirement name and the remote branch deletion instruction;
[0123] The processing module 302 is further used to call the branch management tool 303 in response to the remote branch deletion instruction;
[0124] The branch management tool 303 is further used to determine the second version information corresponding to the second requirement name;
[0125] The branch management tool 303 is also used to access the remote code tool. When the project development branch corresponding to the second version information is found in the remote code repository, the project development branch corresponding to the second version information is deleted; when the test branch corresponding to the second version information is found in the remote code repository, the test branch corresponding to the second version information is deleted; when the repair branch corresponding to the second version information is found in the remote code repository, the repair branch corresponding to the second version information is deleted.
[0126] By using the branch management device provided by the embodiment of the present application, when the developer needs to transfer the code of the application requirement, he only needs to enter the test request in the code compilation interface including the code of the application requirement. Since the test request includes the development identification and the first requirement name, the terminal can respond to the test command in the test request, automatically call the branch management tool installed by the terminal, and obtain the version information corresponding to each test branch in the remote code repository through the branch management tool, so as to actively display the existing version information. In this way, the developer only needs to select the required version information, that is, the first version information, and the branch management tool can automatically establish and save the association between the first requirement name and the first version information, and at the same time, merge the code into the target test branch. After that, the developer only needs to enter the requirement name each time he needs to process or transfer the branch code, thereby reducing the memory burden of the developer, simplifying the management cost of the branch code, and effectively reducing the problem of confusion and error in the transfer of branch code.
[0127] It can be understood that the branch management device of the embodiment of the present application can correspond to the execution subject of the branch management method provided by the embodiment of the present application. The specific details of the operation and / or function of each module / unit of the branch management device can be found in the description of the corresponding parts of the branch management method provided by the above-mentioned embodiment of the present application. For the sake of brevity, they will not be repeated here.
[0128] The electronic device in the embodiment of the present application may be a user terminal device, a server, other computing devices, or a cloud server. Figure 4 A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application is shown. The electronic device may include a processor 401 and a memory 402 storing computer program instructions. When the processor 401 executes the computer program instructions, the process or function of any of the above-mentioned embodiments of the method is implemented.
[0129] Specifically, the processor 401 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application. The memory 402 may include a large-capacity memory for data or instructions. For example, the memory 402 may be at least one of the following: a hard disk drive (HDD), a read-only memory (ROM), a random access memory (RAM), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, a universal serial bus (USB) drive or other physical / tangible memory storage device. For another example, the memory 402 may include a removable or non-removable (or fixed) medium. For another example, the memory 402 may be inside or outside the integrated gateway disaster recovery device. The memory 402 may be a non-volatile solid-state memory. In other words, the memory 402 generally includes a tangible (non-transitory) computer-readable storage medium (such as a memory device) encoded with computer-executable instructions, and when the software is executed (such as executed by one or more processors), the operations described in the method of the embodiments of the present application may be performed. The processor 401 implements the process or function of any method in the above embodiments by reading and executing the computer program instructions stored in the memory 402 .
[0130] In one example, Figure 4The electronic device shown may also include a communication interface 403 and a bus 410. Among them, the processor 401, the memory 402, and the communication interface 403 are connected through the bus 410 and complete the communication between each other. The communication interface 403 is mainly used to realize the communication between each module, device, unit and / or device in the embodiment of the present application. The bus 410 includes hardware, software or both, and can couple the components of the online data traffic billing device to each other. For example, the bus may include at least one of the following: an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-end bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a micro channel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable buses. The bus 410 may include one or more buses. Although the embodiments of the present application describe or illustrate a specific bus, the embodiments of the present application may consider any suitable bus or interconnection method.
[0131] In combination with the method in the above embodiments, an embodiment of the present application also provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the process or function of any method in the above embodiments is implemented.
[0132] In addition, an embodiment of the present application further provides a computer program product, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the process or function of any one of the methods in the above embodiments is implemented.
[0133] The above exemplarily describes the flowcharts and / or block diagrams of the methods, devices, systems and computer program products of the embodiments of the present application, and describes the relevant various aspects. It should be understood that each box or combination thereof in the flowchart and / or block diagram can be implemented by computer program instructions, or by dedicated hardware that performs a specified function or action, or by a combination of dedicated hardware and computer instructions. For example, these computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to form a machine that enables these instructions executed by such a processor to enable the implementation of the functions / actions specified in each box or combination thereof in the flowchart and / or block diagram. Such a processor can be a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.
[0134] The functional blocks shown in the structured block diagram of the embodiment of the present application can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc.; when implemented in software, it is a program or code segment used to perform the required task. The program or code segment can be stored in a memory, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0135] It should be noted that the present application is not limited to the specific configurations and processes described above or shown in the figures. The above is only a specific implementation mode of the present application. Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the described system, device, module or unit can refer to the corresponding process in the method embodiment without further description. It should be understood that the scope of protection of the present application is not limited to this. Any technician familiar with the technical field can think of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and these modifications or substitutions should be included in the scope of protection of the present application.
Claims
1. A branch management method, characterized in that: The method is applied to a terminal device, and the terminal is configured with a branch management tool; the method comprises: When a code compilation interface is displayed and the code compilation interface includes a code of an application requirement, a test request is received, wherein the test request includes a test command and the code includes a development identifier and a first requirement name; In response to the test request, calling the branch management tool, and obtaining version information corresponding to each test branch in the remote code repository through the branch management tool; Displaying each of said version information; In response to receiving the first version information selected from the version information, an association relationship between the first requirement name and the first version information is established and saved through the branch management tool, and the code is merged into the target test branch, wherein the target test branch corresponds to the first version information.
2. The method according to claim 1, characterized in that: Before receiving the test request, the method further includes: In a case where the code compilation interface does not include the code of the application requirement, receiving a branch creation request of the application requirement based on the code compilation interface, the branch creation request including a creation command and the first requirement name; In response to the creation command, the branch management tool is called to create a project development branch locally through the branch management tool, wherein the project development branch includes the development identifier and the first requirement name; The development identifier and the first requirement name are displayed on the code compilation interface to obtain the code of the application requirement compiled based on the development identifier and the first requirement name.
3. The method according to claim 1, characterized in that The method further comprises: In response to the test request, displaying at least one approval account; Before merging the code into the target test branch, the method further includes: In response to receiving a target approval account selected from the at least one approval account information, calling the branch management tool, and pushing a test request for the application requirement to the target approval account through the branch management tool; The step of merging the code into the target test branch comprises: Obtaining feedback results from the target approval account through the branch management tool; When the feedback result of the target approval account is that the test is allowed, the code is merged into the target test branch through the branch management tool; and an association relationship between the target approval account and the first requirement name is established and saved.
4. The method according to claim 1, characterized in that: After merging the code into the target test branch, the method further includes: Based on the code compilation interface, receiving a branch repair request, wherein the branch repair request includes a repair command and the first requirement name; In response to the repair command, calling the branch management tool, obtaining the target version information associated with the first requirement name through the branch management tool, and creating a repair branch based on the code included in the target test branch, the repair branch including a repair identifier and the first requirement name; The repair identifier and the first requirement name are displayed on the code compilation interface to obtain repair code compiled based on the repair identifier and the first requirement name.
5. The method according to claim 2, characterized in that: After merging the code into the target test branch, the method further includes: Based on the code compilation interface, receiving a branch online request, wherein the branch online request includes an online command and the first requirement name; In response to the online command, calling the branch management tool, obtaining the target version information associated with the first requirement name through the branch management tool, and obtaining the code included in the project development branch; A branch merge request is generated through the branch management tool, so that after the branch merge request is approved, the code included in the project development branch is merged into the main branch of the online application in the remote code repository.
6. The method according to claim 1, characterized in that The method further comprises: Receiving a local branch deletion request based on the display code compilation interface, wherein the branch deletion request includes the second requirement name and a local branch deletion instruction; In response to the local branch deletion request, calling the branch management tool, and determining the second version information corresponding to the second requirement name through the branch management tool; If the project development branch corresponding to the second version information is found locally, delete the project development branch corresponding to the second version information; if the test branch corresponding to the second version information is found locally, delete the test branch corresponding to the second version information; if the repair branch corresponding to the second version information is found locally, delete the repair branch corresponding to the second version information.
7. The method according to claim 1, characterized in that The method further comprises: Receiving a remote branch deletion request based on the display code compilation interface, wherein the branch deletion request includes the second requirement name and a remote branch deletion instruction; In response to the remote branch deletion instruction, calling the branch management tool, and determining the second version information corresponding to the second requirement name through the branch management tool; Access the remote code tool through the branch code tool, and if the project development branch corresponding to the second version information is found in the remote code repository, delete the project development branch corresponding to the second version information; if the test branch corresponding to the second version information is found in the remote code repository, delete the test branch corresponding to the second version information; if the repair branch corresponding to the second version information is found in the remote code repository, delete the repair branch corresponding to the second version information.
8. A branch management device, characterized in that: The device comprises: A display module, configured to receive a test request when displaying a code compilation interface, and the code compilation interface includes a code of an application requirement, wherein the test request includes a test command, and the code includes a development identifier and a first requirement name; A processing module, configured to call the branch management tool in response to the test command, and obtain version information corresponding to each test branch in the remote code repository through the branch management tool; The display module is further used to display each version information; The branch management tool is used to establish and save the association between the first requirement name and the first version information in response to receiving the first version information selected from the version information, and to merge the code into the target test branch, wherein the target test branch corresponds to the first version information.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the electronic device executes the computer program instructions, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product, characterized in that It comprises computer program instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Version management method and device based on GIT, equipment and readable storage medium
CN110489347A
Code branch establishing method and device and computer equipment
CN111522580A
Code version management method, device and system and storage medium
CN114942780A
Code warehouse management method and device, electronic equipment and storage medium
CN115904933A
