Code warehouse management method and device, electronic equipment, storage medium and program product

By receiving user instructions and determining execution scenarios, candidates and target warehouses are automatically determined from multiple code warehouses, which solves the problem of manual switching operations in the prior art and realizes efficient multi-warehouse management.

CN119781750AActive Publication Date: 2025-04-08Z-ONE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411842963.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-08
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

Existing version management tools can only operate on a single code repository, resulting in the need for users to switch to each repository separately for operation when multiple code repositories are involved, which is a waste of time.

Method used

Provide a code warehouse management method, by receiving user instructions, determining execution scenarios and operation instructions, automatically determining candidates and target warehouses from multiple code warehouses, and executing operation instructions does not require user manual switching.

Benefits of technology

When multiple code repositories are involved, the target repository is automatically determined to perform operations, saving user time and improving operation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781750A_ABST
    Figure CN119781750A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a code warehouse management method and device, electronic equipment, a storage medium and a program product. The method comprises the steps of receiving a user instruction; determining an operation instruction for indicating to-be-executed operation and an execution scene of the to-be-executed operation according to the user instruction; determining a candidate warehouse for executing the operation to be executed from a plurality of given code warehouses according to the execution scene; according to the to-be-executed operation, determining a target warehouse for executing the to-be-executed operation from the candidate warehouses; and executing the to-be-executed operation in the target warehouse according to the operation instruction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of software engineering technology, and in particular to a code repository management method, device, electronic device, storage medium, and program product. Background Art

[0002] The development of the Internet has brought great convenience to people's lives and has also promoted the birth and development of software version management tools. Version control tools (also known as source code management tools) are tool software used in software engineering to manage the source code change history during the software development process. Existing version management tools, such as SVN (SubVersion) and Git, usually only support operations on a single code repository. However, existing software development projects may have multiple code repositories for storing code. When using existing version management tools, if a user's operation involves multiple code repositories, the user needs to switch to each code repository to perform the operation, which greatly wastes the user's time. Summary of the invention

[0003] In view of this, embodiments of the present application provide a code repository management method, device, electronic device, storage medium, and program product to at least partially solve the above problems.

[0004] An embodiment of the present application provides a code repository management method, including: receiving a user instruction; determining an operation instruction for indicating an operation to be performed and an execution scenario of the operation to be performed according to the user instruction; determining a candidate repository for performing the operation to be performed from a given plurality of code repositories according to the execution scenario; determining a target repository for performing the operation to be performed from the candidate repositories according to the operation to be performed; and performing the operation to be performed in the target repository according to the operation instruction.

[0005] In one possible implementation, the execution scenario includes a default scenario; and determining, based on the execution scenario, a candidate repository for executing the operation to be executed from a given plurality of code repositories includes: if the execution scenario is the default scenario, then, based on a current branch of a preset anchor repository, determining, as the candidate repository, a code repository in the plurality of code repositories whose current branch is the same as the current branch of the anchor repository.

[0006] In one possible implementation, the execution scenario includes a specified scenario; and determining, based on the execution scenario, a candidate repository for executing the operation to be executed from a given plurality of code repositories includes: if the execution scenario is the specified scenario, displaying a repository list and receiving a repository selection instruction; wherein the repository list is used to display information of the plurality of code repositories; and determining, based on the repository selection instruction, a selected code repository from the plurality of code repositories, and determining the selected code repository as the candidate repository.

[0007] In one possible implementation, determining a target warehouse for executing the operation to be executed from the candidate warehouses according to the operation to be executed includes: judging whether the candidate warehouse meets the execution condition of the operation to be executed according to the operation to be executed, and determining the candidate warehouse as the target warehouse when the candidate warehouse meets the execution condition.

[0008] In one possible implementation, the operation to be executed includes a branch merge operation; the judging whether the candidate warehouse satisfies the execution condition of the operation to be executed includes: if the operation to be executed is the branch merge operation, determining the target branch to be merged into the current branch of the candidate warehouse according to the operation instruction, and judging whether there is a change in the current branch of the candidate warehouse relative to the corresponding target branch; if there is a change, determining that the candidate warehouse satisfies the execution condition; if there is no change, determining that the candidate warehouse does not satisfy the execution condition.

[0009] In a possible implementation, determining whether the current branch of the candidate warehouse has changed relative to the corresponding target branch includes: obtaining first code version information of the current branch of the candidate warehouse at the local end, and second code version information of the current branch of the candidate warehouse at the remote end; comparing the first code version information with the second code version information, and determining whether the current code version of the current branch of the candidate warehouse at the local end is the same as the current code version of the current branch of the candidate warehouse at the remote end; if not, determining that the current branch of the candidate warehouse has not changed relative to the corresponding target branch; if so, obtaining third code version information of the target branch at the remote end, and determining, according to the third code version information, whether the code versions of the target branch that have been updated all the time include the current code version of the current branch of the candidate warehouse; if so, determining that the current branch of the candidate warehouse has not changed relative to the corresponding target branch; if not, determining that the current branch of the candidate warehouse has changed relative to the corresponding target branch.

[0010] An embodiment of the present application also provides a code repository management device, including: a receiving module for receiving user instructions; a parsing module for determining, based on the user instructions, an operation instruction for indicating an operation to be performed, and an execution scenario for the operation to be performed; a candidate repository determination module for determining, based on the execution scenario, a candidate repository for performing the operation to be performed from a given plurality of code repositories; a target repository determination module for determining, based on the operation to be performed, a target repository for performing the operation to be performed from the candidate repositories; and an operation execution module for performing the operation to be performed in the target repository according to the operation instruction.

[0011] An embodiment of the present application also provides an electronic device, including: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one computer software, and the computer software enables the processor to execute the method described in any of the above embodiments.

[0012] An embodiment of the present application further provides a computer storage medium on which a computer program is stored. When the program is executed by a processor, the method described in any of the above embodiments is implemented.

[0013] An embodiment of the present application further provides a computer program product, including computer instructions, wherein the computer instructions instruct a computing device to execute operations corresponding to the method described in any of the above embodiments.

[0014] In an embodiment of the present application, an operation instruction for indicating the operation to be performed and an execution scenario of the operation to be performed can be determined according to user instructions; according to the execution scenario, a candidate warehouse for performing the operation to be performed is determined from a given plurality of code warehouses; according to the operation to be performed, a target warehouse for performing the operation to be performed is determined from the candidate warehouses; according to the operation instruction, the operation to be performed is performed in the target warehouse.

[0015] Therefore, when the operation to be executed involves multiple code repositories, the target repository for executing the operation to be executed can be automatically determined from the given multiple code repositories, without the user having to switch to each code repository separately to perform the operation, which can significantly save the user's time. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0017] Figure 1A schematic diagram of an exemplary system for a code repository management method applicable to an embodiment of the present application;

[0018] Figure 2 It is a flowchart of the steps of a code repository management method provided by an embodiment of the present application;

[0019] Figure 3 is a flowchart of another code repository management method provided by an embodiment of the present application;

[0020] Figure 4 It is a structural block diagram of a code repository management device provided in an embodiment of the present application;

[0021] Figure 5 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.

[0023] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0024] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0025] In order to improve the efficiency of software development, modularization has become a trend in software architecture design. Modularization is a design strategy that advocates breaking down large software development projects into smaller, more manageable components or modules. Each module is responsible for a part of the functionality and interacts with other modules through well-defined interfaces. This approach can simplify the development process, enable members of the software development team to focus on the tasks of a specific module, and promote code reuse. Accordingly, each module of the software usually corresponds to a code repository that stores the code of the module. When the software is multi-module, multiple code repositories need to be set up to store the code of each module separately.

[0026] However, as mentioned above, existing version management tools generally only support operations on a single code repository. When an operation involves multiple code repositories for storing code, the existing version management tools can only switch to each code repository one by one to perform the operation, which brings great inconvenience to software development.

[0027] The embodiment of the present application provides a code repository management method to at least partially solve the above-mentioned problem.

[0028] Figure 1 An exemplary system for the code repository management method applicable to the embodiment of the present application is shown. Figure 1 As shown, the system 100 may include a remote terminal 102, a communication network 104 and / or one or more local terminals 106. Figure 1 The example in the figure shows multiple local terminals.

[0029] The remote end 102 may be any suitable device for storing information, data, programs, and / or any other suitable type of content, including but not limited to a distributed storage system device, a server cluster, a computing cloud server cluster, etc. In some embodiments, the remote end 102 may perform any suitable function. For example, in some embodiments, the remote end 102 may be used for corresponding operations in the code repository management method. As an optional example, in some embodiments, the remote end 102 may be used to perform corresponding operations to be performed in the target repository.

[0030] In some embodiments, the communication network 104 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 104 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN) and / or any other suitable communication network. The local end 106 can be connected to the communication network 104 via one or more communication links (e.g., communication link 112), and the communication network 104 can be linked to the remote end 102 via one or more communication links (e.g., communication link 114). The communication link can be any communication link suitable for transmitting data between the local end 106 and the remote end 102, such as a network link, a dial-up link, a wireless link, a hard-wired link, any other suitable communication link or any suitable combination of such links.

[0031] The local end 106 may include any one or more user devices adapted to receive user instructions, determine operation instructions and target warehouses according to the user instructions, and enable the remote end 102 to perform corresponding operations to be performed at the target warehouse according to the operation instructions. In some embodiments, the local end 106 may include any suitable type of device. For example, in some embodiments, the local end 106 may include a mobile device, a tablet computer, a laptop computer, a desktop computer, a wearable computer, and / or any other suitable type of user device.

[0032] Users can develop code locally, upload the completed code to the remote end, and obtain the code completed by other people from the remote end, thereby realizing collaborative software development through the remote end.

[0033] It should be noted that the code repository used to store code can exist on both the local and remote ends. After the user completes code writing, he can submit the code to a code repository on the local end, so that the code can be stored locally. In addition, the code stored in the code repository on the local end can be uploaded to the code repository on the remote end for centralized storage, so that other users can download the code from the code repository on the remote end, facilitating collaboration among user teams.

[0034] The local end may include a configuration file storing code repository configuration information. The code repository configuration information may include the storage path of the code repository on the remote end, the identifier or name of the code repository on the local end, the storage path of the code repository on the local end, and other information.

[0035] The code repository management method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0036] like Figure 2 As shown, the embodiment of the present application provides a code repository management method, including:

[0037] S210: Receive user instructions.

[0038] The user instruction may be an instruction input by a user.

[0039] As a feasible implementation manner, an embodiment of the present application may provide an operation unit, which includes an instruction input page for a user to input user instructions, so that the user instructions can be received through the operation unit.

[0040] As a feasible implementation method, the local configuration file and the program code for implementing the method of the embodiment of the present application can be stored in a folder corresponding to the operating unit.

[0041] S220: Determine, according to the user instruction, an operation instruction for indicating the operation to be performed and an execution scenario of the operation to be performed.

[0042] The user instruction may include a first part and a second part, the first part may be an operation instruction, and the second part may be a scene instruction for indicating an execution scene, so that the operation instruction can be determined according to the first part of the user instruction, and the execution scene can be determined according to the second part of the user instruction.

[0043] S230: Determine, according to the execution scenario, a candidate repository for executing the operation to be executed from a given plurality of code repositories.

[0044] The given multiple code repositories may be all code repositories involved in the development of the same software. In different execution scenarios, the candidate repositories may be different, and the candidate repositories for executing the operation to be executed in the current scenario may be determined from the given multiple code repositories according to the execution scenario determined in step S220. Among them, the given multiple code repositories may be the various code repositories involved in the same software, so as to facilitate the unified management of the various code repositories involved in the software. The number of candidate repositories may be one or more, so as to support operations on multiple code repositories.

[0045] S240: According to the operation to be executed, determine a target warehouse for executing the operation to be executed from the candidate warehouses.

[0046] It should be noted that for a certain operation to be executed, not all candidate warehouses may be able to execute the operation. The embodiment of the present application can determine the candidate warehouses that can execute the operation to be executed from the candidate warehouses based on the operation to be executed, and use the determined candidate warehouses as the target warehouses for executing the operation to be executed.

[0047] In the prior art, determined operations to be executed can only be executed in the current data warehouse. If the same operation needs to be performed on a data warehouse other than the current data warehouse, the user is required to switch to another corresponding data warehouse and then execute the operations to be executed. In the embodiment of the present application, as long as other data warehouses are determined as target warehouses, the operations to be executed can be executed in the data warehouses without the user having to switch data warehouses, thereby improving the efficiency of executing the operations to be executed.

[0048] S250: Execute the pending operation in the target warehouse according to the operation instruction.

[0049] After the target warehouse is determined, the operations to be performed can be performed in each target warehouse according to the operations to be performed indicated by the operation instructions.

[0050] As a feasible implementation method, the present application can call a given version management tool to perform the operation to be performed in the target warehouse. Specifically, S150 may include: generating an assembly instruction according to the operation instruction, the assembly instruction is used to call the given version management tool, so that the version management tool performs the operation to be performed in the target warehouse. Based on the assembly instruction, the version management tool is called to perform the operation to be performed in the target warehouse, and then the execution result of the operation to be performed can be displayed. The following is an example of calling Git software.

[0051] As an example, the user instruction may be "zit-z push", where "zit" is the name of the program that implements the method in the present application, and is used to call the program. Optionally, the program that implements the method in the present application may be a SHELL script. "push" is the first part of the user instruction, that is, the operation instruction. Specifically, "push" can be used to indicate that the code in the code repository on the local end is uploaded to the code repository on the remote end. The operation instructions in the embodiments of the present application can be set with reference to version management tools such as Git software. For details, please refer to the relevant technology and will not be described here. "-z" is the second part of the user instruction, that is, the scene instruction. The execution scene in the embodiments of the present application may include a default scene and a specified scene. "-z" can be used to indicate that the execution scene is a specified scene. When the user instruction does not contain "-z", it can indicate that the execution scene is the default scene.

[0052] According to the operation instruction "push", an assembly instruction for calling the Git software can be generated to enable the Git software to perform the "push" operation in each target repository respectively, and the Git software is called through the assembly instruction to perform the corresponding operation.

[0053] In an embodiment of the present application, an operation instruction for indicating the operation to be performed and an execution scenario of the operation to be performed can be determined according to user instructions; according to the execution scenario, a candidate warehouse for performing the operation to be performed is determined from a given plurality of code warehouses; according to the operation to be performed, a target warehouse for performing the operation to be performed is determined from the candidate warehouses; according to the operation instruction, the operation to be performed is performed in the target warehouse.

[0054] Therefore, when the operation to be executed involves multiple code repositories, the target repository for executing the operation to be executed can be automatically determined from the given multiple code repositories, without the user having to switch to each code repository separately to perform the operation, which can significantly save the user's time.

[0055] In some optional embodiments, the execution scenario includes a default scenario.

[0056] According to the execution scenario, determining a candidate repository for executing the operation to be executed from a given plurality of code repositories includes:

[0057] If the execution scenario is the default scenario, based on the current branch of the preset anchor repository, a code repository whose current branch is the same as the current branch of the anchor repository among multiple code repositories is determined as a candidate repository.

[0058] A branch can be understood as an independent code branch created in a code repository based on a submitted code version. Each branch exists independently and records the submission history and code status of the code therein. Exemplarily, common branch types include: master / main branch, development branch, feature branch, fix branch, etc. The current branch can be understood as the current branch. When a software development project includes multiple code repositories, the same branch can exist in multiple code repositories. It should be understood that the same branch of different code repositories may store different codes.

[0059] The embodiment of the present application may preset an anchor repository in advance, and the anchor repository may be any repository in a given plurality of code repositories, or may be another repository set up. The current branch of the anchor repository may change synchronously with the current branch of the code repository currently used by the user, so that the current branch of the anchor repository may indicate the current branch of the code repository currently used by the user.

[0060] For example, the code repository being operated may include a first branch, a second branch, and a third branch. If the current branch of the code repository being operated is the second branch, the current branch of the anchor repository is also the second branch. According to the current branch of the anchor repository being the second branch, a code repository whose current branch is also the second branch among the multiple code repositories may be determined as a candidate repository.

[0061] In an embodiment of the present application, the current branch of the anchor repository can indicate the current branch of the code repository currently used by the user. When the execution scenario is the default scenario, the code repository whose current branch is the same as the current branch of the anchor repository in multiple code repositories can be determined as a candidate repository based on the current branch of the preset anchor repository. The anchor repository can be used to effectively screen out code repositories whose current branch is the same as the code repository currently used by the user, thereby obtaining code repositories that may execute the above-mentioned operations to be executed. There is no need for the user to perform manual operations, which can reduce the user's workload and improve the efficiency of code repository management.

[0062] In some optional embodiments, executing the scenario includes specifying the scenario.

[0063] According to the execution scenario, determining a candidate repository for executing the operation to be executed from a given plurality of code repositories includes:

[0064] If the execution scenario is a specified scenario, the warehouse list is displayed and a warehouse selection instruction is received; wherein the warehouse list is used to display information of multiple code warehouses; according to the warehouse selection instruction, a selected code warehouse among the multiple code warehouses is determined, and the selected code warehouse is determined as a candidate warehouse.

[0065] The information of the code repository may include identification information of the code repository, branch information of the code repository, etc., as long as it is convenient for the user to select.

[0066] In the embodiment of the present application, the execution scenario also includes a specified scenario. When the execution scenario is a specified scenario, a warehouse list is displayed and a warehouse selection instruction is received. According to the warehouse selection instruction, a selected code warehouse among multiple code warehouses is determined, and the selected code warehouse is determined as a candidate warehouse. Through the warehouse list, optional code warehouses can be displayed to the user for selection, so that the user can flexibly select candidate warehouses, thereby better meeting the user's needs for executing operations to be executed. Moreover, in the process of determining the candidate warehouse in the embodiment of the present application, the user only needs to select the code warehouse in the warehouse list, without the need to switch the code warehouse, which can reduce the user's workload and improve the efficiency of code warehouse management.

[0067] In some optional embodiments, a target warehouse for executing the operation to be executed is determined from candidate warehouses based on the operation to be executed, including: judging whether the candidate warehouse meets the execution conditions of the operation to be executed based on the operation to be executed, and determining the candidate warehouse as the target warehouse when the candidate warehouse meets the execution conditions.

[0068] According to the operation to be executed, the execution conditions that need to be met to execute the operation to be executed can be determined. By judging whether the candidate warehouse meets the execution conditions of the operation to be executed, it can be judged whether the candidate warehouse can execute the operation. When a candidate warehouse meets the execution conditions of the operation to be executed, it means that the candidate warehouse can execute the operation, and the warehouse can be determined as the target warehouse. When a candidate warehouse does not meet the execution conditions of the operation to be executed, it means that the candidate warehouse cannot execute the operation, and the candidate warehouse can be excluded from the target warehouse.

[0069] As a feasible implementation method, a poller may be used to poll each candidate warehouse in turn to determine whether each candidate warehouse meets the execution condition of the operation to be executed.

[0070] In an embodiment of the present application, based on the operation to be executed, it is determined whether the candidate warehouse meets the execution conditions of the operation to be executed. The warehouses that do not meet the execution conditions can be excluded from the target warehouses, and only the candidate warehouses that meet the execution conditions are determined as the target warehouses. Therefore, the operation to be executed only needs to be executed in the candidate warehouses that meet the execution conditions, so as to improve the efficiency of executing the operation to be executed and avoid errors caused by the target warehouse not meeting the execution conditions.

[0071] The following is an explanation of the overall process of the code repository management method. Figure 3 As shown, the code repository management method may include some or all of the following steps:

[0072] S210: Receive user instructions.

[0073] S220: Determine, according to the user instruction, an operation instruction for indicating the operation to be performed and an execution scenario of the operation to be performed.

[0074] S221: Determine what the determined execution scenario is.

[0075] S231: If the execution scenario is the default scenario, then according to the current branch of the preset anchor repository, a code repository whose current branch is the same as the current branch of the anchor repository among the multiple code repositories is determined as a candidate repository.

[0076] S232: If the execution scenario is a specified scenario, the warehouse list is displayed and a warehouse selection instruction is received.

[0077] S233: Determine a selected code repository from the multiple code repositories according to the repository selection instruction, and determine the selected code repository as a candidate repository.

[0078] S241: According to the operation to be executed, determine whether the candidate warehouse meets the execution conditions of the operation to be executed.

[0079] S242: When the candidate warehouse meets the execution condition, the candidate warehouse is determined as the target warehouse.

[0080] S251: Generate assembly instructions according to the operation instructions.

[0081] S252: Based on the assembly instruction, a given version management tool is called to enable the version management tool to execute the operations to be executed in the target repository.

[0082] S260: Display the execution result of the operation to be executed.

[0083] In some optional embodiments, the operation to be performed includes a branch merge operation. Specifically, the branch merge operation may be to merge the current branch of the candidate warehouse into other branches in the candidate warehouse, and the other branches merged into may be recorded as target branches. The operation instruction may include information indicating the target branch corresponding to the current branch of the candidate warehouse, so that the target branch corresponding to the current branch of the candidate warehouse can be determined according to the operation instruction.

[0084] Determine whether the candidate warehouse meets the execution conditions of the operation to be executed, including:

[0085] If the operation to be executed is a branch merge operation, the target branch to which the current branch of the candidate warehouse is merged is determined according to the operation instruction, and it is judged whether the current branch of the candidate warehouse has changed relative to the corresponding target branch. If there is a change, it is determined that the candidate warehouse meets the execution conditions; if there is no change, it is determined that the candidate warehouse does not meet the execution conditions.

[0086] As a feasible implementation method, after determining the target branch corresponding to the current branch of the candidate warehouse, the code version of the current branch of the candidate warehouse and the code version of the corresponding target branch can be determined, and the code version of the current branch of the candidate warehouse is compared with the code version of the corresponding target branch to determine whether there is any change in the current branch of the candidate warehouse relative to the corresponding target branch.

[0087] As a feasible implementation method, if the code version of the current branch of the candidate warehouse is the same as the code version of the corresponding target branch, it can be considered that the current branch of the candidate warehouse has not changed relative to the corresponding target branch. If the code version of the current branch of the candidate warehouse is different from the code version of the corresponding target branch, it can be considered that the current branch of the candidate warehouse has changed relative to the corresponding target branch. Of course, other appropriate judgment conditions can also be used to judge whether the current branch of the candidate warehouse has changed relative to the corresponding target branch. The embodiment of the present application does not limit the specific judgment conditions.

[0088] In the embodiment of the present application, the operation to be executed includes a branch merge operation. When the operation to be executed is a branch merge operation, the target branch to which the current branch of the candidate warehouse is merged can be determined according to the operation instruction, and it can be determined whether the current branch of the candidate warehouse has changed relative to the corresponding target branch. If there is a change, it is determined that the candidate warehouse meets the execution condition. If there is no change, it is determined that the candidate warehouse does not meet the execution condition. Thus, the candidate warehouse whose current branch has not changed relative to the corresponding target branch can be excluded from the target warehouse, and there is no need to perform a branch merge operation on the candidate warehouse. In the prior art, when the current branch has not changed relative to the corresponding target branch, a corresponding branch merge operation will also be created. Compared with the prior art, the embodiment of the present application can significantly reduce the time for performing branch merge operations.

[0089] In some optional embodiments, determining whether a current branch of the candidate repository has changed relative to a corresponding target branch includes:

[0090] Obtain the first code version information of the current branch of the candidate warehouse on the local end, and the second code version information of the current branch of the candidate warehouse on the remote end.

[0091] The first code version information and the second code version information are compared to determine whether the current code version of the current branch of the candidate warehouse at the local end is the same as the current code version of the current branch of the candidate warehouse at the remote end.

[0092] If not, it is determined that there is no change in the current branch of the candidate repository relative to the corresponding target branch.

[0093] If so, obtain the third code version information of the target branch on the remote end, and determine whether the code versions of the target branch that have been updated previously include the current code version of the current branch of the candidate repository based on the third code version information; if so, determine that the current branch of the candidate repository has not changed relative to the corresponding target branch; if not, determine that the current branch of the candidate repository has changed relative to the corresponding target branch.

[0094] In the embodiment of the present application, each code version information may include a corresponding commit ID. The commit ID is a unique identifier used to mark the submission of the code to the data warehouse, and each submission has its own unique commit ID. It should be understood that the submission of the code is equivalent to updating the stored code, so the code version can be indicated by the commit ID.

[0095] As a feasible implementation method, the first code version information of the current branch of the candidate warehouse at the local end may include the latest commit ID of the current branch of the candidate warehouse at the local end. The second code version information of the current branch of the candidate warehouse at the remote end may include the latest commit ID of the current branch of the candidate warehouse at the remote end.

[0096] Compare the latest commit ID of the current branch of the candidate repository on the local side with the latest commit ID of the current branch of the candidate repository on the remote side. When the two latest commit IDs are the same, it can be determined that the current code version of the current branch of the candidate repository on the local side is the same as the current code version of the current branch of the candidate repository on the remote side. When the two latest commit IDs are different, it can be determined that the current code version of the current branch of the candidate repository on the local side is different from the current code version of the current branch of the candidate repository on the remote side.

[0097] When the current code version of the current branch of the candidate warehouse at the local end is different from the current code version of the current branch of the candidate warehouse at the remote end, the code version of the current branch of the candidate warehouse at the local end needs to be synchronized with the code version at the remote end (for example, the code version of the current branch of the candidate warehouse at the local end needs to be synchronized with the code version at the remote end), and the branch merge operation cannot be performed directly. Therefore, when the current code version of the current branch of the candidate warehouse at the local end is different from the current code version of the current branch of the candidate warehouse at the remote end, it can be deemed that the current branch of the candidate warehouse has not changed relative to the corresponding target branch. In an embodiment of the present application, when the current code version of the current branch of the candidate warehouse at the local end is different from the current code version at the remote end, it can be determined that the current branch of the candidate warehouse has not changed relative to the corresponding target branch, that is, the candidate warehouse is determined to not meet the execution conditions of the branch merge operation, which can avoid directly performing a branch merge operation on the current branch of the candidate warehouse and prevent errors in the branch merge operation.

[0098] The third code version information of the target branch corresponding to the current branch of the candidate warehouse on the remote end may include all the commit IDs of the target branch on the remote end. According to all the commit IDs of the target branch on the remote end.

[0099] If the current code version of the current branch of the candidate repository on the local side is the same as the current code version of the current branch of the candidate repository on the remote side, it is possible to determine whether all the commit IDs of the target branch on the remote side include the latest commit IDs of the current branch of the candidate repository on the local side and the remote side, and whether the code versions of the target branch that have been updated previously include the current code version of the current branch of the candidate repository.

[0100] Specifically, if the target branch includes the latest commit ID of the current branch of the candidate repository on the local and remote ends among all the commit IDs on the remote end, then the code versions of the target branch that have been updated in the past can be determined, including the current code version of the current branch of the candidate repository. If the target branch does not include the latest commit ID of the current branch of the candidate repository on the local and remote ends among all the commit IDs on the remote end, then the code versions of the target branch that have been updated in the past can be determined, excluding the current code version of the current branch of the candidate repository.

[0101] It should be understood that when the current code version of the current branch of the candidate repository on the local side is the same as the current code version of the current branch of the candidate repository on the remote side, the current code version of the current branch of the candidate repository is equivalent to the current code version of the current branch of the candidate repository on the local side, and is equivalent to the current code version of the current branch of the candidate repository on the remote side.

[0102] In an embodiment of the present application, when the current code version of the current branch of the candidate warehouse at the local end is the same as the current code version of the current branch of the candidate warehouse at the remote end, the third code version information of the target branch at the remote end can be obtained, and based on the third code version information, it can be determined whether the code versions of all previous updates of the target branch include the current code version of the current branch of the candidate warehouse. When the judgment result is yes, it can be determined that there is no change in the current branch of the candidate warehouse relative to the corresponding target branch, and when the judgment result is no, it can be determined that there is a change in the current branch of the candidate warehouse relative to the corresponding target branch. The user does not need to determine whether there is a change in the current branch of the candidate warehouse relative to the corresponding target branch through manual comparison, which is beneficial to improving the efficiency of determining whether the candidate warehouse meets the execution conditions, and can also avoid errors and omissions due to manual participation.

[0103] like Figure 4 As shown, the embodiment of the present application further provides a code repository management device 400, including:

[0104] The receiving module 410 is used to receive user instructions;

[0105] The parsing module 420 is used to determine, according to the user instruction, an operation instruction indicating the operation to be performed and an execution scenario of the operation to be performed;

[0106] A candidate repository determination module 430 is used to determine a candidate repository for executing the operation to be executed from a given plurality of code repositories according to an execution scenario;

[0107] A target warehouse determination module 440 is used to determine a target warehouse for executing the operation to be executed from candidate warehouses according to the operation to be executed;

[0108] The operation execution module 450 is used to execute the operation to be executed in the target warehouse according to the operation instruction.

[0109] It should be noted that the code repository management device provided in the embodiment of the present application and the embodiment of the aforementioned code repository management method are based on the same inventive concept and can achieve the same effect. The specific implementation process can be found in the description in the embodiment of the aforementioned code repository management method, which will not be repeated here.

[0110] The present application also provides an electronic device. Figure 5 , shows a schematic diagram of the structure of an electronic device according to an embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.

[0111] like Figure 5 As shown, the electronic device may include: a processor (processor) 502 , a communication interface (Communications Interface) 504 , a memory (memory) 506 , and a communication bus 508 .

[0112] in:

[0113] The processor 502 , the communication interface 504 , and the memory 506 communicate with each other via a communication bus 508 .

[0114] The communication interface 504 is used to communicate with other electronic devices or servers.

[0115] The processor 502 is used to execute at least one computer software 510, and specifically can execute the relevant steps in the above-mentioned code repository management method embodiment.

[0116] The processor 502 may be a CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0117] The memory 506 is used to store at least one computer software 510. The memory 506 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.

[0118] The computer software 510 may include multiple computer instructions. The computer software 510 may specifically enable the processor 502 to perform operations corresponding to the code repository management method described in any of the aforementioned multiple method embodiments through multiple computer instructions. The specific implementation of each step in the computer software 510 can refer to the corresponding descriptions in the corresponding steps and units in the aforementioned method embodiments, and has corresponding beneficial effects, which are not repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the aforementioned method embodiments, which is not repeated here.

[0119] The present application also provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned method embodiments is implemented. The storage medium includes, but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk, or a magneto-optical disk.

[0120] The present application also provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes but is not limited to: a compact disc read-only memory (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.

[0121] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to the method described in any one of the aforementioned multiple method embodiments.

[0122] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.

[0123] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.

[0124] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.

Claims

1. A code repository management method, characterized in that: include: Receive user instructions; Determining, according to the user instruction, an operation instruction for indicating an operation to be performed, and an execution scenario of the operation to be performed; According to the execution scenario, determining a candidate repository for executing the operation to be executed from a given plurality of code repositories; According to the operation to be performed, determining a target warehouse for performing the operation to be performed from the candidate warehouses; According to the operation instruction, the operation to be performed is performed in the target warehouse.

2. The code repository management method according to claim 1, characterized in that: The execution scenario includes a default scenario; The step of determining, according to the execution scenario, a candidate repository for executing the operation to be executed from a given plurality of code repositories includes: If the execution scenario is a default scenario, then according to the current branch of a preset anchor repository, a code repository whose current branch is the same as the current branch of the anchor repository among the multiple code repositories is determined as the candidate repository.

3. The code repository management method according to claim 2, characterized in that: The execution scenario includes a specified scenario; The step of determining, according to the execution scenario, a candidate repository for executing the operation to be executed from a given plurality of code repositories includes: If the execution scenario is a specified scenario, a warehouse list is displayed, and a warehouse selection instruction is received; wherein the warehouse list is used to display information of the multiple code warehouses; According to the repository selection instruction, a selected code repository among the multiple code repositories is determined, and the selected code repository is determined as the candidate repository.

4. The code repository management method according to claim 1, characterized in that: The step of determining, according to the operation to be performed, a target warehouse for performing the operation to be performed from the candidate warehouses includes: According to the operation to be executed, it is determined whether the candidate warehouse meets the execution condition of the operation to be executed, and when the candidate warehouse meets the execution condition, the candidate warehouse is determined as the target warehouse.

5. The code repository management method according to claim 4, characterized in that: The operations to be performed include branch merging operations; The determining whether the candidate warehouse meets the execution condition of the operation to be executed includes: If the operation to be executed is the branch merge operation, the target branch to which the current branch of the candidate warehouse is merged is determined according to the operation instruction, and it is judged whether the current branch of the candidate warehouse has changed relative to the corresponding target branch. If there is a change, it is determined that the candidate warehouse meets the execution condition; if there is no change, it is determined that the candidate warehouse does not meet the execution condition.

6. The code repository management method according to claim 5, characterized in that: The determining whether the current branch of the candidate repository has changed relative to the corresponding target branch includes: Obtaining first code version information of the current branch of the candidate warehouse at the local end, and second code version information of the current branch of the candidate warehouse at the remote end; Comparing the first code version information with the second code version information, determining whether the current code version of the current branch of the candidate warehouse at the local end is the same as the current code version of the current branch of the candidate warehouse at the remote end; If not, determining that the current branch of the candidate repository has not changed relative to the corresponding target branch; If yes, obtain the third code version information of the target branch on the remote end, and determine whether the code versions of the target branch that have been updated all the time include the current code version of the current branch of the candidate warehouse according to the third code version information; If so, it is determined that the current branch of the candidate warehouse has not changed relative to the corresponding target branch; if not, it is determined that the current branch of the candidate warehouse has changed relative to the corresponding target branch.

7. A code repository management device, characterized in that: include: A receiving module, used for receiving user instructions; A parsing module, used to determine, according to the user instruction, an operation instruction indicating an operation to be performed, and an execution scenario of the operation to be performed; A candidate repository determination module, configured to determine a candidate repository for executing the operation to be executed from a given plurality of code repositories according to the execution scenario; A target warehouse determination module, configured to determine, according to the operation to be executed, a target warehouse for executing the operation to be executed from the candidate warehouses; An operation execution module is used to execute the operation to be executed in the target warehouse according to the operation instruction.

8. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one computer software, and the computer software enables the processor to execute the method according to any one of claims 1-6.

9. A computer storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1 to 6.

10. A computer program product, comprising computer instructions, wherein the computer instructions instruct a computing device to perform operations corresponding to the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Operation instruction response method and device, equipment and storage medium

    CN112631652A

  • Code warehouse management method and device, electronic equipment and storage medium

    CN115904933A