Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part 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. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are used merely to distinguish one device, module, or unit from another device, module, or unit, and are not intended to limit the order or interdependence of the functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The following describes the technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
An embodiment of the present disclosure provides a method for merging branches, as shown in fig. 1, where the method includes:
in step S101, when a branch merge request is received, the closest common node between the commit branch and the target branch to which the merge request corresponds is determined.
In the embodiment of the present disclosure, the target data packet refers to a data packet that needs to be combined, which may be a newly added data packet or a data packet that needs to be combined into a project, and the specific format of the data packet may be selected according to the specific implementation situation, which is not limited in the present disclosure. The common node refers to a data node shared between the branch in which the target packet is located and the target branch that is desired to be merged.
In an embodiment of the present disclosure, a method for processing a web,
for the embodiment of the disclosure, when a merging request of a target data packet is received, determining a commit branch where the target data packet is located and a target branch where the target data packet wants to be merged, and determining a common data node between the commit branch and the target branch as a common node, where the common data node is typically selected as a common data node closest to the commit branch on the target branch.
In step S102, a reference packet is acquired using the common node as a reference packet node, and a comparison packet is constructed based on the commit branch.
In the embodiment of the present disclosure, the reference data packet refers to a reference data packet in a meeting item, which may exist in a database or may be temporarily constructed according to requirements, and the present disclosure is not limited to this.
For the embodiment of the disclosure, a reference data packet is acquired based on a reference data packet node, specifically, whether the database stores the reference data packet is queried based on the reference data packet node, if not, the reference data packet node is triggered to package, and after the packet is successfully constructed, the packet information is uploaded to the database as compared with the packet construction; if so, the packaging flow of the reference data packet can be directly skipped, and because the time for constructing the reference data packet is long, the process of constructing the reference data packet is executed concurrently with the construction of the reference data packet, for convenience of explanation, a Jenkins platform is adopted to carry out Continuous Integration (CI, continuous integration) packaging, a plurality of downstream concurrent packaging tasks are created through a musiljob Phase plug-in of Jenkins, the packaging job of the reference data packet and the reference data packet are added, the concurrent execution is set, and the required parameters are transmitted through a para.txt file.
In step S103, the packet size of the reference packet and the packet size of the comparison packet are acquired.
In the embodiment of the present disclosure, after the reference data packet and the comparison data packet are acquired, packet size information of the reference data packet and the comparison data packet is acquired, respectively. Specifically, the packet size information of the reference data packet and the reference data packet is determined according to the construction address of the data packet when the data packet is constructed, and the packet size information of the reference data packet and the reference data packet is obtained according to the construction address of the data packet.
In step S104, it is determined whether to accept the merge request based on the packet size of the reference packet and the packet size of the comparison packet.
In the embodiment of the disclosure, after the packet sizes of the reference data packet and the comparison data packet are obtained, the packet sizes are compared to determine whether to accept the merging request of the target data packet. Specifically, when the packet size of the comparison data packet exceeds the packet size of the reference data packet within a preset range, receiving a merging request of the target data packet, and merging the target data packet into a target branch; specifically, if the packet size of the reference data packet is 900Kb and the allowable range of the packet size change exceeds 100Kb, when the packet size of the comparison data packet does not exceed 1000Kb, the packet size of the comparison data packet is considered to meet the requirement, and the merging request of the target data packet corresponding to the comparison data packet is received.
For the embodiment of the disclosure, for convenience of explanation, taking packaging by using a Jenkins platform as an example, as shown in fig. 2, the branches M1 are main branches, the branches M2-M4 are sub-branches of the main branch M1, specifically, the branch M1 is a development branch, an operation of "Develop Merge branch ' p/katao/p2' into ' development '" is performed at the node S3, a operation of Merge ' p/gaoyang. Kaka/optimal/fps ' into ' development ' and Merge ' p/yangzhiqiqian/ConanReflectionOpt into ' development ' are performed at the nodes S5 and S6, respectively, a key button display logic is performed at the node S4 on the branch M3, an operation of clicking display animation is performed by default, and a Fata is performed at the node S7 on the branch M4: upgrading the operations of the frame version. For convenience of explanation, taking the node S3 as an example, when a merge request of the merge node S3 is received, searching for the nearest common node on the main branch of the node S3, searching for the node closest to the node S3 as the node S2 on the branch M1, then obtaining the reference data packet of the node S2, and constructing a comparison data packet after merging the commit branch corresponding to the node S3 to the level branch (i.e., the target branch), determining whether to accept the merge request by comparing the size of the comparison data packet with the size of the reference data packet, specifically, when the difference between the size of the comparison data packet and the size of the reference data packet is not greater than the set threshold, receiving the merge request, and if the difference between the size of the comparison data packet and the size of the reference data packet is greater than the set threshold, not accepting the merge request.
According to the embodiment of the disclosure, the common node between the branch and the target branch is found out by extracting the data of the branch where the comparison data packet is located and the data of the target branch, the reference data packet is constructed based on the common node, the packet size data of the reference data packet and the packet size data of the comparison data packet are respectively obtained for comparison, the change condition of the packet size of the comparison data packet can be determined, the combination request of the comparison data packet can be accepted, the data packet is detected before the data packet is combined, the data packet with the packet size exceeding the preset range can be effectively prevented from being combined into a project, the optimization workload of service personnel is reduced, the comparison between the comparison data packet and the reference data packet can be effectively determined, the position data increment in the comparison data packet is too large, the fixed-point optimization of the service personnel is facilitated, and the working efficiency is improved.
In one possible implementation manner, determining a common node of a commit branch and a target branch corresponding to a merge request includes:
if no other branches merge into the target branch from the time of submitting the branch creation to the time of receiving the merge request, the nearest common node is a commit (commit) node at the time of submitting the branch creation on the target branch, and if other branches merge into the target branch, the nearest common node is a commit node at the time of merging other branches into the target branch.
In the embodiment of the disclosure, the packet size comparison needs to show the packet size increment actually generated by the code change of the current branch, so that the reference packet is the packet corresponding to the nearest public node on the target branch when the target merge request is made, the node where the merge operation instruction is located should be the nearest public node between the current branch and the target merge branch, two cases need to be considered for calculating the nearest public node, the development branch is pulled out from the main branch for development, and the pulled out node is the nearest public node of the current branch and the target merge branch; if the main branch is created later in the development process, this most recent common node becomes the node of the operation instruction on the main branch at the time of creation of the main branch.
For the embodiment of the disclosure, for convenience of explanation, taking the Jenkins platform for packing as an example, as shown in fig. 2, taking the operation of the node S3 as an example, when the target branch and the commit branch are not the same branch, the common node at this time is a node closest to the commit node on the target branch, that is, a node closest to the example node S3 on the branch M1, and the node S2. As still another embodiment of the present invention, as shown in fig. 3, the branch M2 is branched from the node S2 on the branch M1, and in the development process, after a piece of code is merged into the branch M2 by the node S6 on the branch M1, the branch M2 is merged into the branch M1, and the common node at this time is the node S6.
According to the embodiment of the disclosure, by searching the public node of the submitting branch and the target branch, determining the nearest public node aiming at the position of the public node under different conditions, when the reference data packet selected based on the public node is compared with the comparison data packet in the packet size, the packet size increment generated by the current branch code change can be embodied, and the optimization of the packet size by service personnel is facilitated.
In one possible implementation manner, determining a common node of a commit branch and a target branch corresponding to a merge request includes:
acquiring commit identifiers (i.e., commit ids) of the commit branch and the target branch; searching a common node of the submitted branch nearest to the target branch through a preset command statement according to the commit id.
In the embodiment of the present disclosure, for convenience of explanation, jenkins is taken as an example, when a submitting branch submits a merge request to a target branch, a building script on Jenkins will acquire commit ids of the current submitting branch and the target branch, and then find a common node closest to the current submitting branch and the target branch through a git command merge-base. Of course, the user may choose at his own discretion, particularly in which platform to use, which is not limited by the present disclosure.
The embodiment of the disclosure provides a possible implementation manner, which takes a public node as a reference data packet node to obtain a reference data packet, and includes:
inquiring a preset database according to the public node, and directly using the reference data packet when the reference data packet of the public node exists in the preset database;
when the reference data packet of the public node does not exist in the preset database, the reference data packet is built based on the public node.
In the embodiment of the disclosure, the packet size comparison needs to show the packet size increment actually generated by the code change of the current branch, so that the selection of the reference data packet is very important, in the actual implementation process, as the project can set the database, when the reference data packet is acquired, the preset database can be preferentially queried, when the reference data packet exists in the preset database, the reference data packet is directly selected without repeating the construction of the data packet, when the required reference data packet does not exist in the preset database, the required reference data packet is constructed based on the public node, specifically, when the comparison data packet is constructed, whether the cony data packet is stored with the packet information of the reference data packet or not is queried according to the reference data packet node obtained by the previous calculation, if the reference data packet node is not present, the reference data packet node is triggered to be packaged, and after the packet construction is successful, the packet information is uploaded to the database as the construction of the comparison data packet; if so, directly skipping the packaging flow of the reference data packet. Since constructing the reference packet takes a long time, this process is performed concurrently with the construction of the comparison packet. And creating a plurality of downstream concurrent packaging tasks through a MutillJob Phase plug-in of Jenkins, adding a packaging job of a comparison data packet and a reference data packet, setting the packaging job to be executed concurrently, and transmitting required parameters into the packaging job through a para. Txt file.
For the embodiment of the disclosure, for convenience of explanation, taking a cony (name of database) database as an example, as shown in fig. 4, when a Merge (MR) request is received, calculating a common node of a submitting branch nearest to a target branch, searching whether a reference data packet of the common node exists in the cony database based on the common node, and meanwhile, starting to package a comparison data packet by the submitting branch, if the reference data packet exists in the cony database, uploading the reference data packet, comparing with the comparison data packet, when the packet size of the comparison data packet exceeds the packet size of the reference data packet by a preset threshold, receiving the merge request, and when the packet size of the comparison data packet exceeds the packet size of the reference data packet by a preset threshold, rejecting the merge request; when no reference data packet exists in the cony database, the target branch starts to pack the reference data packet, uploads the reference data packet information, receives the merging request when the packet size of the comparison data packet exceeds the packet size of the reference data packet within a preset threshold, and refuses the merging request when the packet size of the comparison data packet exceeds the packet size of the reference data packet within the preset threshold.
According to the embodiment of the disclosure, whether the needed reference data packet exists in the database is queried in advance, when the needed reference data packet exists in the database, the data packet is directly selected, and when the needed reference data packet does not exist in the database, the needed reference data packet is constructed based on the public node determined in the previous step, so that the acquisition mode of the data packet is optimized, and the corresponding speed of a program is improved.
The embodiment of the present disclosure further provides a possible implementation manner, as shown in fig. 5, for obtaining a packet size of a reference data packet and a packet size of a contrast data packet, including:
in step S501, information about a packet is acquired, and the information includes a reference packet and a build address of a comparison packet.
In the embodiment of the present invention, the related information of the packet refers to related information of the comparison data packet and the reference data packet, and the jenkins platform is taken as an example, and as shown in table one, app_name, project_id, mr_id, commit_id, base_commit_id, package_size, package_url, mapping_url and jenkins_url of the packet may be included, which information is not limited in this disclosure, but any information for explaining the data packet should be within the scope of the disclosure.
For the embodiment of the disclosure, jenkins_url is a packet building address, i.e. URL of downstream packaging job, which can be used to identify each packet, determine the building source of each packet product, and at least need to obtain the building address of the packet when obtaining the related information of the packet.
Table one: data packet information table
Field name
|
Description of the invention
|
app_name
|
Display for distinguishing different app and application names
|
project_id
|
For different gitlab engineering
|
mr_id
|
For differentiating MR
|
commit_id
|
Data packet submitting node (current node)
|
base_commit_id
|
Reference data packet commit node
|
package_size
|
Packet size (Unit: bytes)
|
package_url
|
apk download links
|
mapping_url
|
mapping file download links
|
jenkins_url
|
Packet construction address (key field for distinguishing each packet) |
In step S502, packet size data of the target packet and the reference packet are acquired based on the build address of the target packet and the build address of the reference packet, respectively.
In the embodiment of the present disclosure, the packet size data refers to the size of the memory occupied by the data packet, the method of obtaining the packet size in the embodiment of the present disclosure is obtained by using a command statement, specifically, after judging that both the comparison data packet and the reference data packet are successfully constructed, a check_package_size.py script is called, and the package_size (i.e. the packet size) of the comparison data packet and the reference data packet is obtained according to the construction address (i.e. the jenkins_url field) of the comparison data packet and the reference data packet, specifically, how to call the technical means that a person skilled in the art should know when the script obtains the packet size information of the data packet is not repeated herein.
The embodiment of the disclosure uses the related information of the acquired packet, at least reports the construction address of the packet, and then invokes the script command to acquire the packet size information of the data packet through the construction address, so as to facilitate the comparison of the subsequent packet sizes.
The embodiment of the present disclosure further provides a possible implementation manner, which determines whether to accept the merging request based on the size of the reference data packet and the size of the comparison data packet, including:
comparing the packet sizes of the target data packet and the reference data packet by taking the packet size data of the reference data packet as a reference value; and when the number of the changes of the packet size of the target data packet exceeds the preset range of the packet size of the reference data packet, judging that the target packet is too large, and rejecting the merging request.
In the embodiment of the disclosure, when comparing the comparison data packet with the reference data packet, the packet size data of the reference data packet is taken as a reference value, the packet size data of the comparison data packet is compared with the reference value, and when the packet size of the comparison data packet exceeds the preset size of the reference value, the merging request of the target data packet is refused. Specifically, if the packet size of the reference data packet is 900Kb (Kilobyte), and the allowable packet size variation exceeds the range of 100Kb, when the packet size of the comparison data packet does not exceed 1000Kb, the packet size of the comparison data packet is considered to meet the requirement, and the merging request of the target data packet corresponding to the comparison data packet is received.
According to the embodiment of the disclosure, by comparing the sizes of the data packets, when the packet size of the comparison data packet exceeds the preset range of the reference data packet size, the merging request of the target data packet is refused, and the data packets with oversized modes are merged.
The embodiment of the disclosure also provides a possible implementation manner, if the merging request is refused, the method further comprises at least one of the following steps:
generating corresponding prompt information to provide the prompt information to a first relevant user corresponding to the merging request;
analyzing the comparison data packet and the reference data packet, obtaining the difference information of the reference data packet and the comparison data packet based on the analysis result, and providing the difference information for a second related user corresponding to the merging request.
In the embodiment of the disclosure, after determining that the packet size of the comparison data packet exceeds the preset range, the target data packet needs to be analyzed to find out the reason for the oversized packet size.
For the embodiment of the disclosure, the target data packet and the reference data packet are decompressed respectively to obtain dex, res, lib, assets and resources. After comparing the comparison packet with the reference packet, when the packet size of the comparison packet exceeds the packet size of the reference packet by more than a preset value, the merge request is rejected and the comparison result is displayed, as shown in fig. 6, the content in block 610 shows that the packet size is increased by 2.32MB, the data inclusion is not allowed, the address of the currently submitted branch is displayed in block 620, the target submitted branch address is displayed in block 630, the commit_id is displayed in block 640, the user operated area is displayed in block 650 and block 660, link to MR or one key pull group can be selected, the comparison result of the packet is displayed in block 670, and the Link of the detailed information of the comparison result is displayed in block 680.
In the embodiment of the disclosure, for convenience of explanation, taking a jnilibs_info_record plugin as an example, the plugin records a dependent import source of a so file in a package into a txt file in the Apk package process, if the plugin is used in a project and the product jnilibs_info_txt is uploaded to the package size attribution analysis Job, a change of the so file dependent import source can be shown in an analysis result, the import source can be more conveniently located for the problem of increase of the so size, and meanwhile, the script can send the address of the result page to a corresponding code author, attendant and alarm group through a large robot. The task is executed asynchronously, and does not affect the pipeline result notification cony, so that the block cannot block the whole upstream Job construction flow, and the overall time consumption of code submission cannot be affected.
In the embodiment of the disclosure, since the packet size increment with small change after each packet construction under the same MR is reminded on the lark, the notification amount of the alarm group is too large and the information is redundant, and the redundancy notification filtering can be set, if the difference value between the packet size change value obtained by the current packet construction and the packet size change of the last alarm notification under the same MR is within the size_diff_delta_threshold range, the information is considered to be redundant and filtered, the information is not repeatedly notified to the lark alarm group, the packet size change introduced by each MR can be counted in real time on a cony platform, and the corresponding packet size increment and the combination state can be screened and displayed according to the MR type, the target branch and the combination time, so that the increment range with the highest current duty ratio can be conveniently known, and a proper packet size threshold can be selected.
In addition, in order to improve the universality of the whole scheme and facilitate the access of other products, the upstream and downstream internal implementation can be integrated into a set of python script, a simple python calling API is provided for the outside, and a user side can integrate a packet size pre-checking function on own Jenkins packet construction task by only configuring required parameters on a CI and calling the API. Meanwhile, the light service platform is used for storing personalized configurations of different products, including setting of reminding notes and thresholds, so that the cost of updating the configurations on the user side is reduced. Meanwhile, the functions of jumping the MR page and one-key group pulling are realized on the message card interface, and after the notification of the packet size checking result is received, the related work of optimizing the group entering discussion code corresponding to the special duty number can be created by one key, so that an effective monitoring flow closed loop is established.
According to the embodiment of the disclosure, the common node between the branch and the target branch is found out by extracting the data of the branch where the comparison data packet is located and the target branch, the reference data packet is constructed based on the announcement node, the packet size data of the reference data packet and the packet size data of the comparison data packet are respectively obtained for comparison, the change condition of the packet size of the comparison data packet can be determined, the combination request of the comparison data packet can be accepted, the data packet is detected before the data packet is combined, the data packet with the packet size exceeding the preset range can be effectively prevented from being combined into a project, the optimization workload of service personnel is reduced, the comparison between the comparison data packet and the reference data packet can be effectively determined, the position data increment in the comparison data packet is too large, the fixed-point optimization of the service personnel is facilitated, and the working efficiency is improved.
An embodiment of the present disclosure provides a data packet processing apparatus, as shown in fig. 7, including:
a common node calculating module 701, configured to determine, when a branch merging request is received, a closest common node between a commit branch corresponding to the merging request and a target branch;
the data packet obtaining module 702 is configured to obtain a reference data packet by using the common node as a reference data packet node, and construct a comparison data packet based on the submitting branch;
a packet size obtaining module 703, configured to obtain a packet size of the reference data packet and a packet size of the comparison data packet;
a packet size comparison module 704, configured to determine whether to accept the merge request based on the packet size of the reference data packet and the packet size of the comparison data packet.
Optionally, the common node calculation module 701 provided in the embodiments of the present disclosure may be configured to, when determining a common node hand of a commit branch and a target branch corresponding to a merge request:
if the other branches are merged into the target branch, the nearest common node is the commit node at the time of creating the commit branch on the target branch, and if the other branches are merged into the target branch, the nearest common node is the commit node at the time of merging the other branches into the target branch.
Optionally, the common node calculation module 701 provided in the embodiments of the present disclosure may be configured to, when determining a common node hand of a commit branch and a target branch corresponding to a merge request:
acquiring commit identifiers commit ids of the commit branch and the target branch;
searching a common node of the submitted branch nearest to the target branch through a preset command statement according to the commit id.
Optionally, when the common node is used as a reference data packet node, the data packet obtaining module 702 provided in the embodiment of the present disclosure may be configured to:
inquiring a preset database according to the public node, and directly using the reference data packet when the reference data packet of the public node exists in the preset database;
when the reference data packet of the public node does not exist in the preset database, the reference data packet is built based on the public node.
Optionally, the packet size obtaining module 703 provided in the embodiment of the present disclosure may be configured to, when obtaining the packet size of the reference data packet and the packet size of the comparison data packet:
acquiring related information of a packet, wherein the related information comprises construction addresses of a reference data packet and a comparison data packet;
and acquiring packet size data of the target data packet and the reference data packet based on the construction address of the target data packet and the construction address of the reference data packet respectively.
Optionally, the packet size comparison module 704 provided in the embodiments of the present disclosure may be configured to, when determining whether to accept the merging request based on the size of the reference data packet and the size of the comparison data packet:
determining a packet size change value of the comparison data packet relative to the reference data packet based on the size of the reference data packet and the size of the comparison data packet;
if the packet size change value is not greater than the set threshold value, receiving a merging request;
and rejecting the merging request if the packet size change value is smaller than the set threshold value.
Optionally, the branch merging apparatus provided by the embodiments of the present disclosure may further be used to:
generating corresponding prompt information to provide the prompt information to a first relevant user corresponding to the merging request;
analyzing the comparison data packet and the reference data packet, obtaining the difference information of the reference data packet and the comparison data packet based on the analysis result, and providing the difference information for a second related user corresponding to the merging request.
The bullet screen display device of the present embodiment may execute the bullet screen display method shown in the above embodiment of the present disclosure, and its implementation principle is similar, and will not be described herein.
According to the embodiment of the disclosure, the common node between the branch and the target branch is found out by extracting the data of the branch where the comparison data packet is located and the target branch, the reference data packet is constructed based on the announcement node, the packet size data of the reference data packet and the packet size data of the comparison data packet are respectively obtained for comparison, the change condition of the packet size of the comparison data packet can be determined, the combination request of the comparison data packet can be accepted, the data packet is detected before the data packet is combined, the data packet with the packet size exceeding the preset range can be effectively prevented from being combined into a project, the optimization workload of service personnel is reduced, the comparison between the comparison data packet and the reference data packet can be effectively determined, the position data increment in the comparison data packet is too large, the fixed-point optimization of the service personnel is facilitated, and the working efficiency is improved.
Referring now to fig. 8, a schematic diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
An electronic device includes: a memory and a processor, where the processor may be referred to as a processing device 801, hereinafter, the memory may include at least one of a Read Only Memory (ROM) 802, a Random Access Memory (RAM) 803, and a storage device 808, as shown in detail below:
as shown in fig. 8, the electronic device 800 may include a processing means (e.g., a central processor, a graphics processor, etc.) 801, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage means 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
In general, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, etc.; storage 808 including, for example, magnetic tape, hard disk, etc.; communication means 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 shows an electronic device 800 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 809, or installed from storage device 808, or installed from ROM 802. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 801.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: when a branch merging request is received, determining the nearest public node between a submitted branch corresponding to the merging request and a target branch; taking the public node as a reference data packet node, acquiring a reference data packet, and constructing a comparison data packet based on a submitting branch; acquiring the packet size of a reference data packet and the packet size of a comparison data packet; based on the packet size of the reference packet and the packet size of the comparison packet, it is determined whether to accept the merge request.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, there is provided a method of branch merging, comprising:
when a branch merging request is received, determining the nearest public node between a submitted branch corresponding to the merging request and a target branch;
taking the public node as a reference data packet node, acquiring a reference data packet, and constructing a comparison data packet based on a submitting branch;
acquiring the packet size of a reference data packet and the packet size of a comparison data packet;
based on the packet size of the reference packet and the packet size of the comparison packet, it is determined whether to accept the merge request.
Further, determining a common node of the commit branch and the target branch corresponding to the merge request includes:
if the other branches are merged into the target branch, the nearest common node is the commit node at the time of creating the commit branch on the target branch, and if the other branches are merged into the target branch, the nearest common node is the commit node at the time of merging the other branches into the target branch.
Further, determining a common node of the commit branch and the target branch corresponding to the merge request includes:
Acquiring commit identifiers commit ids of the commit branch and the target branch;
searching a common node of the submitted branch nearest to the target branch through a preset command statement according to the commit id.
Further, taking the common node as a reference data packet node, obtaining the reference data packet includes:
inquiring a preset database according to the public node, and directly using the reference data packet when the reference data packet of the public node exists in the preset database;
when the reference data packet of the public node does not exist in the preset database, the reference data packet is built based on the public node.
Further, obtaining the packet size of the reference data packet and the packet size of the comparison data packet includes:
acquiring related information of a packet, wherein the related information comprises construction addresses of a reference data packet and a comparison data packet;
and acquiring packet size data of the target data packet and the reference data packet based on the construction address of the target data packet and the construction address of the reference data packet respectively.
Further, determining whether to accept the merge request based on the size of the reference packet and the size of the comparison packet includes:
determining a packet size change value of the comparison data packet relative to the reference data packet based on the size of the reference data packet and the size of the comparison data packet;
If the packet size change value is not greater than the set threshold value, receiving a merging request;
and rejecting the merging request if the packet size change value is smaller than the set threshold value.
Further, if the merge request is denied, the method further comprises at least one of:
generating corresponding prompt information to provide the prompt information to a first relevant user corresponding to the merging request;
analyzing the comparison data packet and the reference data packet, obtaining the difference information of the reference data packet and the comparison data packet based on the analysis result, and providing the difference information for a second related user corresponding to the merging request.
According to one or more embodiments provided by the present disclosure, there is provided a branch merging apparatus including:
the common node calculation module is used for determining the nearest common node between the submitted branch and the target branch corresponding to the merging request when the branch merging request is received;
the data packet acquisition module is used for taking the public node as a reference data packet node, acquiring a reference data packet and constructing a comparison data packet based on the submitting branch;
a packet size obtaining module, configured to obtain a packet size of the reference data packet and a packet size of the comparison data packet;
And the packet size comparison module is used for determining whether to accept the merging request or not based on the packet size of the reference data packet and the packet size of the comparison data packet.
Optionally, when determining to merge the common node hand of the commit branch and the target branch corresponding to the request, the common node calculation module provided in the embodiment of the present disclosure may be used to:
if the other branches are merged into the target branch, the nearest common node is the commit node at the time of creating the commit branch on the target branch, and if the other branches are merged into the target branch, the nearest common node is the commit node at the time of merging the other branches into the target branch.
Optionally, when determining to merge the common node hand of the commit branch and the target branch corresponding to the request, the common node calculation module provided in the embodiment of the present disclosure may be used to:
acquiring commit identifiers commit ids of the commit branch and the target branch;
searching a common node of the submitted branch nearest to the target branch through a preset command statement according to the commit id.
Optionally, when the common node is used as a reference data packet node, the data packet obtaining module provided in the embodiment of the present disclosure may be used to obtain a reference data packet:
Inquiring a preset database according to the public node, and directly using the reference data packet when the reference data packet of the public node exists in the preset database;
when the reference data packet of the public node does not exist in the preset database, the reference data packet is built based on the public node.
Optionally, the packet size obtaining module provided in the embodiment of the present disclosure may be configured to, when obtaining a packet size of a reference data packet and a packet size of a comparison data packet:
acquiring related information of a packet, wherein the related information comprises construction addresses of a reference data packet and a comparison data packet;
and acquiring packet size data of the target data packet and the reference data packet based on the construction address of the target data packet and the construction address of the reference data packet respectively.
Optionally, the packet size comparison module provided in the embodiment of the present disclosure may be configured to, when determining whether to accept the merge request based on the size of the reference data packet and the size of the comparison data packet:
determining a packet size change value of the comparison data packet relative to the reference data packet based on the size of the reference data packet and the size of the comparison data packet;
if the packet size change value is not greater than the set threshold value, receiving a merging request;
and rejecting the merging request if the packet size change value is smaller than the set threshold value.
Optionally, the branch merging apparatus provided by the embodiments of the present disclosure may further be used to:
generating corresponding prompt information to provide the prompt information to a first relevant user corresponding to the merging request;
analyzing the comparison data packet and the reference data packet, obtaining the difference information of the reference data packet and the comparison data packet based on the analysis result, and providing the difference information for a second related user corresponding to the merging request.
According to one or more embodiments provided by the present disclosure, there is provided an electronic device including:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to: the above-described method of branch merging is performed.
According to one or more embodiments provided by the present disclosure, there is provided a computer storage medium storing at least one instruction, at least one program, code set, or instruction set, the at least one instruction, at least one program, code set, or instruction set being loaded and executed by a processor to implement the above-described method of branch merging.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.