A method, device, equipment and storage medium for demand switching in code development

By storing and switching code warehouse lists and their branch forms, the problem of switching requirements in code development on multi-component devices is solved, and the continuity of fast switching and code development is achieved.

CN114756222BActive Publication Date: 2025-09-02BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110026218.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-08
Publication Date
2025-09-02
Estimated Expiration
2041-02-26

AI Technical Summary

Technical Problem

During product development, how to switch requirements when multiple components are simultaneously code development on the same device to ensure the normal progress of code development.

Method used

By storing the warehouse list and its branch form of the first requirement, obtaining and switching to the warehouse list and its branch form of the second requirement, and saving local modified code during the switching process to ensure the continuity and accuracy of code development.

Benefits of technology

It realizes rapid switching between multiple requirements, ensures the restoration of branch forms of the code repository and local code changes, and ensures the normal progress and efficiency of code development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114756222B_ABST
    Figure CN114756222B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, apparatus, device and storage medium for switching requirements in code development, the method comprising: in the process of code development, when a trigger operation for switching from a first requirement to a second requirement is received, first storing a first warehouse list corresponding to the first requirement, and the branch form of the code warehouse in the first warehouse list under the first requirement. Then, obtaining a second warehouse list corresponding to the second requirement, and the branch form of the code warehouse in the second warehouse list under the second requirement. Finally, based on the branch form of the code warehouse in the second warehouse list under the second requirement, code development is performed for the second requirement. It can be seen that the embodiment of the present disclosure can achieve rapid switching between multiple requirements, and at the same time can ensure the restoration of the branch form of each code warehouse after the requirement switching, thereby ensuring the normal progress of code development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a method, apparatus, device, and storage medium for demand switching in code development. Background Art

[0002] As product complexity increases, the number of people involved in product development also increases. Therefore, for a project, it is usually developed by disassembling components. Each component may have an independent code repository for code management and version tracking.

[0003] In actual product development, developers often develop multiple components simultaneously, rather than developing a single component independently. Developing two components simultaneously on the same device can be understood as requiring two requirements to be met simultaneously. During product development, these requirements can be switched to allow for simultaneous development of both components.

[0004] In order to ensure that multiple components can be developed simultaneously on a single device, how to implement demand switching during code development and ensure the normal progress of component development is a technical problem that urgently needs to be solved. Summary of the Invention

[0005] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, device, equipment and storage medium for demand switching in code development, which can realize rapid switching between multiple requirements, restore the development scenarios corresponding to the requirements, and ensure the normal progress of code development.

[0006] In a first aspect, the present disclosure provides a method for demand switching in code development, the method comprising:

[0007] In response to a trigger operation of switching from a first requirement to a second requirement, storing a first repository list corresponding to the first requirement and a branch form of the code repository in the first repository list under the first requirement;

[0008] Obtaining a code repository in a second repository list corresponding to the second requirement, and switching the code repository in the second repository list to a branch form under the second requirement;

[0009] Based on the branch form of the code repository in the second repository list under the second requirement, code development is performed for the second requirement.

[0010] Optionally, before obtaining the code repository in the second repository list corresponding to the second requirement, the method further includes:

[0011] Storing the locally modified code of the code repository in the first repository list in a cache;

[0012] Accordingly, before developing code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement, the method further includes:

[0013] Restoring the locally modified code in the code repository in the second repository list in the cache;

[0014] Accordingly, developing code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement includes:

[0015] Based on the branch form of the code repository in the second repository list under the second requirement and the locally modified code, code development is performed for the second requirement.

[0016] Optionally, the process of developing code for the second requirement further includes:

[0017] In response to a deletion operation on a first component, querying a code repository to which the first component belongs;

[0018] Deleting the branch form of the code repository to which the first component belongs under the second requirement, and moving the code repository into the cache;

[0019] Remove the code repository to which the first component belongs from the second repository list corresponding to the second requirement.

[0020] Optionally, after querying the code repository to which the first component belongs, the method further includes:

[0021] Determining whether there is locally modified code of the code repository to which the first component belongs in the cache;

[0022] If the locally modified code of the code repository to which the first component belongs exists in the cache, the locally modified code of the code repository to which the first component belongs is deleted from the cache.

[0023] Optionally, the process of developing code for the second requirement further includes:

[0024] In response to the adding operation on the second component, obtaining the code repository to which the second component belongs;

[0025] Creating a branch form of the code repository to which the second component belongs based on the second requirement;

[0026] Add the code repository to which the second component belongs to the second repository list corresponding to the second requirement.

[0027] Optionally, obtaining the code repository to which the second component belongs includes:

[0028] Determine whether the code repository to which the second component belongs belongs to the second repository list corresponding to the second requirement;

[0029] If it is determined that the code repository to which the second component belongs does not belong to the second repository list, the code repository to which the second component belongs is obtained.

[0030] Optionally, the method further includes:

[0031] If it is determined that the code repository to which the second component belongs belongs to the second repository list, obtaining the locally modified code of the code repository to which the second component belongs;

[0032] Accordingly, the step of creating a branch form of the code repository to which the second component belongs under the second requirement includes:

[0033] Based on the locally modified code of the code repository to which the second component belongs, a branch form of the code repository to which the second component belongs is created under the second requirement.

[0034] Optionally, after developing code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement, the method further includes:

[0035] In response to a code submission operation for the second requirement, generating submission information corresponding to the second requirement; wherein the submission information includes a correspondence between a submission repository address and submission repository branch information;

[0036] The submitted information is uploaded to a remote server.

[0037] Optionally, the method further includes:

[0038] In response to the creation operation of the third requirement, pull the submission information corresponding to the third requirement from the remote server; wherein the submission information includes a correspondence between the submission repository address and the submission repository branch information;

[0039] Based on the correspondence between the submitted warehouse address and the submitted warehouse branch information in the submitted information, a warehouse list corresponding to the third requirement and the branch status of the code warehouse in the warehouse list are obtained.

[0040] Optionally, the method further includes:

[0041] In response to the batch processing operation on the code repositories in the second repository list corresponding to the second requirement, the batch processing operation is performed on each code repository in the second repository list.

[0042] In a second aspect, the present disclosure provides a device for demand switching in code development, the device comprising:

[0043] A first storage module is configured to, in response to a triggering operation of switching from a first requirement to a second requirement, store a first repository list corresponding to the first requirement and a branch form of the code repository in the first repository list under the first requirement;

[0044] A first acquisition module is configured to acquire a code repository in a second repository list corresponding to the second requirement;

[0045] A switching module, configured to switch the code repository in the second repository list to a branch form under the second requirement;

[0046] A development module is used to develop code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement.

[0047] In a third aspect, the present disclosure provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium. When the instructions are executed on a terminal device, the terminal device implements the above method.

[0048] In a fourth aspect, the present disclosure provides a device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method when executing the computer program.

[0049] The technical solution provided by the embodiments of the present disclosure has the following advantages over the prior art:

[0050] The embodiment of the present disclosure provides a method for switching requirements in code development. During the code development process, when a trigger operation is received to switch from a first requirement to a second requirement, the first warehouse list corresponding to the first requirement and the branch form of the code warehouse in the first warehouse list under the first requirement are first stored. Then, the second warehouse list corresponding to the second requirement and the branch form of the code warehouse in the second warehouse list under the second requirement are obtained. Finally, based on the branch form of the code warehouse in the second warehouse list under the second requirement, code development is performed for the second requirement. It can be seen that the embodiment of the present disclosure can achieve rapid switching between multiple requirements, and at the same time can ensure the restoration of the branch form of each code warehouse after the requirement switching, thereby ensuring the normal progress of code development. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0052] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0053] Figure 1 A flowchart of a method for switching requirements in code development provided by an embodiment of the present disclosure;

[0054] Figure 2 A flowchart of another method for demand switching in code development provided by an embodiment of the present disclosure;

[0055] Figure 3 A flowchart of a component deletion method provided in an embodiment of the present disclosure;

[0056] Figure 4 A flowchart of a component adding method provided in an embodiment of the present disclosure;

[0057] Figure 5 A schematic diagram of the structure of a demand switching device in code development provided by an embodiment of the present disclosure;

[0058] Figure 6 A schematic diagram of the structure of a demand switching device in code development provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0059] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.

[0060] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0061] In the disclosed embodiments, a requirement in code development may correspond to a component development task, a bug repair task, or a specific code problem solving task, and may refer to a task that a developer is solving during the code development process.

[0062] In actual applications, when multiple requirements exist simultaneously on a device, tasks corresponding to different requirements can be completed by switching between them. Since different requirements often correspond to different code repositories, for example, a bug fix task might correspond to code repositories A and B, while a component development task might correspond to code repositories C. Therefore, when requirements are switched, the corresponding code repositories are switched simultaneously.

[0063] In addition, code repositories also have the concept of branching. A code repository's branching refers to its specific form at a specific time. Typically, a code repository's branching forms vary depending on different requirements. For example, the branching form of code repository D under the first requirement might include components A and B, while the branching form of code repository D under the second requirement might only include component A.

[0064] In order to ensure that code development can proceed normally after switching requirements, it is necessary to restore the development scenario corresponding to the switched requirements at the same time as the requirements are switched.

[0065] To this end, an embodiment of the present disclosure provides a method for switching requirements in code development. During the code development process, when a trigger operation is received to switch from a first requirement to a second requirement, the first warehouse list corresponding to the first requirement and the branch form of the code warehouse in the first warehouse list under the first requirement are first stored. Then, the second warehouse list corresponding to the second requirement and the branch form of the code warehouse in the second warehouse list under the second requirement are obtained. Finally, based on the branch form of the code warehouse in the second warehouse list under the second requirement, code development is performed for the second requirement. It can be seen that the embodiment of the present disclosure can achieve rapid switching between multiple requirements, and at the same time can ensure the restoration of the branch form of each code warehouse after the requirement switching, thereby ensuring the normal progress of code development.

[0066] Based on this, the embodiment of the present disclosure provides a method for demand switching in code development, referring to Figure 1 , is a flowchart of a method for demand switching in code development provided by an embodiment of the present disclosure, the method comprising:

[0067] S101: In response to a triggering operation of switching from a first requirement to a second requirement, a first repository list corresponding to the first requirement and a branch form of the code repository in the first repository list under the first requirement are stored.

[0068] In the disclosed embodiment, users can freely switch between requirements in the development state corresponding to the first requirement. Assuming that the user triggers the operation of switching from the first requirement to the second requirement, the disclosed embodiment first stores the first repository list corresponding to the first requirement and the branch form of the code repository in the first repository list under the first requirement to ensure that the scene can be restored when switching back to the first requirement.

[0069] In an optional implementation, the first warehouse list corresponding to the first requirement and the branch form of the code warehouse in the first warehouse list under the first requirement are stored. The first warehouse list corresponding to the first requirement and the branch form of the code warehouse in the first warehouse list under the first requirement can be moved to the cache so that they can be restored from the cache later.

[0070] Among them, the first warehouse list includes the code warehouse required to complete the task corresponding to the first requirement. For example, the task corresponding to the first requirement is the development of component A. At the same time, the development requirement of component A depends on the components in code warehouses A and B. Then the first warehouse list corresponding to the first requirement includes code warehouses A and B.

[0071] In addition, the branch form of the code repository under the first requirement may be components contained in the code repository under the first requirement, etc.

[0072] In an optional implementation, the second requirement can be a requirement that already exists in the current code development system, or the second requirement can also be a requirement that does not exist in the current code development system and needs to be newly created. Therefore, when receiving a trigger operation to switch from the first requirement to the second requirement, it is first necessary to determine whether the second requirement already exists in the current code development system.

[0073] S102: Obtain the code repository in the second repository list corresponding to the second requirement, and switch the code repository in the second repository list to a branch form under the second requirement.

[0074] In the disclosed embodiment, after receiving a trigger operation to switch from a first requirement to a second requirement, in order to restore the scene for the second requirement, a second repository list corresponding to the second requirement can be retrieved from the cache, and the code repository in the second repository list can be obtained. Specifically, it is determined whether the code repository in the second repository list is locally available. If not, the code repository is downloaded from a remote server to ensure that all code repositories in the second repository list are locally available.

[0075] In addition, after obtaining the code repositories in the second warehouse list, each code repository in the second warehouse list is switched to the branch form under the second requirement to ensure that the code development under the second requirement proceeds normally.

[0076] In an optional implementation, if the second requirement is a requirement that already exists in the current code development system, the branch form of the code repository in the second repository list under the second requirement can be obtained from the cache, and each code repository can be switched to the branch form under the second requirement.

[0077] In another optional implementation, if the second requirement does not exist in the current code development system and needs to be newly created, the first warehouse list of the current requirement (i.e., the first requirement) can be copied as the second warehouse list corresponding to the newly created second requirement, and it is determined that each code warehouse in the second warehouse list exists locally. If the branch form of the code warehouse under the second requirement is pre-configured, each code warehouse is switched to the pre-configured branch form. Otherwise, the branch form of each code warehouse in the first warehouse list under the current requirement can be copied.

[0078] It is worth noting that the above-mentioned method of creating new requirements is only an optional method. The embodiment of the present disclosure can also configure the second warehouse list corresponding to the second requirement based on the code development requirements, as well as the branch form of the code warehouse in the second warehouse list under the second requirement. The embodiment of the present disclosure does not limit this.

[0079] S103: Develop code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement.

[0080] In the embodiment of the present disclosure, after the code repositories in the second repositories list are switched to the branch form under the second requirement, code development can be performed for the second requirement based on the branch forms of each code repositories under the second requirement.

[0081] In the requirement switching method in code development provided by the embodiment of the present disclosure, during the process of code development, when a trigger operation is received to switch from a first requirement to a second requirement, the first warehouse list corresponding to the first requirement and the branch form of the code warehouse in the first warehouse list under the first requirement are first stored. Then, the second warehouse list corresponding to the second requirement and the branch form of the code warehouse in the second warehouse list under the second requirement are obtained. Finally, based on the branch form of the code warehouse in the second warehouse list under the second requirement, code development is performed for the second requirement. It can be seen that the embodiment of the present disclosure can achieve rapid switching between multiple requirements, and at the same time can ensure the restoration of the branch form of each code warehouse after the requirement switching, thereby ensuring the normal progress of code development.

[0082] In order to ensure that the local changes in the code repository can be retained after the requirement is switched, after receiving the trigger operation of switching from the first requirement to the second requirement, the embodiment of the present disclosure also needs to store the locally modified code of the code repository in the first repository list in the cache, so that when switching back to the first requirement later, the local changes in the code repository corresponding to the first requirement can be restored.

[0083] refer to Figure 2 , is a flowchart of another method for demand switching in code development provided by an embodiment of the present disclosure, the method comprising:

[0084] S201: In response to a triggering operation of switching from a first requirement to a second requirement, a first repository list corresponding to the first requirement and a branch form of the code repository in the first repository list under the first requirement are stored.

[0085] S202: Storing the locally modified code of the code repository in the first repository list in a cache.

[0086] In the embodiment of the present disclosure, locally modified code refers to code that is modified in a local code repository and has not been submitted to a remote server.

[0087] In actual applications, when a trigger operation is received to switch from a first requirement to a second requirement, the locally modified code of the code repository in the first repository list corresponding to the first requirement is stored in the cache, so that when switching back to the first requirement in the future, the local changes in the code repository corresponding to the first requirement can be restored to avoid the loss of the locally modified code in the code repository.

[0088] S203: Obtain the code repository in the second repository list corresponding to the second requirement, and switch the code repository in the second repository list to a branch form under the second requirement.

[0089] S204: Restore the locally modified code of the code repository in the second repository list in the cache.

[0090] In an embodiment of the present disclosure, when a trigger operation to switch from a first requirement to a second requirement is received, the code repository in the second repository list corresponding to the second requirement is obtained, and the code repository is switched to a branch form under the second requirement. If there are local changes in the code repository in the second repository list, the local modified code of the code repository is restored from the cache, so that the code development for the second requirement can continue based on the restored local changes in the code repository.

[0091] S205: Based on the branch form of the code repository in the second repository list under the second requirement and the locally modified code, code development is performed for the second requirement.

[0092] The embodiments of the present disclosure can be understood with reference to the description in the above embodiments, which will not be repeated here.

[0093] The disclosed embodiment can achieve rapid switching between multiple requirements, while ensuring the branch form of each code repository and the restoration of local code changes after the requirement switching, thereby ensuring the normal progress of code development.

[0094] In actual applications, since the second warehouse list corresponding to the second requirement usually includes multiple code warehouses, and the commands executed on each code warehouse have great similarity, for the same command that needs to be executed by each code warehouse, the embodiment of the present disclosure can use a batch processing method to uniformly control each code warehouse to execute the command.

[0095] Specifically, in response to the batch processing operation on the code repository in the second repository list corresponding to the second requirement, the batch processing operation is performed on each code repository in the second repository list.

[0096] In addition, for each code repository at the operating system level, batch operations can also be used to implement unified configuration of each code repository, such as but not limited to user information configuration, Hook script configuration, etc.

[0097] The disclosed embodiments utilize batch processing capabilities to globally and uniformly control the status of all code repositories, thereby improving the control efficiency of the code repositories.

[0098] Based on the above embodiment, the embodiment of the present disclosure can also delete the first component during the process of developing code for the second requirement. Deleting the first component is actually deleting the code repository to which the first component belongs.

[0099] For this reason, in the above Figure 1 or Figure 2 On the basis of this, further, the embodiment of the present disclosure also provides a flowchart of a component deletion method, referring to Figure 3 , wherein the method comprises:

[0100] S301: In response to a deletion operation on a first component, query the code repository to which the first component belongs.

[0101] In an embodiment of the present disclosure, upon receiving a delete operation for a first component, the code repository to which the first component belongs is first queried. Specifically, upon receiving a delete operation for the first component, a code repository query request may be sent to a dependency management tool on each platform, wherein the code repository query request carries an identifier of the first component, such as the component name. The dependency management tool may query the code repository to which the first component belongs and return the query result.

[0102] Among them, the dependency management tools of each platform may include CocoaPods, Gradle and other dependency management tools.

[0103] S302: Delete the branch form of the code repository to which the first component belongs under the second requirement, and move the code repository into the cache.

[0104] In an embodiment of the present disclosure, after querying the code repository to which the first component belongs, it is determined whether the code repository belongs to the code repository corresponding to the current requirement (i.e., the second requirement). If so, the branch form of the code repository under the current requirement is deleted, and the code repository is moved into the cache.

[0105] The reason for moving the code repository into the cache instead of actually deleting it from the local device is that when the code repository is subsequently downloaded again, it can be restored from the cache, thereby improving the efficiency of obtaining the code repository.

[0106] In an optional implementation, it is also possible to determine whether there is locally modified code of the code repository to which the first component belongs in the cache. If so, the locally modified code is deleted from the cache, thereby achieving the effect of deleting the code repository to which the first component belongs.

[0107] S303: Remove the code repository to which the first component belongs from the second repository list corresponding to the second requirement.

[0108] In an embodiment of the present disclosure, after the first component is deleted, thereby triggering the deletion of the code repository to which the first component belongs, the second repository list corresponding to the second requirement is updated, that is, the code repository to which the first component belongs is removed from the second repository list.

[0109] Based on the above embodiment, the embodiment of the present disclosure can also add a second component during the process of developing code for the second requirement, wherein the addition of the second component is actually the addition of the code repository to which the second component belongs.

[0110] For this reason, in the above Figure 1 or Figure 2 On the basis of this, further, the embodiment of the present disclosure also provides a flowchart of a component adding method, referring to Figure 4 , wherein the method comprises:

[0111] S401: In response to an add operation on a second component, obtain a code repository to which the second component belongs.

[0112] In the disclosed embodiment, upon receiving an add operation for a second component, the code repository to which the second component belongs is first queried. Specifically, upon receiving an add operation for the second component, a code repository query request may be sent to the dependency management tool of each platform, wherein the code repository query request carries an identifier of the second component, such as the component name. The dependency management tool may query the code repository to which the second component belongs and return the query result.

[0113] Among them, the dependency management tools of each platform may include CocoaPods, Gradle and other dependency management tools.

[0114] In an optional implementation, after querying the code repository to which the second component belongs, the code repository is obtained. Specifically, it is determined whether the code repository belongs to the second repository list corresponding to the current requirement (i.e., the second requirement). If not, it is further determined whether the code repository is in the local cache. If so, the code repository is obtained from the cache; otherwise, the code repository is downloaded from the remote server.

[0115] S402: Create a branch form of the code repository to which the second component belongs under the second requirement.

[0116] In the embodiment of the present disclosure, after obtaining the code repository to which the second component belongs, a branch form is created for the code repository under the second requirement.

[0117] In an optional implementation, a branch form can be created based on the program version information corresponding to the code repository. For example, assuming that the program version information corresponding to the code repository is 1.0, the state of the code repository in the program version information 1.0 can be determined as its branch form under the second requirement.

[0118] In another optional implementation, if it is determined that the code repository to which the second component belongs is included in the second repository list, the locally modified code of the code repository to which the second component belongs is obtained, and the local changes to the code repository are restored. Then, based on the locally modified code in the code repository, a branch form of the code repository is created based on the second requirement.

[0119] S403: Add the code repository to which the second component belongs to the second repository list corresponding to the second requirement.

[0120] In an embodiment of the present disclosure, after the code repository to which the second component belongs is added under the second requirement, the code repository is added to the second repository list corresponding to the second requirement to update the code repository corresponding to the second requirement.

[0121] The disclosed embodiment can not only realize fast switching between multiple requirements, but also add components required for the current requirement after the requirement is switched, and delete components in the current requirement, while ensuring the normal progress of code development.

[0122] On the basis of the above embodiment, the present disclosure may also trigger a code submission operation corresponding to the second requirement after code development is completed for the second requirement.

[0123] Since the code submission operation corresponding to the second requirement usually includes submission to multiple code repositories, in order to allow other project members to understand the information of the code submission for the second requirement, the embodiment of the present disclosure generates submission information corresponding to the second requirement when receiving the code submission operation for the second requirement.

[0124] The commit information may include a correspondence between the commit repository address and the commit repository branch information. The commit repository address is used to locate the code repository, and the commit repository branch information is used to indicate information such as the branch form of the submitted code repository. Typically, the commit information includes multiple correspondences between commit repository addresses and commit repository branch information.

[0125] In the disclosed embodiment, after the submission information corresponding to the second requirement is generated, the submission information is uploaded to a remote server. Other project members can download the submission information from the remote server to understand the information of each code repository submitted this time.

[0126] In addition, in the embodiment of the present disclosure, when creating a new requirement, submission information can also be pulled from a remote server, and then subsequent code development can be performed based on the code repository in the submission information.

[0127] Specifically, in response to the creation operation of the third requirement, the submission information corresponding to the third requirement is pulled from the remote server; wherein, the submission information includes the correspondence between the submission warehouse address and the submission warehouse branch information; then, based on the correspondence between the submission warehouse address and the submission warehouse branch information in the submission information, the warehouse list corresponding to the third requirement and the branch status of the code warehouse in the warehouse list are obtained.

[0128] The embodiment of the present disclosure can create a third requirement based on the submitted information pulled from the remote server at one time, thereby improving the efficiency of requirement creation.

[0129] Based on the above method embodiment, the present disclosure also provides a demand switching device in code development, referring to Figure 5 , is a schematic structural diagram of a demand switching device in code development provided by an embodiment of the present disclosure, the device comprising:

[0130] A first storage module 501 is configured to, in response to a triggering operation of switching from a first requirement to a second requirement, store a first repository list corresponding to the first requirement and a branch form of the code repository in the first repository list under the first requirement;

[0131] A first acquisition module 502 is configured to acquire a code repository in a second repository list corresponding to the second requirement;

[0132] A switching module 503 is configured to switch the code repository in the second repository list to a branch form under the second requirement;

[0133] The development module 504 is configured to develop code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement.

[0134] In an optional embodiment, the device further includes:

[0135] A second storage module is configured to store the locally modified code of the code repository in the first repository list in a cache;

[0136] Accordingly, the device further includes:

[0137] A restoration module, configured to restore the locally modified code of the code repository in the second repository list in the cache;

[0138] Accordingly, the development module is specifically used to:

[0139] Based on the branch form of the code repository in the second repository list under the second requirement and the locally modified code, code development is performed for the second requirement.

[0140] In an optional embodiment, the device further includes:

[0141] a query module, configured to query a code repository to which the first component belongs in response to a deletion operation on the first component;

[0142] A first deletion module is configured to delete the branch form of the code repository to which the first component belongs under the second requirement, and move the code repository into a cache;

[0143] A removal module is used to remove the code repository to which the first component belongs from the second repository list corresponding to the second requirement.

[0144] In an optional embodiment, the device further includes:

[0145] a determination module, configured to determine whether there is locally modified code of the code repository to which the first component belongs in the cache;

[0146] The second deleting module is configured to delete the locally modified code of the code repository to which the first component belongs from the cache when the locally modified code of the code repository to which the first component belongs exists in the cache.

[0147] In an optional embodiment, the device further includes:

[0148] A second acquisition module is configured to acquire a code repository to which the second component belongs in response to an add operation on the second component;

[0149] A creation module is used to create a branch form of the code repository to which the second component belongs under the second requirement;

[0150] An adding module is used to add the code repository to which the second component belongs to the second repository list corresponding to the second requirement.

[0151] In an optional implementation, the second acquisition module includes:

[0152] A first determining submodule, configured to determine whether the code repository to which the second component belongs belongs to a second repository list corresponding to the second requirement;

[0153] The first acquisition submodule is configured to acquire the code repository to which the second component belongs when it is determined that the code repository to which the second component belongs does not belong to the second repository list.

[0154] In an optional embodiment, the device further includes:

[0155] A third acquisition module is configured to, upon determining that the code repository to which the second component belongs belongs to the second repository list, acquire the locally modified code of the code repository to which the second component belongs;

[0156] Accordingly, the creation module is specifically used to:

[0157] Based on the locally modified code of the code repository to which the second component belongs, a branch form of the code repository to which the second component belongs is created under the second requirement.

[0158] In an optional embodiment, the device further includes:

[0159] a generation module, configured to generate submission information corresponding to the second requirement in response to a code submission operation for the second requirement; wherein the submission information includes a correspondence between a submission repository address and submission repository branch information;

[0160] The upload module is used to upload the submitted information to a remote server.

[0161] In an optional embodiment, the device further includes:

[0162] A pulling module, configured to pull, in response to a creation operation of a third requirement, submission information corresponding to the third requirement from a remote server; wherein the submission information includes a correspondence between a submission repository address and submission repository branch information;

[0163] The fourth acquisition module is used to obtain the warehouse list corresponding to the third requirement and the branch status of the code warehouse in the warehouse list based on the correspondence between the submission warehouse address and the submission warehouse branch information in the submission information.

[0164] In an optional embodiment, the device further includes:

[0165] A batch processing module is configured to, in response to a batch processing operation on a code repository in a second repository list corresponding to the second requirement, execute the batch processing operation on each code repository in the second repository list.

[0166] The demand switching device in code development provided by the embodiment of the present disclosure, during the process of code development, when a trigger operation of switching from a first demand to a second demand is received, first stores the first warehouse list corresponding to the first demand, and the branch form of the code warehouse in the first warehouse list under the first demand. Then, obtain the second warehouse list corresponding to the second demand, and the branch form of the code warehouse in the second warehouse list under the second demand. Finally, based on the branch form of the code warehouse in the second warehouse list under the second demand, code development is performed for the second demand. It can be seen that the embodiment of the present disclosure can achieve rapid switching between multiple demands, and at the same time can ensure the restoration of the branch form of each code warehouse after the demand switching, thereby ensuring the normal progress of code development.

[0167] In addition to the above-mentioned methods and apparatus, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal device, the terminal device implements the demand switching method in code development described in the embodiment of the present disclosure.

[0168] The embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, characterized in that when the computer program / instruction is executed by a processor, the method for demand switching in code development described in the embodiment of the present disclosure is implemented.

[0169] In addition, the embodiment of the present disclosure also provides a demand switching device in code development, see Figure 6 As shown, this may include:

[0170] Processor 601, memory 602, input device 603 and output device 604. The number of processors 601 in the demand switching device in code development can be one or more. Figure 6 In some embodiments of the present disclosure, the processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means, wherein: Figure 6 The bus connection is taken as an example.

[0171] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing of the demand switching device in code development by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. The input device 603 can be used to receive input digital or character information, and to generate signal input related to user settings and function control of the demand switching device in code development.

[0172] Specifically in this embodiment, the processor 601 will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 will run the applications stored in the memory 602, thereby realizing the various functions of the demand switching device in the above code development.

[0173] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0174] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.

Claims

1. A method for demand switching in code development, characterized in that: The method comprises: In response to a triggering operation of switching from a first requirement to a second requirement, a first repository list corresponding to the first requirement and the branch forms of the code repositories in the first repository list under the first requirement are stored, and locally modified code of the code repositories in the first repository list is stored in a cache; wherein the first repository list includes the code repositories required for the task corresponding to the first requirement; If it is determined that the second requirement does not exist in the current code development system, configuring a second repository list corresponding to the second requirement, switching the code repository in the second repository list to a pre-configured branching form, and performing code development for the second requirement based on the code repository in the second repository list in the pre-configured branching form; If it is determined that the second requirement exists in the current code development system, the code repository in the second warehouse list corresponding to the second requirement is obtained, and the code repository in the second warehouse list is switched to the branch form under the second requirement, and the local modified code of the code repository in the second warehouse list in the cache is restored. Based on the branch form of the code repository in the second warehouse list under the second requirement and the local modified code, code development is performed for the second requirement.

2. The method according to claim 1, characterized in that The process of developing code for the second requirement further includes: In response to a deletion operation on a first component, querying a code repository to which the first component belongs; Deleting the branch form of the code repository to which the first component belongs under the second requirement, and moving the code repository into the cache; Remove the code repository to which the first component belongs from the second repository list corresponding to the second requirement.

3. The method according to claim 2, characterized in that After querying the code repository to which the first component belongs, the method further includes: Determining whether there is locally modified code of the code repository to which the first component belongs in the cache; If the locally modified code of the code repository to which the first component belongs exists in the cache, the locally modified code of the code repository to which the first component belongs is deleted from the cache.

4. The method according to claim 1, wherein The process of developing code for the second requirement further includes: In response to the adding operation on the second component, obtaining the code repository to which the second component belongs; Creating a branch form of the code repository to which the second component belongs based on the second requirement; Add the code repository to which the second component belongs to the second repository list corresponding to the second requirement.

5. The method according to claim 4, characterized in that The obtaining of the code repository to which the second component belongs includes: Determine whether the code repository to which the second component belongs belongs to the second repository list corresponding to the second requirement; If it is determined that the code repository to which the second component belongs does not belong to the second repository list, the code repository to which the second component belongs is obtained.

6. The method according to claim 5, characterized in that The method further comprises: If it is determined that the code repository to which the second component belongs belongs to the second repository list, obtaining the locally modified code of the code repository to which the second component belongs; Accordingly, the step of creating a branch form of the code repository to which the second component belongs under the second requirement includes: Based on the locally modified code of the code repository to which the second component belongs, a branch form of the code repository to which the second component belongs is created under the second requirement.

7. The method according to claim 1, characterized in that After developing code for the second requirement based on the branch form of the code repository in the second repository list under the second requirement, the method further includes: In response to a code submission operation for the second requirement, generating submission information corresponding to the second requirement; wherein the submission information includes a correspondence between a submission repository address and submission repository branch information; The submitted information is uploaded to a remote server.

8. The method according to claim 1, characterized in that The method further comprises: In response to the creation operation of the third requirement, pull the submission information corresponding to the third requirement from the remote server; wherein the submission information includes a correspondence between the submission repository address and the submission repository branch information; Based on the correspondence between the submitted warehouse address and the submitted warehouse branch information in the submitted information, a warehouse list corresponding to the third requirement and the branch status of the code warehouse in the warehouse list are obtained.

9. The method according to claim 1, characterized in that The method further comprises: In response to the batch processing operation on the code repositories in the second repository list corresponding to the second requirement, the batch processing operation is performed on each code repository in the second repository list.

10. A demand switching device in code development, characterized in that: The device comprises: A first storage module is configured to, in response to a triggering operation of switching from a first requirement to a second requirement, store a first repository list corresponding to the first requirement, and the branch forms of the code repositories in the first repository list under the first requirement, and store locally modified code of the code repositories in the first repository list in a cache; wherein the first repository list includes the code repositories required for the task corresponding to the first requirement; a first development module configured to, if it is determined that the second requirement does not exist in the current code development system, configure a second repository list corresponding to the second requirement, switch the code repositories in the second repository list to a pre-configured branching form, and perform code development for the second requirement based on the code repositories in the second repository list in the pre-configured branching form; The second development module is used to obtain the code repository in the second warehouse list corresponding to the second requirement if it is determined that the second requirement exists in the current code development system, switch the code repository in the second warehouse list to the branch form under the second requirement, and restore the local modified code of the code repository in the second warehouse list in the cache, and perform code development for the second requirement based on the branch form of the code repository in the second warehouse list under the second requirement and the local modified code.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 9.

12. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Information processing method and device, electronic equipment and storage medium

    CN107918541A