[go: up one dir, main page]

CN114579171A - Code processing method and device, computer equipment and storage medium - Google Patents

Code processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN114579171A
CN114579171A CN202210237357.6A CN202210237357A CN114579171A CN 114579171 A CN114579171 A CN 114579171A CN 202210237357 A CN202210237357 A CN 202210237357A CN 114579171 A CN114579171 A CN 114579171A
Authority
CN
China
Prior art keywords
code
modification
user terminal
target branch
basic code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210237357.6A
Other languages
Chinese (zh)
Inventor
梁沪光
张宇鸿
石雪
黄剑辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210237357.6A priority Critical patent/CN114579171A/en
Publication of CN114579171A publication Critical patent/CN114579171A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application relates to a code processing method, a code processing device, computer equipment and a storage medium, which are applied to the field of artificial intelligence, wherein the method comprises the following steps: receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; acquiring a current basic code corresponding to the target branch; and under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to a second user terminal to enable the second user terminal to modify the code of the target branch on the basis of the second basic code. By adopting the method, the second user terminal can sense the update of the code version on the target branch, and the code modification is carried out based on the latest branch code, so that the code conflict probability is reduced.

Description

Code processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a code processing method, apparatus, computer device, storage medium, and computer program product.
Background
In the process of code development, multiple developers may be required to modify the same module code or a common module code, when multiple developers submit a common code, the condition that modification content conflicts easily occurs, and at present, the method for solving the conflict is that a system calls a text comparison tool to list the code which is different from a baseline code, and then the code submitters confirm and combine the submission.
However, when there are many users modifying the same module code, performing conflict merge will consume a lot of time, resulting in waste of time and labor.
Disclosure of Invention
Based on this, it is necessary to provide a code processing method, an apparatus, a computer device, a computer readable storage medium, and a computer program product for solving the technical problems of time and labor waste in the conflict resolution method.
In a first aspect, the present application provides a code processing method. The method comprises the following steps:
receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of code for a plurality of branches;
acquiring a current basic code corresponding to the target branch;
and under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to a second user terminal to enable the second user terminal to modify the code of the target branch on the basis of the second basic code.
In one embodiment, after the updating the current basic code corresponding to the target branch according to the modified code to obtain a second basic code, the method further includes:
generating a test case corresponding to the second basic code;
and updating the current test case table of the target branch according to the test case.
In one embodiment, the method further comprises:
sending a prompt message to the first user terminal under the condition that the first basic code is different from the current basic code;
the prompt information is used for instructing the first user terminal to acquire the current basic code from the code server, and to modify the code based on the current basic code, or to combine the current basic code and the modified code.
In one embodiment, after the sending the prompt message to the first user terminal, the method further includes:
receiving a new modification code submitted by the first user terminal; the new modified code is obtained by modifying or combining based on the current basic code;
acquiring a test case of a historical modification code corresponding to the current basic code;
and performing regression testing on the functions of the new modified codes through the test cases of the historical modified codes, and storing regression testing results to a database.
In one embodiment, the method further comprises:
acquiring a history modification user terminal corresponding to the history modification code;
sending information to be confirmed to the history modification user terminal; the information to be confirmed is used for indicating the historical modification user terminal to confirm whether the new modification code affects the function of the historical modification code;
when some historical modification user terminals do not return confirmation information and the regression test result is that the test is failed, returning a message that the new modification code cannot be updated to the first user terminal; the confirmation information characterizes that the new modification code does not affect the function of the historical modification code.
In one embodiment, the method further comprises:
when some historical modification user terminals do not return confirmation information but the regression test result is that the test is passed, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code;
or when receiving the confirmation information returned by all the historical modification user terminals, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code.
In a second aspect, the present application further provides a code processing apparatus. The device comprises:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of code for a plurality of branches;
the acquisition module is used for acquiring the current basic code corresponding to the target branch;
and the updating module is used for updating the current basic code corresponding to the target branch according to the modification code under the condition that the first basic code is the same as the current basic code to obtain a second basic code, and sending the second basic code to a second user terminal, so that the second user terminal modifies the code of the target branch by taking the second basic code as a modification basis.
In an embodiment, the updating module is further configured to generate a test case corresponding to the second basic code; and updating the current test case table of the target branch according to the test case.
In one embodiment, the apparatus further comprises a sending module, configured to send a prompt message to the first user terminal if the first basic code is different from the current basic code; the prompt information is used for instructing the first user terminal to acquire the current basic code from the code server, and to modify the code based on the current basic code, or to combine the current basic code and the modified code.
In one embodiment, the apparatus further comprises a regression test module configured to receive a new modification code submitted by the first user terminal; the new modified code is obtained by modifying or combining based on the current basic code; acquiring a test case of a historical modification code corresponding to the current basic code; and performing regression testing on the functions of the new modified codes through the test cases of the historical modified codes, and storing regression testing results to a database.
In one embodiment, the apparatus further includes a confirmation module, configured to obtain a history modification user terminal corresponding to the history modification code; sending information to be confirmed to the history modification user terminal; the information to be confirmed is used for indicating the historical modification user terminal to confirm whether the new modification code affects the function of the historical modification code; when some historical modification user terminals do not return confirmation information and the regression test result indicates that the test does not pass, returning a message that the new modification code cannot be updated to the first user terminal; the confirmation information characterizes that the new modification code does not affect the function of the historical modification code.
In an embodiment, the determining module is further configured to update the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code when some of the historical modification user terminals do not return confirmation information but the regression test result is that the test passes; or when receiving the confirmation information returned by all the historical modification user terminals, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of codes of a plurality of branches;
acquiring a current basic code corresponding to the target branch;
and under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to a second user terminal to enable the second user terminal to modify the code of the target branch on the basis of the second basic code.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of code for a plurality of branches;
acquiring a current basic code corresponding to the target branch;
and under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to a second user terminal to enable the second user terminal to modify the code of the target branch on the basis of the second basic code.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of code for a plurality of branches;
acquiring a current basic code corresponding to the target branch;
and under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to a second user terminal to enable the second user terminal to modify the code of the target branch on the basis of the second basic code.
According to the code processing method, the code processing device, the computer equipment, the storage medium and the computer program product, when the first basic code is the same as the current basic code, the current basic code corresponding to the target branch is updated according to the modification code, so that the condition that the modification code conflicts with the current basic code is avoided, and meanwhile, the updated second basic code is sent to other second user terminals which are modifying codes of the target branch, so that the second user terminals can sense the update of the code version on the target branch in the process of modifying the codes based on the first basic code, remind the second user terminals of modifying based on the latest branch codes, the code conflict probability is reduced, and the waste of time and labor force caused by the combination of subsequent conflicts is reduced.
Drawings
FIG. 1 is a diagram of an application environment of a code processing method in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for code processing according to one embodiment;
FIG. 3 is a schematic flow chart diagram illustrating the regression testing step in one embodiment;
FIG. 4 is a schematic diagram illustrating a complete flow of a code processing method according to one embodiment;
FIG. 5 is a block diagram showing the structure of a code processing apparatus according to one embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein.
The code processing method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein a first user terminal 102 communicates with a code server 104 over a network. The second user terminal 106 communicates with the code server 104 over a network. The data storage system may store data that the code server 104 needs to process. The data storage system may be integrated on the code server 104 or may be located on the cloud or other network server. In the application scenario of the present application, the code server 104 stores different versions of common codes of multiple branches, when the first user terminal 102 needs to modify the common code of the target branch, the first base code (i.e. the latest common code in the pulling process) on the target branch is pulled from the code server 104 and modified to obtain a modified code, and the modified code is sent to the code server 104, after the code server 104 receives the modified code for the target branch sent by the first user terminal 102, the current base code (i.e. the current latest common code) corresponding to the target branch is obtained, and the first base code according to which the modified code is determined is compared with the current base code, and if the first base code and the current base code are the same, the current base code corresponding to the target branch is updated according to the modified code to obtain a second base code, and the second base code is sent to the second user terminal 106, and the second user terminal 106 modifies the codes of the target branches on the basis of modifying the second basic codes, so that the code collision probability is reduced.
The first user terminal 102 and the second user terminal 106 may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart car-mounted devices, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The code server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a code processing method is provided, which is described by taking the method as an example applied to the code server 104 in fig. 1, and includes the following steps:
step S210, receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; modifying the modified code based on the first basic code of the target branch; the code server stores different versions of code for multiple branches.
The first basic code may be understood as a latest version of codes in a plurality of versions of codes corresponding to the target branch when the first user terminal pulls the code of the target branch from the code server.
Wherein the target branch may represent any one of a plurality of branches stored on the code server.
In a specific implementation, when the user of the first user terminal 102 needs to modify the common code of the target branch on the code server 104, the first base code on the target branch (i.e., the latest common code during pulling) may be pulled from the code server 104, modified based on the first base code, to obtain a modified code, and send the modified code to the code server 104, so that the code server 104 receives the modified code sent by the first user terminal 102 and directed to the target branch, and further determines whether the modified code is updatable on the code server 104.
Step S220, obtain the current basic code corresponding to the target branch.
The current basic code may be understood as a code of a latest version among the multiple versions of codes corresponding to the target branch after the code server receives the modified code submitted by the first user terminal.
In a specific implementation, in the process of modifying based on the first basic code, the first user terminal 102 may have other users also modify the code of the target branch based on the first basic code, and submit the modified code to the code server 104 before the first user terminal 102, in this case, the modified code submitted by the first user terminal 102 cannot be directly updated to the code server 104. Therefore, after receiving the modified code for the target branch submitted by the first user terminal, the code server 104 needs to obtain the current latest version of the code corresponding to the target branch stored on the code server 104 as the current basic code in order to determine whether the modified code can be updated on the code server 104.
Step S230, under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to the second user terminal, so that the second user terminal modifies the code of the target branch based on the second basic code.
Wherein the second user terminal may represent another user terminal that modifies the common code of the target branch.
In a specific implementation, after receiving the modification code sent by the first user terminal 102 and obtaining the current basic code of the target branch, the code server 104 may compare the first basic code according to which the modification code is modified with the current basic code, and determine whether the first basic code and the current basic code are the same, and if the two codes are the same, that is, the first basic code according to which the modification code sent by the first user terminal 102 is modified belongs to the latest code on the target branch, and it is determined that there is no problem of code collision, the current basic code corresponding to the target branch may be further updated according to the modification code.
More specifically, before the current basic code corresponding to the target branch is updated according to the modification code, the modification code may be tested, and when the test is passed, the current basic code corresponding to the target branch is updated according to the modification code, so as to obtain a second basic code. The method for updating the current basic code corresponding to the target branch according to the modified code may be as follows: and adding the modified code into a new basic code corresponding to the target branch, recording the new basic code as a second basic code, and storing the current basic code corresponding to the target branch as a historical basic code.
In addition, after the current basic code corresponding to the target branch is updated, the terminal information of the second user terminal which is performing code modification on the target branch can be acquired at the same time, so that the second basic code is sent to the second user terminal according to the terminal information, and a user of the second user terminal can perform code modification synchronously based on the latest basic code of the target branch, so that the code collision chance is reduced.
It can be understood that, when there are a plurality of user terminals performing code modification on the target branch, terminal information of a third user terminal, a fourth user terminal, and the like can be acquired, and the second basic code is simultaneously sent to the third user terminal, the fourth user terminal, and the like, so that all the terminals of the three user terminals, the fourth user terminal, and the like can perform code modification based on the latest basic code.
In the code processing method, after a first user terminal submits a modification code aiming at a target branch on a code server to the code server, the code server is triggered to obtain a current basic code corresponding to the target branch, the consistency of a first basic code according to which the modification code is based and the current basic code is compared, under the condition that the first basic code and the current basic code are the same, the current basic code corresponding to the target branch is updated according to the modification code to obtain a second basic code, and the second basic code is sent to a second user terminal at the same time, so that the second user terminal modifies the code of the target branch on the basis of the second basic code. According to the method, when the first basic code is the same as the current basic code, the current basic code corresponding to the target branch is updated according to the modification code, so that the condition that the modification code conflicts with the current basic code is avoided, and meanwhile, the updated second basic code is sent to other second user terminals which are modifying codes of the target branch, so that the second user terminals can sense the update of the code version on the target branch in the process of modifying the codes based on the first basic code, remind the second user terminals of modifying the codes based on the latest branch codes, reduce the probability of code conflict, and further reduce the waste of time and labor power caused by subsequent conflict combination.
In an exemplary embodiment, after the step S230 updates the current basic code corresponding to the target branch according to the modified code, and obtains the second basic code, the method further includes:
step S240, generating a test case corresponding to the second basic code;
step S250, updating the current test case table of the target branch according to the test case.
In specific implementation, functions corresponding to codes of different versions are different, so that the codes of different versions correspond to different test cases, and therefore after a second basic code of a new version of a target branch is obtained, a test case corresponding to the second basic code needs to be generated, and a current test case table of the target branch is updated according to the test case. More specifically, according to the test case, the implementation manner of updating the current test case table of the target branch may be: and adding the test case corresponding to the second basic code to the current test case table of the target branch to obtain an updated test case table.
In this embodiment, after the second basic code is obtained, by generating a test case corresponding to the second basic code and updating the current test case table of the target branch according to the test case, after the code version of the target branch is updated, the test case table is synchronously updated, so that after a third basic code is obtained based on the second basic code modification, a regression test is performed on the third basic code based on the updated test case table.
In an exemplary embodiment, the method further includes: sending prompt information to the first user terminal under the condition that the first basic code is different from the current basic code; the prompt message is used for indicating the first user terminal to acquire the current basic code from the code server and modify the code by taking the current basic code as a modification basis, or combining the current basic code and the modification code.
In a specific implementation, after comparing the first basic code with the current basic code, if the obtained comparison result is that the two are different, that is, the first basic code according to which the modification code sent by the first user terminal 102 is not the latest version of the code on the target branch, it is determined that there is a problem of code conflict, and therefore, a prompt message may be sent to the first user terminal 102 to indicate that the first user terminal needs to re-acquire the latest current basic code on the target branch, re-modify the code based on the current basic code, or combine the current basic code and the modification code.
In this embodiment, when the first basic code is different from the current basic code, a prompt message is sent to the first user terminal to prompt the first user terminal to obtain the current basic code and perform code modification again or perform code combination, so that the first user terminal can perform code modification in time, and it is avoided that more time is consumed for performing conflict processing after submitting the code to the code server.
In an exemplary embodiment, as shown in fig. 3, after sending the prompt message to the first user terminal, the method further includes:
step S310, receiving a new modification code submitted by a first user terminal; the new modified code is obtained by modifying or combining based on the current basic code;
step S320, obtaining a test case of the historical modification code corresponding to the current basic code;
and step S330, performing regression testing on the functions of the new modified codes through the test cases corresponding to the historical modified codes, and storing regression testing results to a database.
The test case is used for performing regression testing on the functions of the codes.
Where regression testing indicates that after the old code has been modified, the test is repeated to confirm that the modification did not introduce new errors or cause errors in other code.
In a specific implementation, after receiving the prompt message sent by the code server, the first user terminal may obtain the current basic code of the target branch from the code server according to the prompt message, and perform code modification again on the basis that the current basic code is not modified to obtain a new modified code, or perform merging processing on the current basic code and the modified code to obtain the new modified code. In the process, since the first user terminal is not aware of modified contents of other user terminals in the current basic code, and then when modifying or merging based on the current basic code, merging deviations such as partial function replacement or deletion of the current basic code may occur, the code server needs to obtain a test case of the historical modified code of which the code version is before the current basic code after receiving the new modified code submitted by the first user terminal, perform a regression test on the function of the new modified code through the test case of the historical modified code to determine whether the new modified code causes a function error of the historical modified code, and store a regression test result in the database.
In the embodiment, after receiving the new modification code submitted by the first user terminal, the communication cost during code conflict merging can be greatly saved and the code quality is improved by acquiring the test case of the historical modification code corresponding to the current basic code and automatically performing regression test on the function of the new modification code through the test case.
In an exemplary embodiment, the method further includes:
acquiring a history modification user terminal corresponding to the history modification code;
sending information to be confirmed to a history modification user terminal; the information to be confirmed is used for indicating the historical modification user terminal to confirm whether the new modification code influences the function of the historical modification code;
when some historical modification user terminals do not return confirmation information and the regression test result indicates that the test is failed, returning a message that a new modification code cannot be updated to the first user terminal; the validation information characterizes that the new modification code does not affect the functionality of the historical modification code.
Wherein, the information to be confirmed can contain a new modification code.
In a specific implementation, after receiving a new modification code submitted by a first user terminal, a code server may obtain a test exception of a historical modification code corresponding to a current basic code according to which the modification code is modified, and may also obtain a historical modification user terminal corresponding to the historical modification code, so as to send information to be confirmed to the historical modification user terminal, so that the historical modification user terminal confirms whether the new modification code affects a function of the historical modification code, and returns confirmation information to the code server. If the user terminal with partial history modification does not return the confirmation information and the regression test on the new modification code is failed, the new modification code is indicated to have errors, and therefore, a message that the new modification code cannot be updated can be returned to the first user terminal.
In practical application, the information to be confirmed can be sent to the history modification user terminal in the modes of mails, short messages, instant messaging software and the like, the information to be confirmed can be displayed in a link mode, and after the history modification user terminal receives the information to be confirmed, the information is confirmed by clicking the link.
In an exemplary embodiment, further comprising: when some historical modification user terminals do not return confirmation information but the regression test result is that the test is passed, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code; or when receiving the confirmation information returned by all the historical modification user terminals, updating the current basic code corresponding to the target branch according to the new modification code to obtain the second basic code.
In a specific implementation, if some historical modification user terminals do not return confirmation information, when the regression test on the new modification code passes or when confirmation information returned by all the historical modification user terminals is received, it is indicated that the new modification code has no problem, and therefore, the current basic code corresponding to the target branch can be updated according to the new modification code to obtain the second basic code.
In the above embodiment, after receiving the new modification code submitted by the first user terminal, the code server further obtains the historical modification user terminal corresponding to the historical modification code, so that information to be confirmed can be sent to the historical modification user terminal, the historical modification user terminal can confirm whether the new modification code affects the function of the historical modification code, on the basis of performing regression test on the new modification code, the code server jointly confirms the validity of the new modification code in combination with the reply information of the historical modification user terminal, and the quality of the code updated to the code server can be improved.
In one embodiment, to facilitate understanding of embodiments of the application by those skilled in the art, reference will now be made to the specific examples illustrated in the accompanying drawings. Referring to fig. 4, there is shown a complete flow diagram of a code processing method, comprising the steps of:
(1) the user A obtains the code of the target branch on the Git code server, pulls the latest public code (i.e. the first basic code) on the branch to the local, and records the code version as A0 (at this time, the latest code version on the target branch of the code server is A0), and the user A locally keeps the code basic copy as A0.
(2) And the user B simultaneously obtains the code of the target branch on the Git code server, pulls the latest public code on the branch to the local, and the version of the branch code is A0.
(3) And respectively carrying out code modification on the user A and the user B based on the code version A0, taking the user A as an example, copying a local branch code version A0 for modification, and marking the modified code version as A1, wherein the purpose of locally reserving the modified base version A0 is to compare whether the modified base version of the user A is consistent with the latest code version on the target branch or not in the subsequent process.
(4) When user A submits code version A1 to the code server, the analysis module of the code server is triggered to compare whether the modified base version A0 of code version A1 is consistent with the latest current base code version A0' on the target branch.
(5) If the current code version is consistent with the code version A1, calling a test case module to test the code of the code version A1, after the test is passed, updating the current code version on the target branch of the code server to be A1, generating a test case corresponding to the code version A1, and updating the test case table corresponding to the target branch according to the test case corresponding to the code version A1.
At the same time, code version A1 on the target branch is automatically pushed to other code pullers, e.g., code version A1 is pushed to user B, prompting him to make code modifications using the latest code version A1 on the target branch. And if user B uses the latest code version A1 for modification, then its modified base version is updated to code version A1 in order to synchronize the code of the code modifiers and to perform the code merge locally early, without waiting for the merge to be committed to the code server.
(6) If the modified base version A0 of the compared code version A1 is inconsistent with the latest current base code version A0 'on the target branch, the fact that a code conflict exists is prompted, the user A needs to download the current code version A0' on the target branch to the local again to modify the code again, or a conflict merging module is used for merging the code to obtain a new modified code A2, the new modified code A2 is submitted to a code server, and the regression test of the branch code version A0 'is triggered (wherein the test cases of the historical modified version corresponding to the branch code version A0' are all subjected to regression test).
The step is to obtain the affected function module by the code name, a certain version of a code file may be related to a plurality of functions of the system, and the corresponding relationship is' file version: influencing functions ", for example:
code version a 0: function A
Code version a 1: function A, function B, and function C
Function a: test case A
And a function B: test case B
Function C: test case C
Code version a 0: test case A
Code version a 1: test case A, test case B and test case C.
(7) And an analysis module of the code server analyzes the historical modified code version to obtain a test case list needing to execute the regression test, so that the automatic search of the automatic test case corresponding to the historical modified code version is realized. Wherein the test case automated regression testing of the historical modified code version is triggered by the act of user a submitting new modified code a2 to the target branch code library.
(8) And executing a corresponding automatic regression test on the function of the new modified code A2 to obtain a regression test result, and marking whether the test case passes through by using the script tool and keeping the test case in the database for further use.
(9) Meanwhile, after the user A submits the new modified code A2 to the target branch code library, the code server informs the historical modifier aiming at the new modified code A2 on the target branch, and the key link confirmation is needed when the code modifier receives the mail.
(10) If all the historical modifiers return confirmation information, or part of the historical modifiers do not return confirmation information but the test of the regression test case passes, updating the new modification code A2 to the target branch code library; if the partial history modifier does not return confirmation information and the test of the regression test case fails, the new modified code A2 cannot be updated to the target branch code library.
The method for solving the submission conflict of the common code based on the multi-party verification synchronization strategy provided by the embodiment uses the Git code library and jenkins technology to carry out multi-party verification regression verification, ensures that modified contents related to multiple parties pass verification, and has the following beneficial effects: 1. quickly determining common code multiple authors: the original code submitter does not know the modified contents of other people, the deviation is easy to occur when conflict merging is carried out, the system can automatically locate the concerned modifier, find the automatic test case corresponding to the code version and send an email to inform the relevant modifier for confirmation. 2. One party modifies the submitted public code updating branch and then automatically synchronizes to the native machine of the code being modified, so as to remind the modifier being modified to pay attention and reduce the possibility of conflict; after the code is originally pulled, a code modifier cannot sense the update of the code version on the branch in the modification process based on the original code copy, and after the code modifier is improved, the branch update code can be pushed to the local, so that the code modifier can update the code based on the latest branch code synchronously, and the collision probability is reduced. 3. Automatic verification: for the submission conflict of the public module, after the conflict is modified, whether the system is submitted after automatic combination or manual combination, the accuracy and confirmation cannot be achieved in a hundred percent.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a code processing apparatus for implementing the above-mentioned code processing method. The implementation scheme for solving the problem provided by the apparatus is similar to the implementation scheme described in the above method, so specific limitations in one or more embodiments of the code processing apparatus provided below may refer to the above limitations on the code processing method, and details thereof are not repeated herein.
In one embodiment, as shown in fig. 5, there is provided a code processing apparatus including: a receiving module 510, an obtaining module 520, and an updating module 530, wherein:
a receiving module 510, configured to receive a modification code, which is submitted by a first user terminal and is for a target branch on a code server; modifying the modified code based on the first basic code of the target branch; the code server stores different versions of codes of a plurality of branches;
an obtaining module 520, configured to obtain a current basic code corresponding to a target branch;
an updating module 530, configured to update the current basic code corresponding to the target branch according to the modification code under the condition that the first basic code is the same as the current basic code, to obtain a second basic code, and send the second basic code to the second user terminal, so that the second user terminal performs code modification on the target branch based on the second basic code.
In an embodiment, the updating module 530 is further configured to generate a test case corresponding to the second basic code; and updating the current test case table of the target branch according to the test cases.
In one embodiment, the apparatus further includes a sending module, configured to send a prompt message to the first user terminal when the first basic code is different from the current basic code; the prompt message is used for indicating the first user terminal to acquire the current basic code from the code server and modify the code by taking the current basic code as a modification basis, or combining the current basic code and the modified code.
In one embodiment, the apparatus further includes a regression testing module, configured to receive a new modification code submitted by the first user terminal; the new modified code is obtained by modifying or combining based on the current basic code; acquiring a test case of a historical modification code corresponding to a current basic code; and performing regression testing on the functions of the new modified codes through the test cases of the historical modified codes, and storing regression testing results to a database.
In one embodiment, the apparatus further includes a confirmation module, configured to obtain a history modification user terminal corresponding to the history modification code; sending information to be confirmed to a history modification user terminal; the information to be confirmed is used for indicating the historical modification user terminal to confirm whether the new modification code influences the function of the historical modification code; when some historical modification user terminals do not return confirmation information and the regression test result indicates that the test is failed, returning a message that a new modification code cannot be updated to the first user terminal; the validation information characterizes the new modification code without affecting the functionality of the historical modification code.
In an embodiment, the confirmation module is further configured to update the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code when the partial history modification user terminal does not return the confirmation information but the regression test result is that the test passes; or when receiving the confirmation information returned by all the historical modification user terminals, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code.
The respective modules in the code processing apparatus described above may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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 an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing data in the code processing process. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a code processing method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In an embodiment, a computer program product is provided, comprising a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
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 for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include a Read-Only Memory (ROM), a magnetic tape, a floppy disk, a flash Memory, an optical Memory, a high-density embedded nonvolatile Memory, a resistive Random Access Memory (ReRAM), a Magnetic Random Access Memory (MRAM), a Ferroelectric Random Access Memory (FRAM), a Phase Change Memory (PCM), a graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), for example. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (10)

1. A method of code processing, the method comprising:
receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of code for a plurality of branches;
acquiring a current basic code corresponding to the target branch;
and under the condition that the first basic code is the same as the current basic code, updating the current basic code corresponding to the target branch according to the modification code to obtain a second basic code, and sending the second basic code to a second user terminal to enable the second user terminal to modify the code of the target branch on the basis of the second basic code.
2. The method of claim 1, after the updating the current base code corresponding to the target branch according to the modified code to obtain a second base code, further comprising:
generating a test case corresponding to the second basic code;
and updating the current test case table of the target branch according to the test case.
3. The method of claim 1, further comprising:
sending a prompt message to the first user terminal under the condition that the first basic code is different from the current basic code;
the prompt information is used for instructing the first user terminal to acquire the current basic code from the code server, and to modify the code based on the current basic code, or to combine the current basic code and the modified code.
4. The method of claim 3, further comprising, after said sending the reminder to the first user terminal:
receiving a new modification code submitted by the first user terminal; the new modified code is obtained by modifying or combining based on the current basic code;
acquiring a test case of a historical modification code corresponding to the current basic code;
and performing regression testing on the functions of the new modified codes through the test cases of the historical modified codes, and storing regression testing results to a database.
5. The method of claim 4, further comprising:
acquiring a history modification user terminal corresponding to the history modification code;
sending information to be confirmed to the history modification user terminal; the information to be confirmed is used for indicating the historical modification user terminal to confirm whether the new modification code affects the function of the historical modification code;
when some historical modification user terminals do not return confirmation information and the regression test result indicates that the test does not pass, returning a message that the new modification code cannot be updated to the first user terminal; the confirmation information characterizes that the new modification code does not affect the function of the historical modification code.
6. The method according to claim 4 or 5, characterized in that the method further comprises:
when some historical modification user terminals do not return confirmation information but the regression test result is that the test is passed, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code;
or when receiving the confirmation information returned by all the historical modification user terminals, updating the current basic code corresponding to the target branch according to the new modification code to obtain a second basic code.
7. A code processing apparatus, characterized in that the apparatus comprises:
the system comprises a receiving module, a processing module and a processing module, wherein the receiving module is used for receiving a modification code which is submitted by a first user terminal and aims at a target branch on a code server; the modified code is modified based on the first basic code of the target branch; the code server stores different versions of code for a plurality of branches;
the acquisition module is used for acquiring the current basic code corresponding to the target branch;
and the updating module is used for updating the current basic code corresponding to the target branch according to the modification code under the condition that the first basic code is the same as the current basic code to obtain a second basic code, and sending the second basic code to a second user terminal, so that the second user terminal modifies the code of the target branch by taking the second basic code as a modification basis.
8. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by a processor.
CN202210237357.6A 2022-03-10 2022-03-10 Code processing method and device, computer equipment and storage medium Pending CN114579171A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210237357.6A CN114579171A (en) 2022-03-10 2022-03-10 Code processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210237357.6A CN114579171A (en) 2022-03-10 2022-03-10 Code processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114579171A true CN114579171A (en) 2022-06-03

Family

ID=81774596

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210237357.6A Pending CN114579171A (en) 2022-03-10 2022-03-10 Code processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114579171A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023241678A1 (en) * 2022-06-17 2023-12-21 华为云计算技术有限公司 Cloud service-based microservice version management method and cloud management platform

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023241678A1 (en) * 2022-06-17 2023-12-21 华为云计算技术有限公司 Cloud service-based microservice version management method and cloud management platform

Similar Documents

Publication Publication Date Title
CN110321254B (en) Software version rollback method, device, server and storage medium
WO2019056540A1 (en) Test case automation management method and apparatus, device, and storage medium
CN109408262B (en) Service data processing method and related equipment
CN113448862B (en) Software version testing method and device and computer equipment
CN115016836B (en) Component version management method, device, electronic equipment and system
CN111984239A (en) Page configuration method, device, server and storage medium
CN114385570B (en) Method, device, electronic equipment and readable medium for data synchronization
CN112256318A (en) Construction method and equipment for dependent product
CN114780138B (en) Flow field simulation software code version management method and device and storage medium
CN114579171A (en) Code processing method and device, computer equipment and storage medium
CN116595954A (en) Method, device, equipment and storage medium for editing items
US12164406B2 (en) Error handling recommendation engine
CN114185591A (en) Code checking method, apparatus, storage medium and computer program product
CN110990475B (en) Batch task inserting method and device, computer equipment and storage medium
CN117971297B (en) Method, apparatus, computer device and storage medium for packet dependent synchronization
US7478118B2 (en) Method and apparatus for synchronizing of databases connected by wireless interface
CN111949731A (en) Data synchronization method and device, electronic equipment and storage medium
CN111177279A (en) Form saving method and device, storage medium and electronic equipment
CN112947948A (en) Application service deployment method and device
CN118519676A (en) Configuration information updating method, device, equipment, storage medium and program product
CN114371870B (en) Code scanning and submitting method, code scanning server, client and server
CN118193508A (en) Data checking method, device, computer equipment and storage medium
CN116701895A (en) Information comparison method, device and computer equipment
CN116483849B (en) SQL file updating method, device and electronic device
CN116303288A (en) Method, device, equipment and medium for processing batch files in financial business system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination