Code merging method and device, computer equipment and storage medium

By using the code merging model in a hybrid cloud environment, it automatically handles the merger and conflict resolution of different versions of code, and solves the problem of inefficient code merging and achieves more efficient code merging and conflict management.

CN119576342APending Publication Date: 2025-03-07CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411659937.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In a hybrid cloud environment, the development team needs to customize development based on existing code, resulting in inefficient code merging, especially when there are conflicts between different versions of code.

Method used

Provide a code merging method, obtaining the code merging results by obtaining different versions of the corresponding code of the target function module and inputting it into the target code merging model. This code merging model automatically outputs the merged code or conflict and resolution strategy by training sample data, including different versions of code and code merging records.

Benefits of technology

Improves the efficiency of code merging, can automatically resolve conflicts or provide conflict resolution strategies, which is faster and more accurate than manual merging.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119576342A_ABST
    Figure CN119576342A_ABST
Patent Text Reader

Abstract

The invention relates to a code merging method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring to-be-merged codes of different versions corresponding to a target function module; inputting to-be-merged codes of different versions corresponding to the target function module into the target code merging model to obtain a code merging result; wherein the code merging result comprises a merged code corresponding to the target function module, and / or a conflict and a conflict resolution strategy existing in the code merging process. According to the scheme, when the to-be-merged codes of different versions corresponding to the target function module need to be merged, the to-be-merged codes only need to be input into the target code merging model, the merged codes can be rapidly obtained, even if conflicts exist in the code merging process, the conflicts can be automatically solved or a conflict solving strategy can be provided, and the merging efficiency is improved. And compared with manual code merging, the code merging efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a code merging method, apparatus, computer device and storage medium. Background Art

[0002] A hybrid cloud is a computing environment that connects an organization's internal private cloud and third-party public clouds into a single flexible infrastructure for running the organization's applications and workloads.

[0003] In the hybrid cloud field, as customer needs become more diverse and complex, in order to meet customers' personalized needs, development teams often need to perform customized development based on existing code, which often means modifying core code or adding new features. However, these modifications may conflict with other versions of the code.

[0004] In traditional technology, different code versions are usually merged manually, which has the problem of low code merging efficiency. Summary of the invention

[0005] Based on this, it is necessary to provide a code merging method, apparatus, computer device and storage medium to address the above technical problems, which can improve the efficiency of code merging.

[0006] In a first aspect, the present application provides a code merging method, the method comprising:

[0007] Obtain different versions of the code to be merged corresponding to the target functional module;

[0008] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0009] In one of the embodiments, if there is no conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module.

[0010] In one of the embodiments, if there is a conflict between different versions of the code to be merged corresponding to the target functional module during the code merging process and the conflict is eliminated, the code merging result is the merged code corresponding to the target functional module, the conflict existing in the code merging process and the solution in the conflict resolution strategy.

[0011] In one of the embodiments, if there is a conflict between different versions of the code to be merged corresponding to the target functional module during the code merging process, and the conflict is not eliminated, then the code merging result is the conflict existing in the code merging process corresponding to the target functional module and the resolution suggestion in the conflict resolution strategy.

[0012] In one embodiment, the target code merging model is trained in the following manner:

[0013] Acquire sample data corresponding to the sample function module; wherein the sample data includes different versions of codes to be merged and code merge records corresponding to the sample function module, and the code merge records include merged codes, or conflicts and conflict resolution strategies in the code merge process;

[0014] The different versions of the to-be-merged codes corresponding to the sample function modules in the sample data are used as training data, and the code merging records corresponding to the sample function modules in the sample data are used as label data to train the initial code merging model and obtain the target code merging model.

[0015] In one embodiment, the step of obtaining sample data corresponding to the sample function module includes:

[0016] Obtaining code version information corresponding to the sample function module; wherein the code version information at least includes the sample function module identifier, the code version identifier before merging, and the code version identifier after merging;

[0017] The code version information corresponding to the sample function module is used as an index to search in the code library to obtain the sample data corresponding to the sample function module.

[0018] In one embodiment, the method further comprises:

[0019] Outputting a verification request for the code merging result to a verification party, so as to request the verification party to verify the correctness of the code merging result;

[0020] When the obtained verification result is that the verification fails, obtaining the updated merging result of the code merging result by the verifier;

[0021] The target code merging model is updated by using the different versions of the to-be-merged codes corresponding to the target functional module and the updated merging results.

[0022] In a second aspect, the present application further provides a code merging device, the device comprising:

[0023] An acquisition module is used to obtain different versions of the code to be merged corresponding to the target functional module;

[0024] A merging module is used to input different versions of the to-be-merged code corresponding to the target functional module into a target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0025] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:

[0026] Obtain different versions of the code to be merged corresponding to the target functional module;

[0027] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0028] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0029] Obtain different versions of the code to be merged corresponding to the target functional module;

[0030] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0031] In a fifth aspect, the present application further provides a computer program product, the computer program product comprising a computer program, which implements the following steps when executed by a processor:

[0032] Obtain different versions of the code to be merged corresponding to the target functional module;

[0033] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0034] The above-mentioned code merging method, apparatus, computer equipment and storage medium obtain different versions of the code to be merged corresponding to the target functional module; input the different versions of the code to be merged corresponding to the target functional module into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process. In the above scheme, when it is necessary to merge the different versions of the code to be merged corresponding to the target functional module, it is only necessary to input the code to be merged into the target code merging model to quickly obtain the merged code. Even if there is a conflict in the code merging process, the conflict can be automatically resolved or a conflict resolution strategy can be provided. Compared with manual code merging, the efficiency of code merging is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of a flow chart of a code merging method in an embodiment;

[0036] Figure 2 A schematic diagram of a process for obtaining a target code merging model in one embodiment;

[0037] Figure 3 A schematic diagram of a process for obtaining sample data corresponding to a sample function module in one embodiment;

[0038] Figure 4 A schematic diagram of a process for updating a target code merging model in one embodiment;

[0039] Figure 5 is a structural block diagram of a code merging device in an embodiment;

[0040] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0042] The code merging method provided in the embodiment of the present application can be applied to the application scenario of merging codes of different code versions of the same functional module. The method can be executed by a server, or by a terminal device with a certain computing power. Among them, the server can be implemented by an independent server or a server cluster composed of multiple servers. The terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc.

[0043] In one embodiment, Figure 1 As shown, a code merging method is provided, which is described by taking the method applied to a server as an example, and includes the following steps:

[0044] S101, obtaining different versions of codes to be merged corresponding to the target functional module.

[0045] For example, when a developer is developing a project, a project usually involves multiple functional modules. In order to improve development efficiency, different functional modules are usually developed by multiple development teams, and different functions of different functional modules may also be developed by different teams. In order to ensure the consistency of the code, it is necessary to merge different versions of the code developed by different development teams for the same functional project. Thus, different versions of the code to be merged corresponding to the target functional module can be first obtained. Among them, the target functional module can be understood as any functional module in a project.

[0046] S102, inputting the different versions of the to-be-merged codes corresponding to the target functional module into the target code merging model to obtain a code merging result.

[0047] Furthermore, different versions of the code to be merged corresponding to the target functional module can be input into the target code merge model. Since the target code merge model is trained by using different versions of the code to be merged corresponding to the sample functional module and the code merge record, the target code merge model automatically outputs the code merge result based on the different versions of the code to be merged corresponding to the input target functional module. The code merge result includes the merged code corresponding to the target functional module, or the code merge result includes the merged code corresponding to the target functional module and the conflicts and conflict resolution strategies in the code merge process; or the code merge result includes the conflicts and conflict resolution strategies in the code merge process.

[0048] Exemplarily, different versions of the code to be merged corresponding to the target functional module are input into the target code merge model, and the target code merge model can identify the code differences between the different versions of the code to be merged corresponding to the target functional module, and obtain the code merge result based on the code differences. Alternatively, the code differences between the different versions of the code to be merged corresponding to the target functional module can be first determined, and the code differences can be input into the target code merge model.

[0049] For example, if the input data of the target code merging model is code difference, the code merging result is expressed as follows:

[0050]

[0051] Among them, P is the code merge result, D is the code difference, Merge models for target code.

[0052] Optionally, the target code merge model can be used Architecture as a base model. The core mechanism of the architecture is the attention mechanism. Due to the effectiveness of the self-attention mechanism in processing long sequence data, it is particularly suitable for processing text data with complex logical structures such as code.

[0053] For example, The core mechanism of the architecture is the self-attention calculation, which is expressed by the following formula:

[0054]

[0055] Among them, Q is the input data of the input target code merging model, is the key vector determined according to the input data, is a vector of values ​​determined from the input data, is the normalization coefficient, is the transpose of Q.

[0056] The formula shows how the attention weights are obtained by calculating the dot product of the input data and the key vector and processing it through the normalized exponential function softmax. These weights are then used to perform a weighted summation of the value vector to generate the output sequence.

[0057] The above code merging method obtains different versions of the code to be merged corresponding to the target functional module; inputs the different versions of the code to be merged corresponding to the target functional module into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process. In the above scheme, when it is necessary to merge the different versions of the code to be merged corresponding to the target functional module, it is only necessary to input the code to be merged into the target code merging model to quickly obtain the merged code. Even if there is a conflict in the code merging process, the conflict can be automatically resolved or a conflict resolution strategy can be provided. Compared with manual code merging, the efficiency of code merging is improved.

[0058] Exemplarily, if there is no conflict between different versions of the code to be merged corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module. That is, if there is no conflict between different versions of the code to be merged corresponding to the target functional module during the code merging process, the target code merging model can directly output the merged code corresponding to the target functional module.

[0059] In the embodiment of the present application, when there is no conflict during the code merging process, the merged code can be directly output, thereby improving the efficiency of the code merging.

[0060] Furthermore, if there is a conflict between different versions of the code to be merged corresponding to the target functional module during the code merging process, and the conflict is eliminated, the code merging result is the merged code corresponding to the target functional module, the conflict existing during the code merging process, and the solution in the conflict resolution strategy. That is, if there is a conflict between different versions of the code to be merged corresponding to the target functional module during the code merging process, the target functional module automatically adjusts the code, eliminates the conflict, and completes the code merging, then the merged merged code, the existing conflict, and the solution adopted to eliminate the conflict can be output; wherein, the existing conflict may include the type of conflict, the location of the conflict, the specific code of the conflict, and other conflict contents.

[0061] In an embodiment of the present application, when conflicts exist during the code merging process, the conflicts can be automatically eliminated, thereby improving the efficiency of code conflict elimination and thereby improving the efficiency of code merging; and the existing conflicts and solutions in the conflict resolution strategy are output to facilitate verification of the rationality of the conflict resolution solution.

[0062] Furthermore, if there is a conflict between different versions of the code to be merged corresponding to the target functional module during the code merge process, and the conflict has not been resolved, the code merge result is the conflict existing in the code merge process corresponding to the target functional module and the solution suggestion in the conflict resolution strategy. That is, if there is a conflict between different versions of the code to be merged corresponding to the target functional module during the code merge process, and the target functional module has not resolved the conflict, the conflict existing in the code merge process corresponding to the target functional module and the solution suggestion in the conflict resolution strategy can be output, wherein the existing conflict may include the conflict type, location, specific code of the conflict and other conflict contents, and the conflict suggestion may be a possible conflict resolution strategy.

[0063] In the embodiment of the present application, when conflicts occur during the code merging process, the conflicts can be located and conflict resolution suggestions can be provided, thereby improving the efficiency of eliminating conflicts.

[0064] In some optional implementations, see Figure 2 , Figure 2 A flowchart of obtaining a target code merge model is provided, which specifically includes the following steps:

[0065] S201, obtaining sample data corresponding to a sample function module.

[0066] Exemplarily, each version code and historical merge record of each functional module will be stored in the code library, so that sample data corresponding to the sample functional module can be obtained in the code library; wherein the sample functional module is the same functional module as the target functional module. The sample data includes different versions of the code to be merged and the code merge record corresponding to the sample functional module, and the code merge record includes the merged code, or the conflicts and conflict resolution strategies in the code merge process.

[0067] For example, the different versions of the code to be merged and the merged code corresponding to the sample functional modules in the sample data can enable the initial code merging model to learn the characteristics of the correct merged code; the different versions of the code to be merged corresponding to the sample functional modules in the sample data and the conflicts and conflict resolution strategies existing in the code merging process can enable the initial code merging model to learn how to identify conflicts and the conflict resolution strategies for dealing with conflicts, and based on the conflicts and conflict resolution strategies existing in the code merging process, learn conflict resolution suggestions for conflicts of the same type.

[0068] S202, using different versions of the to-be-merged codes corresponding to the sample function modules in the sample data as training data, using the code merging records corresponding to the sample function modules in the sample data as label data, training the initial code merging model, and obtaining a target code merging model.

[0069] Furthermore, the different versions of the to-be-merged codes corresponding to the sample function modules in the sample data can be used as training data, and the code merging records corresponding to the sample function modules in the sample data can be used as label data to train the initial code merging model to obtain the target code merging model. For example, an optimization algorithm such as gradient descent can be used for model training.

[0070] For example, assume that the model parameters are , the learning rate is , then the update formula of the gradient descent algorithm is:

[0071]

[0072] in, is the model parameter of this round, is the model parameter of the previous round, is the loss function, is the Hamiltonian operator.

[0073] Among them, the loss function can be calculated as follows:

[0074]

[0075] in, is the true label data of sample data n, is the probability of the predicted label corresponding to the sample data.

[0076] Exemplarily, the model parameters can be optimized by minimizing the loss function L to improve the prediction accuracy. For example, multiple rounds of iterative training can be performed to gradually reduce the loss function so that the model can gradually master the complex mapping relationship from the code differences of different versions of the code to be merged corresponding to the sample functional modules to the merged code. At the beginning of training, the model parameters can be randomly initialized, and then iterative training can be performed on the sample data. In each round of iteration, the model calculates the loss function based on the prediction results and the real label data, and uses the gradient descent algorithm to fine-tune the model parameters to achieve continuous optimization of the model.

[0077] In an embodiment of the present application, by using sample data to perform multiple rounds of iterative training on the initial code merging model, a target code merging model can be obtained, so that the target code merging model can accurately output a more accurate code merging result based on the differences between different versions of the codes to be merged corresponding to the target functional modules.

[0078] In some optional implementations, see Figure 3 , Figure 3 A schematic diagram of a process for obtaining sample data corresponding to a sample function module is provided, which specifically includes the following steps:

[0079] S301, obtaining code version information corresponding to a sample functional module.

[0080] Exemplarily, the code version information corresponding to the sample function module may be obtained, wherein the code version information at least includes the sample function module identifier, the code version identifier before merging, and the code version identifier after merging. For example, the obtained code version information is as follows:

[0081]

[0082] in, is the code version information, is the code version identifier before the i-th merge, is the code version identifier after the i-th merge, is the conflict record in the i-th merge process, including the conflicting file name, line number, conflict content and resolution strategy, etc. N is the number of samples.

[0083] The code version identifier may include module name, version number, submitter, and submission time, etc.

[0084] For example, The specific structure is as follows:

[0085] ;

[0086] The specific structure is as follows:

[0087] .

[0088] Furthermore, the sample data can be purified and organized.

[0089] For example, for each code version information , use the hash function H(x) to calculate its hash value. That is, apply the hash function to each code version information to obtain a unique hash value:

[0090]

[0091] All calculated hash values ​​are stored in a data set that does not allow duplicate elements to be stored. Once a duplicate hash value is detected, the code version information currently being processed is removed and the next code version information is processed until all data has been checked. After all code version information has been processed, the resulting data set will only contain hash values ​​corresponding to unique code version information.

[0092] For each code version information after deduplication processing by hash function , the following validity verification steps will be performed:

[0093] Inspection and Whether the code version represented is in compliance with the specification. First, these code version identifiers will be formatted and reviewed to ensure that they follow the predetermined version naming guidelines. Second, by calling the verification interface of the code library or executing the corresponding version control instructions, the actual existence of these versions in the code library will be further confirmed. or If the version format is incorrect or there is no corresponding code version information in the code library, it is determined that the code version information is invalid.

[0094] against Part, yes For example, extract the file name, line number, conflict code segment, and specific conflict resolution path. If the necessary conflict and resolution information is missing, or the information is vague or incomplete, the code version information will be deemed invalid. Once the code version information is found to be invalid during the verification process, it can be completely removed from the data set, or marked and stored in isolation for subsequent manual review or further processing. After successfully passing all the above verification steps, it will be included in the cleaned data set CleanedDataSet.

[0095] S302, using the code version information corresponding to the sample function module as an index, searching in the code library to obtain sample data corresponding to the sample function module.

[0096] Furthermore, the code version information corresponding to the sample function module can be used as an index to query in the code library to obtain sample data corresponding to the sample function module, and the obtained sample data includes different versions of the code to be merged and the code merge record corresponding to the sample function module.

[0097] For example, the code version before merging, the code after merging, and the conflict points in the code merging process can also be annotated to form a structured data set. For example, for each code version information in CleanedDataSet , perform the following annotation operations:

[0098] right and Perform code analysis to extract key metrics, such as the number of lines of code, complexity (e.g., business complexity, execution order, number of branches, etc.), and add them to metadata In the code merge record, the conflict content and resolution strategy are analyzed in detail, and the conflict type, resolver, resolution time and resolution information are extracted and updated to In the annotated data Add to annotation dataset Among them,

[0099] .

[0100] After adding annotations .

[0101] Further, Output in a structured format (such as CSV, JSON, or database table) to obtain sample data corresponding to the sample function module.

[0102] In an embodiment of the present application, sample data can be queried in the code library based on the acquired code version information so as to subsequently train the initial code merging model.

[0103] In some optional implementations, in order to improve the performance of the target code merging model, the code merging results may be manually reviewed, and the target code merging model may be updated based on the review results.

[0104] For example, see Figure 4 , Figure 4 A flowchart of updating a target code merge model is provided, which specifically includes the following steps:

[0105] S401: Output a verification request for the code merging result to a verification party, so as to request the verification party to verify the correctness of the code merging result.

[0106] Exemplarily, the verifier can be understood as a terminal where the verifier can view the code merge result. A verification request for the code merge result is output to the verifier, so that the verifier can perform correctness verification on the code merge result based on the code merge result displayed by the verifier.

[0107] S402, when the obtained verification result is verification failure, obtaining the updated merging result of the code merging result by the verifier.

[0108] For example, if the verification staff believes that the code merge result is incorrect, that is, the verification result is a failed verification, the verification staff can change the code merge result and upload the changed code merge result on the verification end, that is, update the merge result. Based on this, the updated merge result of the code merge result by the verification party can be obtained.

[0109] S403, using different versions of the to-be-merged codes corresponding to the target functional module and the updated merge results, to update the target code merge model.

[0110] Furthermore, the target code merging model may be trained again using different versions of the code to be merged and the updated merging results corresponding to the target functional module to update the target code merging model, thereby improving the reliability of the code merging results output by the target code merging model.

[0111] In an embodiment of the present application, a verification link is set to verify the code merging result. When the verification result is failure, the code merging result is updated, and the target code merging model is trained again using the updated code merging result to update the target code merging model, thereby improving the reliability of the code merging result output by the target code merging model.

[0112] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0113] Based on the same inventive concept, the embodiment of the present application also provides a code merging device for implementing the code merging method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more code merging device embodiments provided below can refer to the limitations of the code merging method above, and will not be repeated here.

[0114] In one embodiment, Figure 5 As shown, a code merging device is provided, comprising:

[0115] An acquisition module 10 is used to acquire different versions of codes to be merged corresponding to a target functional module;

[0116] The merging module 20 is used to input different versions of the to-be-merged codes corresponding to the target functional module into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0117] The above-mentioned code merging device obtains different versions of the code to be merged corresponding to the target functional module; inputs the different versions of the code to be merged corresponding to the target functional module into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process. In the above scheme, when it is necessary to merge the different versions of the code to be merged corresponding to the target functional module, it is only necessary to input the code to be merged into the target code merging model to quickly obtain the merged code. Even if there is a conflict in the code merging process, the conflict can be automatically resolved or a conflict resolution strategy can be provided. Compared with manual code merging, the efficiency of code merging is improved.

[0118] In one of the embodiments, if there is no conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module.

[0119] In one of the embodiments, if different versions of the to-be-merged codes corresponding to the target functional module conflict during the code merging process and the conflict is resolved, the code merging result is the merged code corresponding to the target functional module, the conflict existing during the code merging process and the solution in the conflict resolution strategy.

[0120] In one of the embodiments, if different versions of the to-be-merged codes corresponding to the target functional module conflict during the code merging process and the conflict is not resolved, the code merging result is the conflict existing in the code merging process corresponding to the target functional module and the resolution suggestion in the conflict resolution strategy.

[0121] In one embodiment, the device further comprises a training module for:

[0122] Obtain sample data corresponding to the sample function module; wherein the sample data includes different versions of codes to be merged and code merge records corresponding to the sample function module, and the code merge records include merged codes, or conflicts and conflict resolution strategies existing in the code merge process; use different versions of codes to be merged corresponding to the sample function modules in the sample data as training data, use the code merge records corresponding to the sample function modules in the sample data as label data, train an initial code merge model, and obtain a target code merge model.

[0123] In one embodiment, the training module is specifically used to:

[0124] Obtain code version information corresponding to the sample function module; wherein the code version information includes at least the sample function module identifier, the code version identifier before merging, and the code version identifier after merging; use the code version information corresponding to the sample function module as an index to query in the code library to obtain sample data corresponding to the sample function module.

[0125] In one embodiment, the device further includes a verification module, which is used to:

[0126] Output a verification request for the code merge result to the verifier to request the verifier to verify the correctness of the code merge result; when the obtained verification result is a verification failure, obtain the updated merge result of the code merge result from the verifier; use the different versions of the code to be merged and the updated merge result corresponding to the target functional module to update the target code merge model.

[0127] Each module in the above-mentioned code merging device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0128] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store code data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a code merging method is implemented.

[0129] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0130] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0131] Obtain different versions of the code to be merged corresponding to the target functional module;

[0132] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0133] In one embodiment, if there is no conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module.

[0134] In one embodiment, if different versions of the codes to be merged corresponding to the target functional module conflict during the code merging process and the conflict is resolved, the code merging result is the merged code corresponding to the target functional module, the conflict existing during the code merging process and the solution in the conflict resolution strategy.

[0135] In one embodiment, if different versions of the to-be-merged codes corresponding to the target functional module conflict during the code merging process and the conflict is not resolved, the code merging result is the conflict existing during the code merging process corresponding to the target functional module and the resolution suggestion in the conflict resolution strategy.

[0136] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0137] Obtain sample data corresponding to the sample function module; wherein the sample data includes different versions of codes to be merged and code merge records corresponding to the sample function module, and the code merge records include merged codes, or conflicts and conflict resolution strategies existing in the code merge process; use different versions of codes to be merged corresponding to the sample function modules in the sample data as training data, use the code merge records corresponding to the sample function modules in the sample data as label data, train an initial code merge model, and obtain a target code merge model.

[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0139] Obtain code version information corresponding to the sample function module; wherein the code version information includes at least the sample function module identifier, the code version identifier before merging, and the code version identifier after merging; use the code version information corresponding to the sample function module as an index to query in the code library to obtain sample data corresponding to the sample function module.

[0140] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0141] Output a verification request for the code merge result to the verifier to request the verifier to verify the correctness of the code merge result; when the obtained verification result is a verification failure, obtain the updated merge result of the code merge result from the verifier; use the different versions of the code to be merged and the updated merge result corresponding to the target functional module to update the target code merge model.

[0142] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0143] Obtain different versions of the code to be merged corresponding to the target functional module;

[0144] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0145] In one embodiment, if there is no conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module.

[0146] In one embodiment, if different versions of the codes to be merged corresponding to the target functional module conflict during the code merging process and the conflict is resolved, the code merging result is the merged code corresponding to the target functional module, the conflict existing during the code merging process and the solution in the conflict resolution strategy.

[0147] In one embodiment, if different versions of the to-be-merged codes corresponding to the target functional module conflict during the code merging process and the conflict is not resolved, the code merging result is the conflict existing during the code merging process corresponding to the target functional module and the resolution suggestion in the conflict resolution strategy.

[0148] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0149] Obtain sample data corresponding to the sample function module; wherein the sample data includes different versions of codes to be merged and code merge records corresponding to the sample function module, and the code merge records include merged codes, or conflicts and conflict resolution strategies existing in the code merge process; use different versions of codes to be merged corresponding to the sample function modules in the sample data as training data, use the code merge records corresponding to the sample function modules in the sample data as label data, train an initial code merge model, and obtain a target code merge model.

[0150] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0151] Obtain code version information corresponding to the sample function module; wherein the code version information includes at least the sample function module identifier, the code version identifier before merging, and the code version identifier after merging; use the code version information corresponding to the sample function module as an index to query in the code library to obtain sample data corresponding to the sample function module.

[0152] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0153] Output a verification request for the code merge result to the verifier to request the verifier to verify the correctness of the code merge result; when the obtained verification result is a verification failure, obtain the updated merge result of the code merge result from the verifier; use the different versions of the code to be merged and the updated merge result corresponding to the target functional module to update the target code merge model.

[0154] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0155] Obtain different versions of the code to be merged corresponding to the target functional module;

[0156] The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain the code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

[0157] In one embodiment, if there is no conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module.

[0158] In one embodiment, if different versions of the codes to be merged corresponding to the target functional module conflict during the code merging process and the conflict is resolved, the code merging result is the merged code corresponding to the target functional module, the conflict existing during the code merging process and the solution in the conflict resolution strategy.

[0159] In one embodiment, if different versions of the to-be-merged codes corresponding to the target functional module conflict during the code merging process and the conflict is not resolved, the code merging result is the conflict existing during the code merging process corresponding to the target functional module and the resolution suggestion in the conflict resolution strategy.

[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0161] Obtain sample data corresponding to the sample function module; wherein the sample data includes different versions of codes to be merged and code merge records corresponding to the sample function module, and the code merge records include merged codes, or conflicts and conflict resolution strategies existing in the code merge process; use different versions of codes to be merged corresponding to the sample function modules in the sample data as training data, use the code merge records corresponding to the sample function modules in the sample data as label data, train an initial code merge model, and obtain a target code merge model.

[0162] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0163] Obtain code version information corresponding to the sample function module; wherein the code version information includes at least the sample function module identifier, the code version identifier before merging, and the code version identifier after merging; use the code version information corresponding to the sample function module as an index to query in the code library to obtain sample data corresponding to the sample function module.

[0164] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0165] Output a verification request for the code merge result to the verifier to request the verifier to verify the correctness of the code merge result; when the obtained verification result is a verification failure, obtain the updated merge result of the code merge result from the verifier; use the different versions of the code to be merged and the updated merge result corresponding to the target functional module to update the target code merge model.

[0166] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0167] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0168] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0169] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A code merging method, characterized in that: The method comprises: Obtain different versions of the code to be merged corresponding to the target functional module; The different versions of the to-be-merged codes corresponding to the target functional module are input into the target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

2. The method according to claim 1, characterized in that If there is no conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, the code merging result is the merged code corresponding to the target functional module.

3. The method according to claim 1, characterized in that If there is a conflict between different versions of the to-be-merged code corresponding to the target functional module during the code merging process and the conflict is eliminated, the code merging result is the merged code corresponding to the target functional module, the conflict existing during the code merging process and the solution in the conflict resolution strategy.

4. The method according to claim 1, characterized in that: If there is a conflict between different versions of the to-be-merged codes corresponding to the target functional module during the code merging process, and the conflict has not been eliminated, the code merging result is the conflict existing in the code merging process corresponding to the target functional module and the resolution suggestion in the conflict resolution strategy.

5. The method according to claim 1, characterized in that: The target code merging model is trained in the following way: Acquire sample data corresponding to the sample function module; wherein the sample data includes different versions of codes to be merged and code merge records corresponding to the sample function module, and the code merge records include merged codes, or conflicts and conflict resolution strategies in the code merge process; The different versions of the to-be-merged codes corresponding to the sample function modules in the sample data are used as training data, and the code merging records corresponding to the sample function modules in the sample data are used as label data to train the initial code merging model and obtain the target code merging model.

6. The method according to claim 5, characterized in that The obtaining of sample data corresponding to the sample function module includes: Obtaining code version information corresponding to the sample function module; wherein the code version information at least includes the sample function module identifier, the code version identifier before merging, and the code version identifier after merging; The code version information corresponding to the sample function module is used as an index to search in the code library to obtain the sample data corresponding to the sample function module.

7. The method according to claim 1, characterized in that The method further comprises: Outputting a verification request for the code merging result to a verification party, so as to request the verification party to verify the correctness of the code merging result; When the obtained verification result is that the verification fails, obtaining the updated merging result of the code merging result by the verifier; The target code merging model is updated by using the different versions of the to-be-merged codes corresponding to the target functional module and the updated merging results.

8. A code merging device, characterized in that: The device comprises: An acquisition module is used to obtain different versions of the code to be merged corresponding to the target functional module; A merging module is used to input different versions of the to-be-merged code corresponding to the target functional module into a target code merging model to obtain a code merging result; wherein the code merging result includes the merged code corresponding to the target functional module, and / or the conflicts and conflict resolution strategies existing in the code merging process.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.