IP Library › Granted Patent US 12,001,838
Granted Patent B2
US 12,001,838 · App. 17/851,627 · Granted Jun 4, 2024

Method and apparatus for merging a plurality of software code change versions

Inventors: Zhao Wei (Gui'an, CN); Guangtai Liang (Beijing, CN); Lin Li (Beijing, CN); Qianxiang Wang (Beijing, CN)
Assignee: HUAWEI CLOUD COMPUTING TECHNOLOGY CO., LTD.
G06F8/71G06F11/3604
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,001,838
App. No.
17/851,627
Granted
Jun 4, 2024
Kind
B2
Abstract

A method for merging a plurality of software code change versions, where a merging apparatus may first analyze code change areas in a software code preliminarily merged version and two different software code change versions. After change intents of the two code change areas are determined, the merging apparatus eliminates, based on a conflict elimination rule set and the change intents of the two code change areas, a conflict block in the software code preliminarily merged version.

Claims (60)

1. A method for merging a plurality of software code change versions, the method comprising:

obtaining, based on original software code that has been changed, both a first software code change version of a conflict block in a software code preliminarily merged version and a second software code change version of the conflict block;

analyzing both a first code area in the first software code change version and a second code area in the second software code change version;

determining, based on analyzing both the first code area in the first software code change version and the second code area in the second software code change version, a first change intent of the first code area in the first software code change version and a second change intent of the second code area in the second software code change version; and

eliminating the conflict block based on a conflict elimination rule set, the first change intent of the first code area in the first software code change version, and the second change intent of the second code area in the second software code change version,

wherein the conflict elimination rule set comprises at least one conflict elimination rule, and

wherein each of the at least one conflict elimination rule records a conflict elimination solution used for merging code change areas in different software code change versions for conflict blocks.

2. The method of claim 1 , further comprising invoking a prediction model to eliminate the conflict block, wherein the prediction model is configured to output the conflict elimination solution based on an input conflict block.

3. The method of claim 1 , further comprising:

analyzing the conflict block and a first unilateral change block in the software code preliminarily merged version;

determining, based on analyzing the conflict block and the first unilateral change block in the software code preliminarily merged version, a first association relationship between second unilateral change blocks and a second association relationship between the first unilateral change block and the conflict block; and

prompting, based on the first association relationship and the second association relationship, that an implicit conflict exists.

4. The method of claim 3 , wherein the first association relationship comprises a first modification or reference relationship of a first function between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a second function between the first unilateral change block and the conflict block.

5. The method of claim 3 , wherein the first association relationship comprises a first modification or reference relationship of a function between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a variable between the first unilateral change block and the conflict block.

6. The method of claim 3 , wherein the first association relationship comprises a first modification or reference relationship of a variable between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a function between the first unilateral change block and the conflict block.

7. The method of claim 3 , wherein the first association relationship comprises a first modification or reference relationship of a first variable between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a second variable between the first unilateral change block and the conflict block.

8. The method of claim 1 , further comprising:

invoking a plurality of change analyzers to analyze a first change action set, wherein the first change action set records a first change action in the first code area in the first software code change version for the original software code;

determining, based on analyzing the first change action set, the first change intent of the first code area in the first software code change version;

invoking the plurality of change analyzers to analyze a second change action set, wherein the second change action set records a second change action in the second code area in the second software code change version for the original software code, and wherein one of the plurality of change analyzers is configured to analyze one type of statement, variable, function, or class in the first change action set and the second change action set; and

determining, based on analyzing the second change action set, the second change intent of the second code area in the second software code change version.

9. The method of claim 8 , further comprising:

constructing a first syntax tree of the original software code, a second syntax tree of the first software code change version, and a third syntax tree of the second software code change version;

determining, based on the first syntax tree of the original software code and the second syntax tree of the first software code change version, the first change action set; and

determining, based on the first syntax tree of the original software code and the third syntax tree of the second software code change version, the second change action set.

10. A computing device cluster comprising a plurality of computing devices, wherein the plurality of computing devices comprise:

a memory configured to store computer program instructions; and

a processor coupled to the memory and configured to execute the computer program instructions to cause the computing device cluster to:

obtain, based on original software code that has been changed, both a first software code change version of a conflict block in a software code preliminarily merged version and a second software code change version of the conflict block;

analyze both a first code area in the first software code change version and a second code area in the second software code change version;

determine, based on analyzing both the first code area in the first software code change version and the second code area in the second software code change version, a first change intent of the first code area in the first software code change version and a second change intent of the second code area in the second software code change version; and

eliminate the conflict block based on a conflict elimination rule set, the first change intent of the first code area in the first software code change version, and the second change intent of the second code area in the second software code change version,

wherein the conflict elimination rule set comprises at least one conflict elimination rule, and

wherein each of the at least one conflict elimination rule records a conflict elimination solution used for merging code change areas in different software code change versions for conflict blocks.

11. The computing device cluster of claim 10 , wherein the processor is further configured to execute the computer program instructions to cause the computing device cluster to invoke a prediction model to eliminate the conflict block, and wherein the prediction model is configured to output the conflict elimination solution based on an input conflict block.

12. The computing device cluster of claim 10 , wherein the processor is further configured to execute the computer program instructions to cause the computing device cluster to:

analyze the conflict block and a first unilateral change block in the software code preliminarily merged version;

determine, based on analyzing the conflict block and the first unilateral change block in the software code preliminarily merged version, a first association relationship between second unilateral change blocks and a second association relationship between the first unilateral change block and the conflict block; and

prompt, based on the first association relationship and the second association relationship, that an implicit conflict exists.

13. The computing device cluster of claim 12 , wherein the first association relationship comprises a first modification or reference relationship of a first function between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a second function between the first unilateral change block and the conflict block.

14. The computing device cluster of claim 12 , wherein the first association relationship comprises a first modification or reference relationship of a function between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a variable between the first unilateral change block and the conflict block.

15. The computing device cluster of claim 12 , wherein the first association relationship comprises a first modification or reference relationship of a variable between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a function between the first unilateral change block and the conflict block.

16. The computing device cluster of claim 12 , wherein the first association relationship comprises a first modification or reference relationship of a first variable between the second unilateral change blocks, and wherein the second association relationship comprises a second modification or reference relationship of a second variable between the first unilateral change block and the conflict block.

17. The computing device cluster of claim 10 , wherein the processor is further configured to execute the computer program instructions to cause the computing device cluster to:

invoke a plurality of change analyzers to analyze a first change action set, wherein the first change action set records a first change action in the first code area in the first software code change version for the original software code;

determine, based on analyzing the first change action set, the first change intent of the first code area in the first software code change version;

invoke the plurality of change analyzers to analyze a second change action set, wherein the second change action set records a second change action in the second code area in the second software code change version for the original software code, and wherein one of the plurality of change analyzers is configured to analyze one type of statement, variable, function, or class in the first change action set and the second change action set; and

determine, based on analyzing the second change action set, the second change intent of the second code area in the second software code change version.

18. The computing device cluster of claim 17 , wherein the processor is further configured to execute the computer program instructions to cause the computing device cluster to:

construct a first syntax tree of the original software code, a second syntax tree of the first software code change version, and a third syntax tree of the second software code change version;

determine, based on the first syntax tree of the original software code and the second syntax tree of the first software code change version, the first change action set; and

determine, based on the first syntax tree of the original software code and the third syntax tree of the second software code change version, the second change action set.

19. A computer program product comprising computer-executable instructions that are stored on a non-transitory computer-readable medium and that, when executed by a processor of an apparatus, cause the apparatus to:

obtain, based on original software code that has been changed, both a first software code change version of a conflict block in a software code preliminarily merged version and a second software code change version of the conflict block;

analyze both a first code area in the first software code change version and a second code area in the second software code change version;

determine, based on analyzing both the first code area in the first software code change version and the second code area in the second software code change version, a first change intent of the first code area in the first software code change version and a second change intent of the second code area in the second software code change version; and

eliminate the conflict block based on a conflict elimination rule set, the first change intent of the first code area in the first software code change version, and the second change intent of the second code area in the second software code change version,

wherein the conflict elimination rule set comprises at least one conflict elimination rule, and

wherein each of the at least one conflict elimination rule records a conflict elimination solution used for merging code change areas in different software code change versions for conflict blocks.

20. The computer program product of claim 19 , wherein the computer-executable instructions further cause the apparatus to invoke a prediction model to eliminate the conflict block, and wherein the prediction model is configured to output the conflict elimination solution based on an input conflict block.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 24, 2024
From: WEI, ZHAO; LIANG, GUANGTAI; LI, LIN; WANG, QIANXIANG
To: HUAWEI CLOUD COMPUTING TECHNOLOGIES CO., LTD.
Reel/Frame 067208/0777 →
Priority Claims (1)
CN 201911383077.0 · Dec 28, 2019 · national
Continuity (2)
Continuation PCTCN2020115692 · Sep 16, 2020
Related Publication 20220365775A1 · Nov 17, 2022