Branch code merging method, apparatus, device, and storage medium

CN115167822BActive Publication Date: 2026-10-30BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210878120.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-10-30
Estimated Expiration
2042-07-25

AI Technical Summary

Technical Problem

但是,手动合并分支代码的过程耗时耗力,影响开发效率,尤其是开发分支较多时,频繁的手动合并代码操作会严重降低开发效率

Benefits of technology

[0017]本公开实施例的分支代码合并方法、装置、设备和存储介质,能够在分布式开发过程中,以文件的形式替代传统的代码形式,将每个功能开发分支中相对于主分支产生变更的待合并代码独立存储于目标目录下的分支文件中,以及在分支代码合并的过程中,获取目标目录下存储的各分支文件,并将读取到的各所述分支文件的内容存储至所述主分支对应的目标文件的目标位置处,以保留各分支中的代码,自动完成各功能开发分支与主分支的代码合并,解决了分支代码合并过程中出现代码冲突的问题和代码冲突时需人工手动合并代码而引起的开发效率低的问题,提高了分支代码合并的效率,从而提高了项目开发效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115167822B_ABST
    Figure CN115167822B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the field of computers, and particularly relates to a branch code merging method and device, equipment and a storage medium. The method comprises: in response to a branch code merging instruction, obtaining at least one branch file stored in a target directory; wherein the branch file is used to store to-be-merged code corresponding to a function development branch; the to-be-merged code is code changed by the function development branch relative to a master branch; reading each branch file and storing the reading result to a target position of a target file corresponding to the master branch, so as to merge each to-be-merged code to the code of the master branch. According to the embodiment of the present disclosure, the problems of code conflict in the branch code merging process and the problem of low development efficiency caused by manual code merging in the case of code conflict are solved, and the efficiency of branch code merging and the project development efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for merging branch code. Background Technology

[0002] To improve project development efficiency, open-source distributed version control systems such as Git have emerged. This allows developers on a research and development team to use Git to generate a main branch and corresponding feature development branches for different functions, enabling distributed development. After development is complete, all feature development branches are merged into the main branch to finish the project.

[0003] During the merging of the main branch and feature development branches, if different branches have modified the same line of code, the Git system will encounter a merge conflict because it cannot determine which branch's code to accept.

[0004] In existing technologies, when encountering branch code merge conflicts, the main approach is for developers to manually merge the code using the Git system. However, manually merging branch code is time-consuming and labor-intensive, impacting development efficiency, especially when there are many development branches; frequent manual code merging operations can severely reduce development efficiency. Summary of the Invention

[0005] To address the aforementioned technical problems, this disclosure provides a branch code merging method, apparatus, device, and storage medium.

[0006] Firstly, this disclosure provides a method for merging branch code, the method comprising:

[0007] In response to a branch code merging instruction, at least one branch file stored in the target directory is retrieved; wherein, the branch file is used to store the code to be merged corresponding to the feature development branch; the code to be merged is the code in the feature development branch that has changed relative to the main branch;

[0008] Each branch file is read, and the reading results are stored in the target location of the target file corresponding to the main branch, so as to merge each of the code to be merged into the code of the main branch.

[0009] Secondly, this disclosure provides a branch code merging apparatus, the apparatus comprising:

[0010] The branch file retrieval module is used to retrieve at least one branch file stored in the target directory in response to a branch code merging instruction; wherein, the branch file is used to store the code to be merged corresponding to the feature development branch; the code to be merged is the code in the feature development branch that has changed relative to the main branch;

[0011] The code merging module is used to read each of the branch files and store the reading results in the target location of the target file corresponding to the main branch, so as to merge each of the code to be merged into the code of the main branch.

[0012] Thirdly, this disclosure provides an electronic device comprising:

[0013] processor;

[0014] Memory, used to store executable instructions;

[0015] The processor is used to read executable instructions from memory and execute the executable instructions to implement the branch code merging method described in any embodiment of this disclosure.

[0016] Fourthly, this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the branch code merging method described in any embodiment of this disclosure.

[0017] The branch code merging method, apparatus, device, and storage medium disclosed herein can replace the traditional code format with files in distributed development processes. The code to be merged that has changed relative to the main branch in each functional development branch is independently stored in branch files under the target directory. During the branch code merging process, each branch file stored in the target directory is retrieved, and the contents of each retrieved branch file are stored in the target location of the target file corresponding to the main branch, thus preserving the code in each branch. This automatically completes the merging of code between each functional development branch and the main branch, solving the problem of code conflicts during branch code merging and the low development efficiency caused by the need for manual code merging when conflicts occur. This improves the efficiency of branch code merging, thereby improving project development efficiency. Attached Figure Description

[0018] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent when taken in conjunction with the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.

[0019] Figure 1 A flowchart illustrating a branch code merging method provided in an embodiment of this disclosure;

[0020] Figure 2 A flowchart illustrating another branch code merging method provided in this embodiment of the disclosure;

[0021] Figure 3This is a schematic diagram of the structure of a branch code merging device provided in an embodiment of the present disclosure;

[0022] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0023] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0024] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.

[0025] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.

[0026] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.

[0027] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0028] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0029] In current collaborative development teams, based on distributed development systems such as Git, a master branch and at least one feature development branch are generated. As development progresses, code in the same code file in the master branch and each feature development branch may change, and code merge conflicts may occur due to differences in the same line of code in different branches.

[0030] For example, the code content of the ABConfigCenter file related to the AB experiment configuration in the main branch is as follows:

[0031]

[0032] The code content of ABConfigCenter in the first feature development branch is as follows:

[0033]

[0034] The code content of ABConfigCenter in the second feature development branch is as follows:

[0035]

[0036]

[0037] After the first feature development branch is automatically merged into the main branch via the Git system, the code content of ABConfigCenter in the main branch changes as follows:

[0038]

[0039] When the second feature development branch continues to be merged into the main branch, the fourth line of code in the modified main branch is "register("config_a",ConfigA.class);", while the fourth line of code in the second feature development branch is "register("config_b",ConfigB.class);". At this point, the Git system cannot automatically determine whether to use the fourth line of code in the modified main branch or the fourth line of code in the second feature development branch, and therefore cannot automatically merge the branch code.

[0040] In the current technology, developers manually merge the second feature development branch into the main branch using the Git system to address the above situation, thus preserving the fourth line of code from both branches. However, this manual branch merging method is time-consuming and labor-intensive, and can severely impact development efficiency when there are many branches.

[0041] Based on the above, this disclosure provides a branch code merging method to independently store the code that changes from the main branch in a branch file in a specified directory, and to traverse each branch file during the branch code merging process, and retain all the code in the branch file in the target file corresponding to the main branch, thereby achieving the purpose of retaining the differences in the code of each branch at the same time, avoiding the problem of branch code merging conflicts, and thus improving development efficiency.

[0042] The branch code merging method provided in this disclosure is applicable to the automatic merging of all branch code while preserving it in a distributed development scenario. This method can be executed by a branch code merging device, which can be implemented in software and / or hardware. The device can be integrated into an electronic device with development capabilities, including but not limited to laptops, desktop computers, or servers.

[0043] Figure 1 A flowchart illustrating a branch code merging method provided in an embodiment of this disclosure is shown. Figure 1 As shown, this branch code merging method may include the following steps:

[0044] S110. In response to the branch code merging instruction, obtain at least one branch file stored in the target directory. The branch file is used to store the code to be merged corresponding to the feature development branch. The code to be merged is the code in the feature development branch that has changed relative to the main branch.

[0045] The branch merge command is an instruction to automatically merge the code of at least two branches. The target directory is a pre-specified directory for storing code files, which can be set by the development team. Branch files are used to store code from feature development branches that has changed relative to the master branch.

[0046] Specifically, as described above, in related technologies, each feature development branch copies the code from the master branch, makes code changes (modifications or additions, etc.) on that basis, and finally merges the code of the feature development branch into the code of the master branch. However, this code merging method may lead to code merge conflicts. Therefore, in this embodiment of the disclosure, instead of directly modifying the branch code, a branch file is created to store the code that needs to be changed, and this branch file is stored in the target directory. In this way, developers can create branch files in the target directory during the development of feature development branches. Then, all the code that has changed relative to the code of the master branch and needs to be retained in the code of the master branch is written into the branch file. Following the above process, the target directory will store the branch file corresponding to each feature development branch.

[0047] The electronic device can detect whether a branch code merging command has been received. For example, when a developer triggers the code merging function control in the development tools displayed on the electronic device, the device can detect the branch code merging command. Alternatively, the developer may have pre-associated the branch code merging function with the installation package generation function or other functions of the development project. When the developer triggers the development tools to perform installation package generation or other functions, the electronic device can also detect the branch code merging command. Then, the electronic device can traverse the target directory and retrieve all branch files.

[0048] In some embodiments, the filename or content of the branch file is the code to be merged.

[0049] Specifically, when developers create branch files, the file name and file content of the branch files can be set according to the application scenario. In this way, the relationship between the code to be merged and the file name and file content is determined accordingly based on the application scenario.

[0050] In one example, when the code to be merged is relatively short and has no explicit object associations, the code to be merged can be used directly as the file name, while the file content is empty.

[0051] In another example, when the code to be merged is long and has no explicit object association, the code to be merged can be directly used as the file content, and the file name can be randomly generated according to the file creation rules.

[0052] In another example, when the code to be merged is long and needs to be explicitly mapped to a certain object, the code to be merged can be used as the file content, and the file name can be defined as the name of the mapped object, etc.

[0053] S120. Read each branch file and store the reading results in the target location of the target file corresponding to the main branch, so as to merge each code to be merged into the code of the main branch.

[0054] In this context, the object file is the file in the main branch used to store code. The target location is the position within the object file where new code can be inserted; it can be a pre-set, fixed location, or a location that changes as more code is added.

[0055] Specifically, for any branch file in the target directory, the electronic device performs the following process: It reads the branch file according to the storage rules of the code to be merged; then, it locates the target position in the target file and inserts the result of reading the branch file into the target position. In this way, the electronic device merges the code to be merged from the branch file into the code of the main branch, completing the merging process between the feature development branch and the main branch.

[0056] Following the above process, the electronic device can store the code to be merged in each branch file into the target file corresponding to the main branch, completing the automatic merging of each functional development branch and the main branch, without the conflict problem during code merging in related technologies, thereby improving the efficiency of branch code merging and thus improving development efficiency.

[0057] The branch code merging method provided in this disclosure can replace the traditional code format with files in the distributed development process. The code to be merged that has changed relative to the main branch in each functional development branch is independently stored in a branch file under the target directory. During the branch code merging process, the branch files stored in the target directory are obtained, and the contents of each branch file are stored in the target location of the target file corresponding to the main branch, so as to retain the code in each branch. The method automatically completes the merging of code between each functional development branch and the main branch, which solves the problem of code conflicts during the branch code merging process and the problem of low development efficiency caused by manual code merging when code conflicts occur. It improves the efficiency of branch code merging, thereby improving the project development efficiency.

[0058] In some embodiments, when the code to be merged is configuration class code, the file name of the branch file is the configuration identifier corresponding to the configuration class code, and the file content of the branch file is the configuration class code.

[0059] Configuration code refers to the code used to configure objects / parameters in a developed software project. For example, configuration code might specify which parameters of an object need to be configured; it could also be the definition code of data classes needed to parse the configuration data of the object, the registration code of the mapping relationship between data classes and the objects / parameters to be configured, and so on. Configuration identifiers are the identifiers of the objects that need to be configured, such as the name of the object to be configured, or the name of a variable that has a one-to-one correspondence with the object to be configured.

[0060] Specifically, the branch code merging method provided in this embodiment can be applied to configuration class scenarios where objects / parameters in a software project are configured. In this way, the code to be merged can be the configuration class code of the functional objects or object parameters developed in the corresponding functional development branch. To ensure the correct parsing of subsequent configuration data, the configuration class code needs to be mapped to the corresponding configuration identifier. To improve the reading efficiency of branch files, the filename of the branch file can be directly set to the configuration identifier corresponding to the configuration class code, while the configuration class code itself is used as the file content.

[0061] In some embodiments, the configuration class scenario can specifically be the configuration class scenario of an A / B experiment. In this case, the configuration identifier is the configuration item identifier corresponding to the A / B experiment, and the configuration class code is the data class corresponding to the configuration item identifier.

[0062] Specifically, A / B testing involves creating two (A / B) or more (A / B / n) versions of a specific function or interface in an application. Simultaneously, these versions are randomly accessed by visitor groups with similar or identical compositions. User experience and business data from each visitor group are then analyzed and evaluated to determine the best version for official adoption. For example, in an e-book reader, the default font size is set through the `text_size` field in the `reader_config` user configuration. In an A / B test targeting the default font size, server-side traffic splitting can be used to set the `text_size` field value to 16 for one group and 18 for another, thus validating the impact of font size on user experience.

[0063] In the example above, the `text_size` field value in the user configuration item `reader_config` is obtained by sending corresponding JSON data from the server. To parse this JSON data on the client side, a data class `ReaderConfig.class` needs to be added to the corresponding client-side code. If there are multiple A / B tests, there will be multiple configuration items and their corresponding data classes. Therefore, it is necessary to pre-register the mapping relationship between configuration items and data classes through code. A code example from related technologies is as follows:

[0064]

[0065] Therefore, when starting an A / B test in any feature development branch, developers need to use the example code above to register the mapping relationship between the configuration items and data classes corresponding to the A / B test.

[0066] Based on the above description of the branch files, in this embodiment of the disclosure, developers do not need to write the example code described above. Instead, they create branch files corresponding to the functional development branch of the A / B experiment, and use the configuration item identifier reader_config as the file name, and the corresponding data class ReaderConfig.class as the file content, to show the mapping relationship between the configuration item identifier and the data class. The code example is as follows:

[0067] / / file:reader_config

[0068] ReaderConfig.class.

[0069] In some embodiments, in the configuration scenario of A / B experiments, the target file is used to parse the configuration data corresponding to the A / B experiment sent by the server to the client to obtain the parsed configuration data; the parsed configuration data is used to modify the configuration information of the target configuration item in the client to complete the differentiated configuration of the target configuration item in each client.

[0070] Specifically, after the electronic device completes the aforementioned branch code merging process, it can generate the corresponding installation package according to the processing procedures in related technologies and publish it online. In this way, during the operation of the application corresponding to the installation package, the server can send the configuration data corresponding to the A / B experiment to the client running the application, such as the JSON data corresponding to the text_size field mentioned above. The client determines the data class ReaderConfig mapped to the configuration item reader_config corresponding to the text_size field based on the target file, and parses the JSON data based on this data class ReaderConfig to obtain the field value of 16 or 18 for the text_size field. It then configures the target configuration item (such as the default font size) according to the parsed field value and performs differentiated display.

[0071] Figure 2 This is a flowchart of another branch code merging method provided in this disclosure embodiment. It adds a step related to "generating branch code merging instructions." Based on this, the step of "reading each branch file and storing the reading results in the target location of the target file corresponding to the main branch, so as to merge each piece of code to be merged into the code of the main branch" can be further refined. Based on the above, a step related to "generating a project installation package" can also be added. The explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here. See [link to documentation]. Figure 2 The branch code merging method includes:

[0072] S210, in response to project code compilation instructions, determines the script tasks that the compilation task depends on.

[0073] Among these, project code compilation instructions are the operation instructions that trigger the compilation of project code, which can be generated by triggering the compilation function in the development tool. Script tasks are the tasks that execute scripts in the process of building the software project's installation package. Script tasks are used to merge the code to be merged into the main branch.

[0074] Specifically, electronic devices can implement the branch code merging process through scripts and associate these scripts with the compilation process of software projects to automatically merge branch code during compilation. This saves the manual triggering process of branch code merging, further improves the automation level of the development process, and thus further improves development efficiency.

[0075] In practice, developers can add a new task to the build process of the software project's installation package, and use this task to execute the script corresponding to the branch code merging function. This new task can be called a script task. Furthermore, considering that the compilation process of building the installation package needs to read and use the target files in the main branch, a task dependency relationship can be established between the script task and the compilation task, making the compilation task dependent on the script task.

[0076] Building upon the above steps, when a developer triggers the project code compilation function, the electronic device can detect the project code compilation instructions. The electronic device can then locate the compilation task. At this point, the script tasks that the compilation task depends on can be determined through the task dependencies defined above.

[0077] S220: Trigger the execution of the script task to generate branch code merging instructions.

[0078] Specifically, since the compilation task depends on the script task, the electronic device can first trigger the execution of the script task. At this time, the electronic device can generate a branch code merging instruction, which can then trigger the execution of the branch code merging function in the script task.

[0079] S230. In response to the branch code merging instruction, obtain at least one branch file stored in the target directory. The file name and file content of the branch file are respectively the configuration item identifier and data class corresponding to the AB experiment.

[0080] S240. Traverse each branch file and store the file name and file content of the traversed branch file as key-value pairs.

[0081] Specifically, in the configuration-based scenario of the A / B test, each branch file's name is a configuration item identifier, and its content is a data type. Therefore, during the merging of branch code, the electronic device obtains all branch files, iterates through each branch file, and uses the file name of the encountered branch file as the key and the file content as the value. For example, a map-structured storage object is created, with the configuration item identifier as the key and the data type as the value. In this way, all branch files can be converted into map objects.

[0082] S250. Determine the registration function in the target file and locate the last line position in the registration function as the target position.

[0083] Specifically, the electronic device can traverse the code statements in the target file (such as the ABConfigCenter code file corresponding to the main branch mentioned above) to determine the location of the registration line number public void register(), and use that location as a basis to continue locating the last line position in the registration function as the target position. For example, if there is no registration with a mapping relationship in the main branch, the last line position is the beginning position of the registration function body {} in the target file; if at least one mapping relationship has been registered in the main branch, then the last line position is the end position of the last registration statement in the registration function body {} in the target file.

[0084] S260. Parse the key-value pairs and insert the parsing results according to the registration statement format after the last line to merge each piece of code into the main branch.

[0085] Specifically, starting from the next line of code immediately following the last line, the electronic device inserts each key-value pair from the map object into the registration function line by line, following the required format of the registration statement, such as "register("[key]",[value]);". This completes the process of storing the code to be merged from each branch file into the code of the main branch.

[0086] S270. Execute the compilation task to generate the project installation package.

[0087] Specifically, after the script task is completed, the compilation task and other tasks can continue to be executed according to the installation package build process, and finally the project installation package will be generated.

[0088] The branch code merging method provided in this embodiment can respond to project code compilation instructions, determine the script task that the compilation task depends on, which is used to merge each piece of code to be merged into the main branch, and trigger the execution of the script task to generate a branch code merging instruction. The branch code merging instruction is then used to trigger the merging of branch code. This achieves automatic merging of branch code during the compilation process of project code, saving the manual triggering process of branch code merging, thereby further improving the automation level and development efficiency of the development process.

[0089] The following are embodiments of the branch code merging device provided in this invention. This device and the branch code merging method of the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the branch code merging device, please refer to the embodiments of the above branch code merging method.

[0090] Figure 3 A schematic diagram of a branch code merging apparatus provided in an embodiment of this disclosure is shown. Figure 3 As shown, the branch code merging device 300 may include:

[0091] The branch file retrieval module 310 is used to retrieve at least one branch file stored in the target directory in response to a branch code merging command; wherein, the branch file is used to store the code to be merged corresponding to the feature development branch; the code to be merged is the code in the feature development branch that has changed relative to the main branch;

[0092] The code merging module 320 is used to read the files of each branch and store the reading results in the target location of the target file corresponding to the main branch, so as to merge the code to be merged into the code of the main branch.

[0093] The branch code merging device provided in this embodiment can replace the traditional code form with files in the distributed development process. It independently stores the code to be merged that has changed relative to the main branch in each functional development branch in the branch file under the target directory. In the branch code merging process, it obtains each branch file stored in the target directory and stores the contents of each branch file in the target location of the target file corresponding to the main branch, so as to retain the code in each branch. It automatically completes the merging of code between each functional development branch and the main branch, which solves the problem of code conflict during the branch code merging process and the problem of low development efficiency caused by manual code merging when code conflicts occur. It improves the efficiency of branch code merging, thereby improving the project development efficiency.

[0094] In some embodiments, when the code to be merged is configuration class code, the file name of the branch file is the configuration identifier corresponding to the configuration class code, and the file content of the branch file is the configuration class code.

[0095] Furthermore, the configuration identifier is the configuration item identifier corresponding to the AB experiment, and the configuration class code is the data class corresponding to the configuration item identifier.

[0096] In some embodiments, the code merging module 320 is specifically used for:

[0097] Iterate through each branch file and store the file name and file content of the traversed branch file as key-value pairs;

[0098] Identify the registration function in the target file and locate the last line of the registration function as the target location;

[0099] The key-value pairs are parsed, and the parsing results are inserted in the format of the registration statement after the last line to merge the code to be merged into the code of the main branch.

[0100] In some embodiments, the branch code merging apparatus 300 further includes a branch code merging instruction generation module, used for:

[0101] Before retrieving at least one branch file stored in the target directory in response to a branch code merging instruction, the script tasks that the compilation task depends on are determined in response to a project code compilation instruction; wherein, the script tasks are used to merge each piece of code to be merged into the code of the main branch;

[0102] Trigger the execution of the script task to generate branch code merging instructions.

[0103] In some embodiments, the target file is used to parse the configuration data corresponding to the A / B experiment sent by the server to the client to obtain the parsed configuration data; the parsed configuration data is used to modify the configuration information of the target configuration item in the client to complete the differentiated configuration of the target configuration item in each client.

[0104] In some embodiments, the filename or content of the branch file is the code to be merged.

[0105] The branch code merging device provided in the embodiments of the present invention can execute the branch code merging method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0106] It is worth noting that in the embodiments of the above-mentioned branch code merging device, the modules included are divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional module are only for easy differentiation and are not used to limit the scope of protection of this disclosure.

[0107] This disclosure also provides an electronic device that may include a processor and a memory, the memory being used to store executable instructions. The processor can be used to read executable instructions from the memory and execute the executable instructions to implement the branch code merging method in the above embodiments.

[0108] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure is shown.

[0109] like Figure 4 As shown, the electronic device 400 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. The RAM 403 also stores various programs and data required for the operation of the information processing device 400. The processing unit 401, ROM 402, and RAM 403 are interconnected via a bus 404. An input / output interface (I / O interface) 405 is also connected to the bus 404.

[0110] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touch screens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data.

[0111] It should be noted that, Figure 4 The illustrated electronic device 400 is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein. That is, although... Figure 4 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0112] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the branch code merging method of any embodiment of this disclosure.

[0113] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the branch code merging method in any embodiment of this disclosure.

[0114] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0115] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP, and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0116] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0117] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the branch code merging method described in any embodiment of this disclosure.

[0118] In embodiments of this disclosure, computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0119] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of devices, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0120] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0121] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0122] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0123] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0124] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A branch code merging method, characterized in that, include: In response to a branch code merging instruction, at least one branch file stored in the target directory is retrieved; wherein, the branch file is used to store the code to be merged corresponding to the feature development branch; the code to be merged is the code of the feature development branch that has changed relative to the main branch; the code to be merged for each feature development branch is stored independently in different branch files; the file name or file content of the branch file is the code to be merged; Each branch file is read, and the reading result is inserted into the target position of the target file corresponding to the main branch, so as to merge each of the code to be merged into the code of the main branch. The target file is the file in the main branch used to store the code, and the target position is the position in the target file for inserting new code.

2. The method according to claim 1, characterized in that, When the code to be merged is configuration class code, the file name of the branch file is the configuration identifier corresponding to the configuration class code, and the file content of the branch file is the configuration class code.

3. The method according to claim 2, characterized in that, The configuration identifier is the configuration item identifier corresponding to the AB experiment, and the configuration class code is the data class corresponding to the configuration item identifier.

4. The method according to claim 3, characterized in that, The step of reading each of the branch files and storing the reading results in the target location of the target file corresponding to the main branch, so as to merge each of the code to be merged into the main branch, includes: Traverse each of the branch files and store the file name and file content of the traversed branch files as key-value pairs; Identify the registration function in the target file and locate the last line position in the registration function as the target position; The key-value pairs are parsed, and the parsing results are inserted in the format of the registration statement after the last line position to merge each of the code to be merged into the code of the main branch.

5. The method according to claim 1, characterized in that, Before retrieving at least one branch file stored in the target directory in response to a branch code merge instruction, the method further includes: In response to the project code compilation instructions, determine the script tasks that the compilation task depends on; wherein, the script tasks are used to merge each of the code to be merged into the code of the main branch; The script task is triggered to generate the branch code merging instruction.

6. The method according to claim 3, characterized in that, The target file is used to parse the configuration data corresponding to the A / B experiment sent by the server to the client to obtain the parsed configuration data; the parsed configuration data is used to modify the configuration information of the target configuration items in the client to complete the differentiated configuration of the target configuration items in each client.

7. A branch code merging device, characterized in that, include: The branch file retrieval module is used to retrieve at least one branch file stored in the target directory in response to a branch code merging instruction; wherein, the branch file is used to store the code to be merged corresponding to the feature development branch; the code to be merged is the code that has changed from the main branch in the feature development branch; the code to be merged for each feature development branch is stored independently in a different branch file; the file name or file content of the branch file is the code to be merged; The code merging module is used to read each of the branch files and insert the reading results into the target position of the target file corresponding to the main branch, so as to merge each of the code to be merged into the code of the main branch. The target file is the file in the main branch used to store the code, and the target position is the position in the target file for inserting new code.

8. An electronic device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the branch code merging method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the branch code merging method described in any one of claims 1-6.

Citation Information

Patent Citations

  • Application function customizing method and device, computing equipment and storage medium

    CN108121563A

  • Branch management method and device

    CN111522578A