CN117407038B - Code branch merging state identification method and system based on Gitlab - Google Patents

Code branch merging state identification method and system based on Gitlab Download PDF

Info

Publication number
CN117407038B
CN117407038B CN202311707325.9A CN202311707325A CN117407038B CN 117407038 B CN117407038 B CN 117407038B CN 202311707325 A CN202311707325 A CN 202311707325A CN 117407038 B CN117407038 B CN 117407038B
Authority
CN
China
Prior art keywords
code
branch
submitting
record
source
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311707325.9A
Other languages
Chinese (zh)
Other versions
CN117407038A (en
Inventor
林子超
蓝哲
江振华
王远春
江智明
李程扬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
XIAMEN ZHIYE SOFTWARE ENGINEERING CO LTD
Original Assignee
XIAMEN ZHIYE SOFTWARE ENGINEERING CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by XIAMEN ZHIYE SOFTWARE ENGINEERING CO LTD filed Critical XIAMEN ZHIYE SOFTWARE ENGINEERING CO LTD
Priority to CN202311707325.9A priority Critical patent/CN117407038B/en
Publication of CN117407038A publication Critical patent/CN117407038A/en
Application granted granted Critical
Publication of CN117407038B publication Critical patent/CN117407038B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a code branch merging state identification method and system based on Gitleab, which realize automatic analysis and identification of merging states of codes submitted to a Gitleab server by developers in other branches, and simultaneously display merging and uncombining states of the submitted codes in other branches at a user side, so that the problem that code merging cannot be managed when the number of code branches is large is solved, and further, the condition of missing merging of codes is prevented; and the corresponding manager can directly merge the codes into branches in an unmixed state according to the merging condition of the codes, so that the code merging flow is simplified.

Description

Code branch merging state identification method and system based on Gitlab
Technical Field
The invention relates to the technical field of computer technology, in particular to a code branch merging state identification method and system based on Gitlab.
Background
In a hospital information system, each service module code is managed by a Gitlab, and in order to meet the simultaneous parallel release requirements of a plurality of projects, each service module code generally needs to establish a plurality of code branches, including a development branch and release branches corresponding to each project, each release branch corresponds to one project, a developer writes the code according to the requirements and submits the code to the development branch, then creates a merging request on the Gitlab, and some projects need to create a plurality of merging requests, and then the merging requests are merged to related release branches by a research and development manager or a project manager. The existing method has extremely low working efficiency, and when branches are more, code merging cannot be managed, which branch codes are merged, which branch codes are not merged, are often difficult to distinguish, and code missing merging easily occurs.
Disclosure of Invention
In order to solve the technical problems that branch multi-time code merging cannot be managed and branch codes are merged and branch codes are not merged in the prior art, the invention provides a code branch merging state identification method and system based on Gitlab, and aims to solve the technical problems.
According to one aspect of the present invention, a method for identifying merging states of code branches based on a Gitleb is provided, including:
s1, receiving codes submitted to source branches by a user side in real time, acquiring source branch code submitting records corresponding to the codes, analyzing the source branch code submitting records corresponding to the codes based on a system hook callback code submitting record analysis interface, and storing the analyzed source branch code submitting records; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID;
s2, acquiring target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing the target branch code submitting records corresponding to the codes based on a system hook callback code submitting record analysis interface, and storing the analyzed target branch code submitting records; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch;
s3, responding to a code branch merging state of a source branch, acquiring all target branches corresponding to codes based on code module IDs, acquiring source branch code submitting records corresponding to the codes, matching the current code submitting ID of the source branch code submitting records with PICK source IDs included in all stored target branch code submitting records, marking branches including the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting records, marking branches including no branch names in all target branches as uncombined states, and pushing and displaying the marked branches at the user side.
In some particular embodiments, the source branch code commit record and the target branch code commit record include JSON format data.
In some specific embodiments, the parsing interface for the code commit record based on the system hook callback code in step S2 parses the target branch code commit record corresponding to the code, and specifically includes:
analyzing JSON format data included in the obtained target branch code submitting records and storing analysis results in response to the number of the target branch code submitting records obtained by the code submitting record analyzing interface being smaller than the preset number;
and responding to the number of target branch code submitting records acquired by a code submitting record analysis interface being more than a preset number, acquiring a code module ID and a branch name included in a code submitting record corresponding to a source branch code, acquiring a last code submitting record based on the code module ID and the branch name, acquiring the submitting time and the current time of the last code submitting record, acquiring a code submitting record list of corresponding branches in a Gitlab server from the submitting time of the last code submitting record to the current time based on the code module ID, the branch name, the submitting time of the last code submitting record, the current time, a preset initial page number and a preset return page number, acquiring a plurality of code submitting records not exceeding the return page number, analyzing JSON format data included in the acquired plurality of code submitting records, and storing analysis results. Because the system hook callback code commit record parsing interface only passes a number of code commit record logs at most at a time, data acquisition and parsing would need to be performed in another way for cases exceeding a preset stripe.
In some particular embodiments, step S3 includes merging code of the source branch to a target branch marked as an unmerged state. After the passage codes are generated on the developer, the corresponding manager can directly merge the codes into the corresponding uncombined state branches according to the merging condition of the codes, a plurality of merging requests are not required to be created by the developer, and the code merging flow is simplified.
In some specific embodiments, step S3 includes traversing the code commit record list in response to a code branch merge state of a source branch being withdrawn by a user side, determining whether commit messages included in each code commit record in the code commit record list include a preset string, if so, intercepting a sha value included after the preset string, and obtaining a code commit record with a PICK source commit ID value being the sha value according to a code module ID of a corresponding code commit record, a branch name and the sha value, and deleting the obtained code commit record from a plurality of stored target branch code commit records.
According to a second aspect of the present invention, there is provided a system for identifying merging states of code branches based on a gillab, the system comprising:
the analysis module is configured to receive codes submitted to source branches by a user side in real time, acquire source branch code submitting records corresponding to the codes, analyze the source branch code submitting records corresponding to the codes based on a system hook callback code submitting record analysis interface, and store the analyzed source branch code submitting records; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID; the method comprises the steps of obtaining target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing the target branch code submitting records corresponding to the codes based on a system hook callback code submitting record analyzing interface, and storing the analyzed target branch code submitting records; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch;
the storage module is configured to store the parsed source branch code submitting record and the parsed target branch code submitting record;
the marking module is configured to respond to the code branch merging state of the source branch, obtain all target branches corresponding to the code based on the code module ID, obtain a source branch code submitting record corresponding to the code, match the current code submitting ID of the source branch code submitting record with PICK source IDs included in all stored target branch code submitting records, mark branches including the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting record, mark branches including no branch names in all target branches as uncombined states, and push and display the marked branches at the user side.
In some specific embodiments, the storage module includes a database and storage middleware. The storage module may be a Mysql database or the like.
In some specific embodiments, the system further includes a front-end module, where the front-end module is disposed at a user end and includes a merge button and a cancel merge button, where the merge button is configured to merge codes of the source branches into target branches marked as non-merge states, and the cancel merge button is configured to traverse the code commit record list in response to the code branch merge states of the source branches being cancelled by the user end, determine whether commit messages included in each code commit record in the code commit record list include a preset string, intercept a sha value included in the preset string if the commit message includes the preset string, acquire a code commit record with a PICK source commit ID value being the sha value according to a code module ID, a branch name, and the sha value of the corresponding code commit record, and delete the acquired code commit record from the storage module.
According to a third aspect of the present invention, there is provided a computer readable storage medium having stored thereon one or more computer programs which when executed by a computer processor implement the method of any of the above.
The invention provides a code branch merging state identification method and system based on Gitleab, which realize automatic analysis and identification of merging states of codes submitted to a Gitleab server by developers in other branches, and simultaneously display merging and uncombining states of the submitted codes in other branches at a user side, so that the problem that code merging cannot be managed when the number of code branches is large is solved, and further, the condition of missing merging of codes is prevented; and the corresponding manager can directly merge the codes into branches in an unmixed state according to the merging condition of the codes, so that the code merging flow is simplified.
Drawings
The accompanying drawings are included to provide a further understanding of the embodiments and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments and together with the description serve to explain the principles of the invention. Many of the intended advantages of other embodiments and embodiments will be readily appreciated as they become better understood by reference to the following detailed description. Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments, made with reference to the following drawings, in which:
FIG. 1 is a flow chart of a method of Gitlab based code branch merging identification according to one embodiment of the present application;
FIG. 2 is a block diagram of a Gitlab based code branch merging identification method system of one embodiment of the present application;
3 a-3 c are diagrams of a conventional method of looking at branch merge state of a code commit record in one particular embodiment of the present application;
FIG. 4 is a schematic diagram of automatically displaying which branches have been merged and which branches have not been merged for a code submission record when a user selects the code submission record in one embodiment of the present application;
FIG. 5 is a schematic diagram showing that a merge may be directly revoked when a code commit record is selected in an embodiment of the present application;
fig. 6 is a schematic diagram of a computer system suitable for use in implementing embodiments of the present application.
Detailed Description
The present application is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that, in the case of no conflict, the embodiments and features in the embodiments may be combined with each other. The present application will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 shows a flowchart of a method for identifying a code branch merge based on a Gitlab according to an embodiment of the present application. As shown in fig. 1, the method includes:
s1, receiving codes submitted to source branches by a user side in real time, acquiring source branch code submitting records corresponding to the codes, analyzing the source branch code submitting records corresponding to the codes based on a system hook callback code submitting record analysis interface, and storing the analyzed source branch code submitting records; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID;
s2, acquiring target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing the target branch code submitting records corresponding to the codes based on a system hook callback code submitting record analysis interface, and storing the analyzed target branch code submitting records; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch;
wherein the source branch may be a development branch and the target branch may be an issue branch.
The code module ID may be a Gitlab ID, where the code commit ID and the PICK source commit ID are both strings containing 40 characters on the Gitlab server, and are a globally unique value (e.g. 4720685927cecbbadd10f2bec56570e87cc9b 292) automatically generated each time the code is committed on the Gitlab server.
It should be noted that, when a developer submits a code to a source branch (development branch) for the first time, the value of the PICK source commit ID of the source branch code commit record of the corresponding code is a null value, after the code is merged to a target branch (release branch), the PICK source commit ID of the code commit record is replaced with the current code commit ID of the source branch code commit record, and the current code commit ID of the source branch code commit record is updated to a new value, thereby obtaining the target branch code commit record. Because the target branch code submitting record can generate the PICK source submitting ID value during each merging, the method and the device acquire and analyze the source branch code submitting record and the target branch code submitting record in real time, and realize that a manager can acquire the corresponding merging record according to the current code submitting ID value of the code submitted to the source branch (development branch) by the developer when checking the merging record of the codes.
In some particular embodiments, the source branch code commit record and the target branch code commit record include JSON format data.
In some specific embodiments, the parsing interface for the code commit record based on the system hook callback code in step S2 parses the target branch code commit record corresponding to the code, and specifically includes:
analyzing JSON format data included in the obtained target branch code submitting records and storing analysis results in response to the number of the target branch code submitting records obtained by the code submitting record analyzing interface being smaller than the preset number;
and responding to the number of target branch code commit records acquired by a code commit record analysis interface being more than a preset number, acquiring a code module ID and a branch name included in a code commit record corresponding to a source branch code, acquiring a last code commit record based on the code module ID and the branch name, acquiring commit time and current time of the last code commit record, analyzing the acquired JSON format data included in the code commit record based on the code module ID, the branch name, the commit time of the last code commit record, the current time, a preset initial page number (default is 0) and a preset number of return lines per page (the number of return lines per page can be adjusted according to actual conditions), acquiring a code commit record list from the commit time of the last code commit record to the current time of a corresponding branch in a Gitlab server, acquiring a plurality of code commit records not exceeding the number of return lines per page, and storing analysis results.
The number of the preset strips can be 20, the preset strips are preset by the Gitlab server, if more than 20 strips are discarded by the Gitlab server, if the submitted record is less than 20 strips, the analysis interface can receive the specific actual number of the data strips, for example, 10 strips are actually received, the analysis interface can receive 10 strips, 1 strip is actually received, the analysis interface can receive 1 strip, if 21 strips are actually received, the analysis interface can receive 20 strips at most, and 1 strip is discarded. The code commit record analysis interface is used to obtain a commit record of less than 20, and if the code commit record is greater than or equal to 20, the commit record is discarded by the Gitlab server, so that for this special case, data acquisition and analysis are needed in another way for the case that exceeds the preset bar.
In some particular embodiments, the source branch code commit record and the target branch code commit record also include code module description, presenter account number, commit message, requirement ID, code commit date, and the like; wherein the code module describes a Chinese module name for recording the code module; the presenter account is presenter information; the commit message is a log of code commitments; the requirement ID is the ID of which service requirement is submitted to correspond to; the code submission date is the date the code was submitted.
S3, responding to a code branch merging state of a source branch, acquiring all target branches corresponding to codes based on code module IDs, acquiring source branch code submitting records corresponding to the codes, matching the current code submitting ID of the source branch code submitting records with PICK source IDs included in all stored target branch code submitting records, marking branches including the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting records, marking branches including no branch names in all target branches as uncombined states, and pushing and displaying the marked branches at the user side.
In some particular embodiments, step S3 includes merging code of the source branch to a target branch marked as an unmerged state. After the passage codes are generated on the developer, the corresponding manager can directly merge the codes into the corresponding uncombined state branches according to the merging condition of the codes, a plurality of merging requests are not required to be created by the developer, and the code merging flow is simplified.
In some specific embodiments, step S3 includes traversing the code commit record list in response to a code branch merge state of a source branch being withdrawn by a user side, determining whether commit messages included in each code commit record in the code commit record list include a preset string, if so, intercepting a sha value included after the preset string, and obtaining a code commit record with a PICK source commit ID value being the sha value according to a code module ID of a corresponding code commit record, a branch name and the sha value, and deleting the obtained code commit record from a plurality of stored target branch code commit records.
The sha value is a string of 40 characters and is globally unique on the ginal server, so that the PICK source commit ID value and the sha value can be the same, because in different branch combination codes, the PICK source commit ID is the sha value, such as the commit record 1 of branch release-1.1, the record 1 contains a commit ID, when the commit record 1 is merged from the branch release-1.1 to the release-1.2, the code of the commit record 1 is merged into the release-1.2, and in the branch release-1.2, a commit record identical to the commit record 1 is generated, and for convenience of distinction, the ginal server automatically submits the commit ID of the record 1, i.e. the sha value, on the end band of the commit record 1-1, so that the k source commit ID of the release-1.2 branch is the ID of the commit record 1 of the release-1.1 branch, and the sha value is the picrelease source ID of the commit record 1.
The preset string may be a "This reverts commit" string. The character string is a characteristic value preset by the Gitlab server.
FIG. 2 is a block diagram of a Gitlab-based code branch merging recognition system according to one embodiment of the present application, where the system includes a parsing module 201 configured to receive, in real time, codes submitted to source branches by a user side, obtain source branch code commit records corresponding to the codes, parse the source branch code commit records corresponding to the codes based on a system hook callback code commit record parsing interface, and store the parsed source branch code commit records, as shown in FIG. 2; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID; the method comprises the steps of obtaining target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing the target branch code submitting records corresponding to the codes based on a system hook callback code submitting record analyzing interface, and storing the analyzed target branch code submitting records; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch; a storage module 202 configured to store parsed source branch code commit records and target branch code commit records; the marking module 203 is configured to respond to the code branch merging state of the source branch, obtain all target branches corresponding to the code based on the code module ID, obtain a source branch code submitting record corresponding to the code, match the current code submitting ID of the source branch code submitting record with the PICK source IDs included in all stored target branch code submitting records, mark the branches including the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting record, mark the branches including no branch names in all target branches as uncombined states, and push and display the marked branches at the user side.
Wherein the storage module 202 includes a database and storage middleware. Databases and storage middleware include, but are not limited to, mysql databases.
As shown in fig. 2, the system further includes a front-end module 204, where the front-end module 204 is disposed at the user side and includes a merge button and a cancel merge button, where the merge button is configured to merge codes of the source branches into target branches marked as non-merge states, and the cancel merge button is configured to traverse the code commit record list in response to the code branch merge states of the source branches being cancelled by the user side, determine whether commit messages included in each code commit record in the code commit record list include a preset string, if the commit messages include the preset string, intercept a sha value included in the preset string, acquire a code commit record with a sha value as the sha value according to a code module ID, a branch name, and the sha value of the corresponding code commit record, and delete the acquired code commit record from the storage module.
To highlight the technical effects of the present application, with reference to fig. 3a-c, fig. 3a-c are schematic diagrams of a conventional method for checking the branch merging status of code commit records, as shown in the figure, and if the conventional method is to check that code is not merged into a target branch (release-1.16) after first committing the code to a source branch (master branch), the conventional method is to switch to the target branch (release-1.16 branch), as shown in fig. 3b; if there are tens of branches, it is not possible to make a close preview of all branches combined and not combined at a time. The effect achieved by the method of the present application is shown in fig. 4, and when a user selects a code submission record, the code submission record is automatically displayed in which branches are combined and which branches are not combined; FIG. 5 is a diagram of revocation merging supported by the method of the present application to resolve the possibility of rollback codes when sometimes code is merging into the wrong branch. The data presentation accuracy of fig. 4 is not affected when code rollback is performed.
Referring now to FIG. 6, a schematic diagram of a computer system 600 suitable for use in implementing an electronic device of an embodiment of the present application is shown. The electronic device shown in fig. 6 is only an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, mouse, etc.; an output portion 607 including a Liquid Crystal Display (LCD) or the like, a speaker or the like; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The drive 610 is also connected to the I/O interface 605 as needed. Removable media 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on drive 610 so that a computer program read therefrom is installed as needed into storage section 608.
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 computer readable storage medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 609, and/or installed from the removable medium 611. The above-described functions defined in the method of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 601. It should be noted that the computer readable storage medium of the present application 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 document, 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 application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with 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 storage 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 storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present application may be written in one or more programming languages, including 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 application. 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 involved in the embodiments described in the present application may be implemented by software, or may be implemented by hardware.
As another aspect, the present application also provides a computer-readable storage medium that may be included in the electronic device described in the above embodiments; or may exist alone without being incorporated into the electronic device. The computer-readable storage medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receiving codes submitted to source branches by a user side in real time, acquiring source branch code submitting records corresponding to the codes, analyzing the source branch code submitting records corresponding to the codes based on a system hook callback code submitting record analyzing interface, and storing the analyzed source branch code submitting records; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID; acquiring target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing the target branch code submitting records corresponding to the codes based on a system hook callback code submitting record analyzing interface, and storing the analyzed target branch code submitting records; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch; responding to a code branch merging state of a source branch, acquiring all target branches corresponding to codes based on a code module ID, acquiring a source branch code submitting record corresponding to the codes, matching the code submitting ID of the source branch code submitting record with PICK source IDs included in all stored target branch code submitting records, marking branches containing the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting record, marking branches not containing the branch names in all target branches as uncombined states, and pushing and displaying the marked branches at a user side.
The foregoing description is only of the preferred embodiments of the present application and is presented as a description of the principles of the technology being utilized. It will be appreciated by persons skilled in the art that the scope of the invention referred to in this application is not limited to the specific combinations of features described above, but it is intended to cover other embodiments in which any combination of features described above or equivalents thereof is possible without departing from the spirit of the invention. Such as the above-described features and technical features having similar functions (but not limited to) disclosed in the present application are replaced with each other.

Claims (7)

1. The code branch merging state identification method based on the Gitlab is characterized by comprising the following steps of:
s1, receiving codes submitted to source branches by a user side in real time, acquiring source branch code submitting records corresponding to the codes, analyzing the source branch code submitting records corresponding to the codes based on a system hook callback code submitting record analysis interface, and storing the analyzed source branch code submitting records; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID;
s2, acquiring target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing JSON format data included in the acquired target branch code submitting records in response to the number of the target branch code submitting records acquired by a code submitting record analysis interface being smaller than a preset number, and storing analysis results; responding to the number of target branch code submitting records acquired by a code submitting record analysis interface being more than a preset number, acquiring a code module ID and a branch name included in a code submitting record corresponding to a source branch code, acquiring a last code submitting record based on the code module ID and the branch name, acquiring the submitting time and the current time of the last code submitting record, acquiring a code submitting record list of a corresponding branch in a Gitlab server from the submitting time of the last code submitting record to the current time based on the code module ID, the branch name, the submitting time of the last code submitting record, the current time, a preset initial page number and a preset return page number, acquiring a plurality of code submitting records not exceeding the return page number, analyzing JSON format data included in the acquired code submitting records, and storing analysis results; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch;
s3, responding to a code branch merging state of a source branch, acquiring all target branches corresponding to codes based on code module IDs, acquiring source branch code submitting records corresponding to the codes, matching the current code submitting ID of the source branch code submitting records with PICK source IDs included in all stored target branch code submitting records, marking branches including the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting records, marking branches not including the branch names in all target branches as uncombined states, and pushing and displaying the marked branches at the user side; and traversing the code submitting record list in response to the code branch merging state of the source branch of the user side withdrawal, judging whether a submitting message included in each code submitting record in the code submitting record list contains a preset character string, intercepting a sha value contained after the preset character string if the submitting message contains the preset character string, acquiring a code submitting record with the PICK source submitting ID value being the sha value according to the code module ID, the branch name and the sha value of the corresponding code submitting record, and deleting the acquired code submitting record from a plurality of stored item target branch code submitting records.
2. The method of claim 1, wherein the source branch code commit record and the target branch code commit record include JSON formatted data.
3. A method of identifying merging states of code branches based on Gitlab as claimed in claim 1, wherein step S3 comprises merging the code of the source branch to a target branch marked as an unmerged state.
4. A Gitlab-based code branch merge state identification system, the system comprising:
the analysis module is configured to receive codes submitted to a source branch by a user side in real time, acquire source branch code submitting records corresponding to the codes, analyze JSON format data included in the acquired target branch code submitting records in response to the number of the target branch code submitting records acquired by the code submitting record analysis interface being smaller than a preset number, and store analysis results; responding to the number of target branch code submitting records acquired by a code submitting record analysis interface being more than a preset number, acquiring a code module ID and a branch name included in a code submitting record corresponding to a source branch code, acquiring a last code submitting record based on the code module ID and the branch name, acquiring the submitting time and the current time of the last code submitting record, acquiring a code submitting record list of a corresponding branch in a Gitlab server from the submitting time of the last code submitting record to the current time based on the code module ID, the branch name, the submitting time of the last code submitting record, the current time, a preset initial page number and a preset return page number, acquiring a plurality of code submitting records not exceeding the return page number, analyzing JSON format data included in the acquired code submitting records, and storing analysis results; the parsed code submitting record comprises a code module ID, a branch name, a code submitting ID of the time and a PICK source submitting ID; the method comprises the steps of obtaining target branch code submitting records corresponding to codes merged from a source branch to a plurality of target branches, analyzing the target branch code submitting records corresponding to the codes based on a system hook callback code submitting record analyzing interface, and storing the analyzed target branch code submitting records; the PICK source commit ID of the target branch code commit record is replaced with the current code commit ID of the source branch code commit record in response to successful merging of the source branch code into the target branch;
the storage module is configured to store the parsed source branch code submitting record and the parsed target branch code submitting record;
the marking module is configured to respond to a code branch merging state of a source branch, acquire all target branches corresponding to codes based on a code module ID, acquire a source branch code submitting record corresponding to the codes, match the current code submitting ID of the source branch code submitting record with PICK source IDs included in all stored target branch code submitting records, mark branches including the branch names in all target branches as merged states according to the branch names included in the matched target branch code submitting record, mark branches including no branch names in all target branches as uncombined states, and push and display the marked branches at the user side; and traversing the code submitting record list in response to the code branch merging state of the source branch of the user side withdrawal, judging whether a submitting message included in each code submitting record in the code submitting record list contains a preset character string, intercepting a sha value contained after the preset character string if the submitting message contains the preset character string, acquiring a code submitting record with the PICK source submitting ID value being the sha value according to the code module ID, the branch name and the sha value of the corresponding code submitting record, and deleting the acquired code submitting record from a plurality of stored item target branch code submitting records.
5. The system of claim 4, wherein the memory module comprises a database and a storage middleware.
6. The system of claim 5, further comprising a front-end module disposed on a user side, including a merge button configured to merge code of the source branch into a target branch marked as an unmixed state.
7. A computer readable storage medium having stored thereon one or more computer programs, which when executed by a computer processor implement the method of any of claims 1 to 3.
CN202311707325.9A 2023-12-13 2023-12-13 Code branch merging state identification method and system based on Gitlab Active CN117407038B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311707325.9A CN117407038B (en) 2023-12-13 2023-12-13 Code branch merging state identification method and system based on Gitlab

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311707325.9A CN117407038B (en) 2023-12-13 2023-12-13 Code branch merging state identification method and system based on Gitlab

Publications (2)

Publication Number Publication Date
CN117407038A CN117407038A (en) 2024-01-16
CN117407038B true CN117407038B (en) 2024-03-26

Family

ID=89496537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311707325.9A Active CN117407038B (en) 2023-12-13 2023-12-13 Code branch merging state identification method and system based on Gitlab

Country Status (1)

Country Link
CN (1) CN117407038B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11232097B1 (en) * 2020-06-08 2022-01-25 Sprint Communications Company L.P. Ordering commits of code in multi-branch parallel development projects
CN115544127A (en) * 2021-06-30 2022-12-30 青岛海尔科技有限公司 Code amount processing method and system, electronic device and readable storage medium
CN116302064A (en) * 2023-03-15 2023-06-23 阿里云计算有限公司 Integrated code analysis method, integrated code analysis device, electronic equipment and storage medium
CN116909615A (en) * 2023-07-21 2023-10-20 上海浦东发展银行股份有限公司 Code automation management system and method for research and development flow

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2716770C (en) * 2010-10-06 2012-03-13 Ibm Canada Limited - Ibm Canada Limitee Application services source refactoring

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11232097B1 (en) * 2020-06-08 2022-01-25 Sprint Communications Company L.P. Ordering commits of code in multi-branch parallel development projects
CN115544127A (en) * 2021-06-30 2022-12-30 青岛海尔科技有限公司 Code amount processing method and system, electronic device and readable storage medium
CN116302064A (en) * 2023-03-15 2023-06-23 阿里云计算有限公司 Integrated code analysis method, integrated code analysis device, electronic equipment and storage medium
CN116909615A (en) * 2023-07-21 2023-10-20 上海浦东发展银行股份有限公司 Code automation management system and method for research and development flow

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Hog (HDL on git): a collaborative management tool to handle git-based HDL repository;Biesuz N.V;《Journal of Instrumentation》;20210401(第04期);全文 *
Klockwork检查工具部署的方案设计与实现;李学强;;数码世界;20200701(07);全文 *

Also Published As

Publication number Publication date
CN117407038A (en) 2024-01-16

Similar Documents

Publication Publication Date Title
CN110457277B (en) Service processing performance analysis method, device, equipment and storage medium
CN107506451B (en) Abnormal information monitoring method and device for data interaction
CN110647579A (en) Data synchronization method and device, computer equipment and readable medium
US20180060415A1 (en) Language tag management on international data storage
CN113158101B (en) Visual page rendering method, device, equipment and storage medium
CN111796809A (en) Interface document generation method and device, electronic equipment and medium
CN111158795A (en) Report generation method, device, medium and electronic equipment
CN113326247A (en) Cloud data migration method and device and electronic equipment
CN116383193A (en) Data management method and device, electronic equipment and storage medium
CN115422066A (en) Test case management method and device
CN110716804A (en) Method and device for automatically deleting useless resources, storage medium and electronic equipment
WO2022150110A1 (en) Document content extraction and regression testing
CN113962597A (en) Data analysis method and device, electronic equipment and storage medium
CN117407038B (en) Code branch merging state identification method and system based on Gitlab
CN113094776A (en) Method and system for constructing visual component model data and electronic equipment
CN115454956A (en) Log generation method and device, electronic equipment and storage medium
CN110413165B (en) Icon configuration method and device, electronic equipment and computer readable medium
CN111209075B (en) Multilingual interface maintenance method, system, storage medium and intelligent device
CN113138974A (en) Database compliance detection method and device
CN114189750A (en) Playing method of multi-format file and related device
CN113553826A (en) Information input method and device combining RPA and AI and electronic equipment
CN113032515A (en) Method, system, device and storage medium for generating chart based on multiple data sources
CN111914531A (en) Hyperlink state determination method and device, electronic equipment and readable storage medium
CN111914522A (en) Invalid hyperlink repairing method and device, electronic equipment and readable storage medium
CN107707328B (en) Abstract information transmission method and device

Legal Events

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