Method and apparatus for determining code commit identification information

CN115185572BActive Publication Date: 2026-10-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210435684.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2026-10-09
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

[0004]本申请的主要目的在于提供一种代码提交标识信息的确定方法及装置,以解决相关技术中由于通过git extensions一次只能查看一条代码提交标识信息造成的无法对代码提交标识信息进行统计的问题

Benefits of technology

[0015]通过本申请,采用以下步骤:获取目标源码,并确定目标源码包括的分支;确定在目标时间段内分支中任意一个分支对应的代码提交标识列表,其中,代码提交标识列表包括多个代码提交标识,代码提交标识为对分支进行修改的用户的标识;从代码提交标识列表中筛选出目标分支对应的目标代码提交标识列表;依据目标代码提交标识列表,确定目标分支对应的代码提交标识信息,其中,代码提交标识信息包括对目标分支进行修改的信息以及对目标分支进行修改的用户的信息,解决了相关技术中由于通过git extensions一次只能查看一条代码提交标识信息造成的无法对代码提交标识信息进行统计的问题。进而达到了从整体上查看分支提交情况、实现多维度统计、提高代码管理效率的效果。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115185572B_ABST
    Figure CN115185572B_ABST
Patent Text Reader

Abstract

The application discloses a code submission identification information determination method and device. It is related to the field of Internet development. The method comprises the following steps: obtaining target source code, and determining branches included in the target source code; determining a code submission identification list corresponding to any one of the branches in a target time period, wherein the code submission identification list comprises a plurality of code submission identifications, and the code submission identification is the identification of a user who modifies the branch; screening a target code submission identification list corresponding to a target branch from the code submission identification list; and determining code submission identification information corresponding to the target branch according to the target code submission identification list, wherein the code submission identification information comprises information about modifying the target branch and information about the user who modifies the target branch. Through the application, the problem that code submission identification information cannot be counted due to the fact that only one code submission identification information can be viewed at a time through git extensions in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet development, and more specifically, to a method and apparatus for determining code submission identification information. Background Technology

[0002] Currently, during project application development, developers submit code via Git and typically view the commit information for each commit ID using `git extensions`. However, in source code management, for source code with multiple branches, the official `git extensions` tool often only provides commit information for a single commit ID. There is currently no tool that can provide overall commit information for all commit IDs under a specific branch. While `git extensions` displays commit information for each commit ID, including the committer, filename, and commit time, it only allows viewing one record at a time, making it inefficient due to its graphical interface nature. There is a lack of a comprehensive statistical tool that provides a complete overview of commit information across repository branches.

[0003] There is currently no effective solution to the problem of being unable to perform statistical analysis of code commit identifiers because git extensions can only view one code commit identifier at a time. Summary of the Invention

[0004] The main objective of this application is to provide a method and apparatus for determining code commit identifier information, so as to solve the problem in related technologies that the code commit identifier information cannot be statistically analyzed because only one code commit identifier information can be viewed at a time through git extensions.

[0005] To achieve the above objectives, according to one aspect of this application, a method for determining code commit identifier information is provided. The method includes: obtaining target source code and determining the branches included in the target source code; determining a list of code commit identifiers corresponding to any branch within a target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and each code commit identifier is an identifier of the user who modified the branch; filtering a target code commit identifier list corresponding to the target branch from the list of code commit identifiers; and determining the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information about the modification of the target branch and information about the user who modified the target branch.

[0006] Optionally, the target code commit identifier list corresponding to the target branch is selected from the code commit identifier list, including: determining the historical branches corresponding to each code commit identifier in the code commit identifier list; determining the earliest historical branch from the historical branches corresponding to each code commit identifier; comparing the earliest historical branch with the target branch; and adding the code commit identifier corresponding to the earliest historical branch to the target code commit identifier list if the earliest historical branch matches the target branch.

[0007] Optionally, the earliest historical branch can be determined from the historical branches corresponding to each code commit identifier, including: removing the prefix of the historical branches corresponding to each code commit identifier to obtain the earliest historical branch corresponding to each code commit identifier.

[0008] Optionally, based on the target code commit identifier list, the code commit identifier information corresponding to the target branch is determined, including: comparing any two adjacent code commit identifiers in the target code commit identifier list; and determining the code commit identifier information corresponding to the target branch based on the comparison result.

[0009] Optionally, after determining the code commit identifier information corresponding to the target branch, the above method further includes: performing character set encoding conversion processing on the code commit identifier information corresponding to the target branch to obtain the converted code commit identifier information; converting the converted code commit identifier information into a file of the target file format; and importing the file of the target file format into the database.

[0010] Optionally, before obtaining the target source code and determining the branches included in the target source code, the above method further includes: determining the storage directory of the target source code and clearing the storage directory; determining the download address of the target source code; setting the storage path of the storage directory; setting the target branch; and setting the target time period.

[0011] Optionally, the above method can be applied to the Jenkins automation platform.

[0012] To achieve the above objectives, according to another aspect of this application, a device for determining code commit identifier information is provided. The device includes: an acquisition module for acquiring target source code and determining the branches included in the target source code; a first determination module for determining a list of code commit identifiers corresponding to any branch within a target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and each code commit identifier is an identifier of a user who modified the branch; a filtering module for filtering a target code commit identifier list corresponding to a target branch from the list of code commit identifiers; and a second determination module for determining code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information about modifications made to the target branch and information about the user who modified the target branch.

[0013] To achieve the above objectives, according to another aspect of this application, a processor is also provided, which is used to run a program, wherein the program executes the above-mentioned method for determining code submission identification information during runtime.

[0014] To achieve the above objectives, according to another aspect of this application, an electronic device is also provided. The electronic device includes one or more processors and a memory, the memory storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for determining the code submission identification information described above.

[0015] This application employs the following steps: obtaining the target source code and determining the branches included in the target source code; determining a list of code commit identifiers corresponding to any branch within the target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and the code commit identifiers are the identifiers of the users who modified the branch; filtering out the target code commit identifier list corresponding to the target branch from the list of code commit identifiers; and determining the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modifications made to the target branch and information on the users who made the modifications to the target branch. This solves the problem in related technologies where only one code commit identifier can be viewed at a time through git extensions, making it impossible to statistically analyze code commit identifier information. This achieves the effect of viewing branch commit status holistically, realizing multi-dimensional statistics, and improving code management efficiency. Attached Figure Description

[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1This is a hardware structure block diagram of a computer terminal (or mobile device) for implementing a method for determining code submission identifier information according to an embodiment of this application;

[0018] Figure 2 This is a flowchart of a method for determining code submission identifier information according to an embodiment of this application;

[0019] Figure 3 This is a schematic diagram of an optional method for determining code submission identifier information according to an embodiment of this application;

[0020] Figure 4 This is a schematic diagram of an optional method for submitting identification information using processing code according to an embodiment of this application;

[0021] Figure 5 This is a schematic diagram of an optional method for initialization before determining code submission identification information according to an embodiment of this application;

[0022] Figure 6 This is a schematic diagram of an optional method for determining code commit identifier information using the Jenkins automation platform, according to an embodiment of this application.

[0023] Figure 7 This is a structural block diagram of a device for determining code submission identification information according to an embodiment of this application;

[0024] Figure 8 This is a structural block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0025] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0029] Git is an open-source distributed version control system that can effectively and quickly handle version management for projects ranging from very small to very large. It is an open-source version control software developed to help manage Linux kernel development.

[0030] Git Extensions is a toolkit, a graphical Git client used to control Git repositories. It integrates with Windows Explorer and Visual Studio, aiming to make Git more intuitive on Windows.

[0031] A commit ID is a unique identifier for a code commit, used to identify individual changes.

[0032] Batch scripts are used to process a single object in batches. Batch processing is a simplified scripting language that can be used in Windows systems and is interpreted and executed by the command interpreter embedded in the Windows system.

[0033] Jenkins is an open-source software project, a continuous integration tool developed in Java, used to monitor repetitive tasks. It aims to provide an easy-to-use software development platform that enables continuous integration of software projects.

[0034] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0035] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1A hardware block diagram of a computer terminal (or mobile device) for implementing a method to determine code submission identification information is shown. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0036] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0037] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the code submission identification information determination method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned code submission identification information determination method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0038] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0039] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0040] The present invention will now be described in conjunction with preferred implementation steps. Figure 2 This is a flowchart illustrating a method for determining code submission identifier information according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0041] Step S202: Obtain the target source code and determine the branches included in the target source code;

[0042] It should be noted that before counting commit information, you first need to use the git clone (download) command to download the source code, i.e., git clone -v --recurse-submodules --progress "repository download address" "local save address"; then use the command git fetch --progress "--all" to check out all branches;

[0043] Step S204: Determine the code commit identifier list corresponding to any branch in the target time period. The code commit identifier list includes multiple code commit identifiers, and the code commit identifier is the identifier of the user who made the modification to the branch.

[0044] It should be noted that the commit identifier list for any branch includes multiple code identifiers that identify the user who made the changes to that branch.

[0045] In this step, the command `git log bran --pretty=format:%%H --since=%log_time%.days>tmp.txt` is invoked to count the commit IDs and commit counts of a specific branch `bran` within a certain time interval, and the results are output to the file `tmp.txt`.

[0046] Step S206: Filter the target code commit identifier list corresponding to the target branch from the code commit identifier list;

[0047] Step S208: Based on the target code commit identifier list, determine the code commit identifier information corresponding to the target branch. The code commit identifier information includes information on the modifications made to the target branch and information on the user who made the modifications to the target branch.

[0048] Through the steps described above, a Git-based code commit statistics method is implemented using a Windows batch script. This method integrates Git commands with a specific algorithm to address the need for statistical analysis of code commit identifiers. By calling Git commands and applying filtering algorithms, this method can statistically analyze information such as commit ID name, commit comment title, commit comment content, author, author date, committer, commit date, number of deleted lines, number of added lines, modified file names, application name, and branch name within any given time period. This multi-dimensional statistical analysis facilitates developer reference and improves code management efficiency.

[0049] It should be noted that the syntax for using Git can be obtained by installing Git and Git extensions, while the syntax for batch processing on Windows can be obtained through the Windows cmd command.

[0050] Optionally, in the method for determining code commit identifier information provided in this application embodiment, step S206 involves filtering the target code commit identifier list corresponding to the target branch from the code commit identifier list, which is achieved through the following method: determining the historical branches corresponding to each code commit identifier included in the code commit identifier list; determining the earliest historical branch from each historical branch corresponding to each code commit identifier; comparing the earliest historical branch with the target branch; and adding the code commit identifier corresponding to the earliest historical branch to the target code commit identifier list if the earliest historical branch matches the target branch. Figure 3 As shown.

[0051] Optionally, in the method for determining code commit identifier information provided in the embodiments of this application, the earliest historical branch is determined from the historical branches corresponding to each code commit identifier, including: removing the prefix of the historical branches corresponding to each code commit identifier to obtain the earliest historical branch corresponding to each code commit identifier.

[0052] To determine the earliest historical branch, we need to extract the commit ID (set as variable g) of the currently checked branch from tmp.txt. Then, we use the `git branch -r --contains %%g` command to retrieve all related historical branches. Next, we remove the remote branch prefix (usually `origin / `, which can be removed using the truncation command) to obtain the earliest historical branch, `early_bran`. We compare this earliest branch with the currently checked branch `bran`. If they match (i.e., `early_bran = bran`), the corresponding commit ID (variable g) is considered to belong to the current checked branch `bran` and added to list L; otherwise, it is not included. This process filters out commits belonging only to the current branch, resulting in list L. List L ensures that it only contains commits from the current branch within the statistical timeframe, preparing for the next step of obtaining specific commit information.

[0053] Optionally, in the method for determining code commit identifier information provided in the embodiments of this application, step S208, which determines the code commit identifier information corresponding to the target branch based on the target code commit identifier list, includes the following steps: comparing any two adjacent code commit identifiers in the target code commit identifier list; and determining the code commit identifier information corresponding to the target branch based on the comparison result.

[0054] By calling the command `git log commit_id(1)..commit_id(2) --format=%%ai>tmp3.txt`, you can obtain the author field from the modification information between two commit IDs. Similarly, depending on the `format` parameter, you can obtain the commit ID name, commit comment title, commit comment content, author date, committer, commit date, number of deleted lines, number of added lines, modified file name, and file change type information, and save the output as a file named `tmp3.txt`.

[0055] Optionally, in the method for determining code commit identifier information provided in this application embodiment, after determining the code commit identifier information corresponding to the target branch, the method further includes: performing character set encoding conversion processing on the code commit identifier information corresponding to the target branch to obtain converted code commit identifier information; converting the converted code commit identifier information into a file of the target file format; and importing the file of the target file format into a database, such as... Figure 4 As shown.

[0056] The statistical data is processed first by calling the command `start ConvertCode tmp3.txt` to convert the obtained field information file from UTF-8 encoding to ANSI encoding to avoid garbled characters. Then, the command `echotmp3.txt>result.csv` is called to convert the encoded field information into a CSV file format, preparing for the next step of importing into the database. Finally, the command `Sqlldr username / password@database instance control = input_sqlldr.ctl` is called to import the `result.csv` data file into the `input_sqlldr.ctl` file, which is then used for importing into the database.

[0057] Optionally, in the method for determining code commit identifier information provided in this application embodiment, before executing step S202 to obtain the target source code and determine the branches included in the target source code, the method further includes: determining the storage directory of the target source code and clearing the storage directory; determining the download address of the target source code; setting the storage path of the storage directory; setting the target branch; setting the target time period, such as... Figure 5 As shown.

[0058] It should be noted that initialization is required before displaying statistics. The temporary directory files are cleared by calling the command `if EXIST xxx directory` (or `del / Q xxx directory`), where `xxx directory` is the actual temporary directory path. The download address is set by calling the command `set repository download address = ssh: / / xxx@xxx.xxx.xxx.xxx:port / xxx / xxx` (this command needs to be modified according to the actual source code download address). The local save address is set by calling the command `set local save address = X:\xxx\xxx` (this command needs to be modified according to the actual local save address). The checkout branch `yymm_x` is set as `bran` by calling the command `set bran = yymm_x`. The statistical time period (from a certain point in time to a certain point in time) or a certain time interval (within xx days) is set by calling the commands `set log_time = --since = "yyyy-mm-dd" --before = "yyyy-mm-dd"` or `set log_time = xx days`.

[0059] Optionally, in the method for determining code commit identifier information provided in the embodiments of this application, the above method is applied to the Jenkins automation platform, such as... Figure 6 As shown.

[0060] To execute the above method using the Jenkins automation platform, first, set the start time using the Cron schedule expression format through Jenkins' schedule time configuration option. For example, 0 30 18? *MON,WED means triggering a task every Monday and Wednesday at 6:30 PM. Then, standardize the format of each application's configuration file, setting sections and content such as [Download Address], [Save Address], [Check Branch], and [Application Name]. [ ] represents the section format for Windows INI files. After reading the section content of each application's configuration file, generate multiple executable application statistics scripts J1...Jn based on the statistics script template. Then, execute statistics script J1 to perform pre-statistics initialization, statistics commit information, and post-statistics data processing and storage. Then, based on the number of statistics scripts, execute J2, J3, etc., in a loop until Jn is also executed. Finally, configure email notifications after task execution using Jenkins' email sending configuration option, along with execution logs. Jenkins' email sending configuration option can be configured to send emails to different recipients based on the task execution result (success / failure).

[0061] It should be noted that instructions on using the Jenkins platform can be obtained by installing Jenkins. This step utilizes the Jenkins automation platform to automate the execution of tasks across multiple applications, enabling automatic statistical collection and import.

[0062] The method for determining code commit identifier information provided in this application embodiment obtains the target source code and determines the branches included in the target source code; determines a list of code commit identifiers corresponding to any branch within a target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and the code commit identifiers are the identifiers of the users who modified the branch; filters out the target code commit identifier list corresponding to the target branch from the list of code commit identifiers; and determines the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch. This solves the problem in related technologies where only one code commit identifier can be viewed at a time through git extensions, making it impossible to statistically analyze code commit identifier information. This achieves the effect of viewing branch commit status holistically, realizing multi-dimensional statistics, and improving code management efficiency.

[0063] It should be noted that the method provided in this application is based on Windows batch scripts, but it can also be implemented using other programming languages, such as JAVA and PYTHON. The implementation principle is basically the same as that of the Windows batch script-based method.

[0064] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0065] This application also provides a device for determining code submission identifier information. It should be noted that this device can be used to execute the method for determining code submission identifier information provided in this application. The following describes the device for determining code submission identifier information provided in this application.

[0066] Figure 7 This is a schematic diagram of a device for determining code submission identification information according to an embodiment of this application. Figure 7 As shown, the device includes:

[0067] Module 70 is used to obtain the target source code and determine the branches included in the target source code;

[0068] The first determining module 72 is used to determine the code commit identifier list corresponding to any branch in the target time period. The code commit identifier list includes multiple code commit identifiers, and the code commit identifier is the identifier of the user who made the modification to the branch.

[0069] The filtering module 74 is used to filter the target code commit identifier list corresponding to the target branch from the code commit identifier list;

[0070] The second determining module 76 is used to determine the code commit identifier information corresponding to the target branch based on the target code commit identifier list. The code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch.

[0071] It should be noted that Figure 7 Preferred embodiments of the shown examples can be found in [reference needed]. Figure 2 The relevant descriptions of the embodiments shown will not be repeated here.

[0072] The code commit identifier determination device provided in this application embodiment includes an acquisition module 70 for acquiring target source code and determining the branches included in the target source code; a first determination module 72 for determining a code commit identifier list corresponding to any branch within a target time period, wherein the code commit identifier list includes multiple code commit identifiers, and the code commit identifier is the identifier of the user who modified the branch; a filtering module 74 for filtering out the target code commit identifier list corresponding to the target branch from the code commit identifier list; and a second determination module 76 for determining the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch. This solves the problem in related technologies where only one code commit identifier can be viewed at a time through git extensions, making it impossible to statistically analyze the code commit identifier information. This achieves the effect of viewing the branch commit status as a whole, realizing multi-dimensional statistics, and improving code management efficiency.

[0073] The device for determining the code submission identifier information includes a processor and a memory. The acquisition module 70, the first determination module 72, the filtering module 74, and the second determination module 76 are all stored in the memory as program units. The processor executes the program units stored in the memory to achieve the corresponding functions.

[0074] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; by adjusting kernel parameters, commit information for all commit IDs under a specific branch can be obtained holistically.

[0075] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0076] This invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements a method for determining code submission identification information.

[0077] This invention provides a processor for running a program, wherein the program executes a method for determining the code submission identifier information during runtime.

[0078] The processor described above is used to run a program that performs the following functions: obtains the target source code and determines the branches included in the target source code; determines a list of code commit identifiers corresponding to any branch within the target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and the code commit identifiers are the identifiers of the users who modified the branch; filters out the target code commit identifier list corresponding to the target branch from the list of code commit identifiers; and determines the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch.

[0079] like Figure 8 As shown, this embodiment of the invention provides an electronic device, which includes a processor 82, a memory 80, and a program stored in the memory 80 and executable on the processor 82. When the processor 82 executes the program, it performs the following steps: obtaining target source code and determining the branches included in the target source code; determining a code commit identifier list corresponding to any branch within a target time period, wherein the code commit identifier list includes multiple code commit identifiers, and the code commit identifier is the identifier of the user who modified the branch; filtering out the target code commit identifier list corresponding to the target branch from the code commit identifier list; and determining the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch.

[0080] Optionally, the target code commit identifier list corresponding to the target branch is selected from the code commit identifier list, including: determining the historical branches corresponding to each code commit identifier in the code commit identifier list; determining the earliest historical branch from the historical branches corresponding to each code commit identifier; comparing the earliest historical branch with the target branch; and adding the code commit identifier corresponding to the earliest historical branch to the target code commit identifier list if the earliest historical branch matches the target branch.

[0081] Optionally, the earliest historical branch can be determined from the historical branches corresponding to each code commit identifier, including: removing the prefix of the historical branches corresponding to each code commit identifier to obtain the earliest historical branch corresponding to each code commit identifier.

[0082] Optionally, based on the target code commit identifier list, the code commit identifier information corresponding to the target branch is determined, including: comparing any two adjacent code commit identifiers in the target code commit identifier list; and determining the code commit identifier information corresponding to the target branch based on the comparison result.

[0083] Optionally, after determining the code commit identifier information corresponding to the target branch, the above method further includes: performing character set encoding conversion processing on the code commit identifier information corresponding to the target branch to obtain the converted code commit identifier information; converting the converted code commit identifier information into a file of the target file format; and importing the file of the target file format into the database.

[0084] Optionally, before obtaining the target source code and determining the branches included in the target source code, the above method further includes: determining the storage directory of the target source code and clearing the storage directory; determining the download address of the target source code; setting the storage path of the storage directory; setting the target branch; and setting the target time period.

[0085] Optionally, the above method can be applied to the Jenkins automation platform.

[0086] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0087] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: obtaining target source code and determining the branches included in the target source code; determining a code commit identifier list corresponding to any branch within a target time period, wherein the code commit identifier list includes multiple code commit identifiers, and the code commit identifier is an identifier of the user who modified the branch; filtering out the target code commit identifier list corresponding to the target branch from the code commit identifier list; and determining the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch.

[0088] Optionally, the target code commit identifier list corresponding to the target branch is selected from the code commit identifier list, including: determining the historical branches corresponding to each code commit identifier in the code commit identifier list; determining the earliest historical branch from the historical branches corresponding to each code commit identifier; comparing the earliest historical branch with the target branch; and adding the code commit identifier corresponding to the earliest historical branch to the target code commit identifier list if the earliest historical branch matches the target branch.

[0089] Optionally, the earliest historical branch can be determined from the historical branches corresponding to each code commit identifier, including: removing the prefix of the historical branches corresponding to each code commit identifier to obtain the earliest historical branch corresponding to each code commit identifier.

[0090] Optionally, based on the target code commit identifier list, the code commit identifier information corresponding to the target branch is determined, including: comparing any two adjacent code commit identifiers in the target code commit identifier list; and determining the code commit identifier information corresponding to the target branch based on the comparison result.

[0091] Optionally, after determining the code commit identifier information corresponding to the target branch, the above method further includes: performing character set encoding conversion processing on the code commit identifier information corresponding to the target branch to obtain the converted code commit identifier information; converting the converted code commit identifier information into a file of the target file format; and importing the file of the target file format into the database.

[0092] Optionally, before obtaining the target source code and determining the branches included in the target source code, the above method further includes: determining the storage directory of the target source code and clearing the storage directory; determining the download address of the target source code; setting the storage path of the storage directory; setting the target branch; and setting the target time period.

[0093] Optionally, the above method can be applied to the Jenkins automation platform.

[0094] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0095] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0096] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0097] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0098] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0099] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0100] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0101] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0102] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0103] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for determining code submission identifier information, characterized in that, include: Obtain the target source code and determine the branches included in the target source code; Determine a list of code commit identifiers corresponding to any one of the branches within the target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and the code commit identifier is an identifier of the user who modified the branch; Filtering the target code commit identifier list corresponding to the target branch from the code commit identifier list includes: determining the historical branches corresponding to each code commit identifier included in the code commit identifier list; determining the earliest historical branch from each historical branch corresponding to the code commit identifier; comparing the earliest historical branch with the target branch; if the earliest historical branch matches the target branch, adding the code commit identifier corresponding to the earliest historical branch to the target code commit identifier list; Based on the target code commit identifier list, the code commit identifier information corresponding to the target branch is determined, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch.

2. The method according to claim 1, characterized in that, From each of the historical branches corresponding to the aforementioned code commit identifiers, determine the earliest historical branch, including: Remove the prefix from the historical branch corresponding to each code commit identifier to obtain the earliest historical branch corresponding to each code commit identifier.

3. The method according to claim 1, characterized in that, Based on the target code commit identifier list, determine the code commit identifier information corresponding to the target branch, including: Compare any two adjacent code submission identifiers in the target code submission identifier list; Based on the comparison results, determine the code commit identifier information corresponding to the target branch.

4. The method according to claim 1, characterized in that, After determining the code commit identifier information corresponding to the target branch, the method further includes: The code commit identifier information corresponding to the target branch is subjected to character set encoding conversion processing to obtain the converted code commit identifier information; Convert the transformed code submission identification information into a file of the target file format; Import the target file format file into the database.

5. The method according to claim 1, characterized in that, Before obtaining the target source code and determining the branches included in the target source code, the method further includes: Determine the storage directory of the target source code and clear the storage directory; Determine the download address of the target source code; Set the storage path of the storage directory; Set the target branch; Set the target time period.

6. The method according to any one of claims 1 to 5, characterized in that, The method described is applied to the Jenkins automation platform.

7. A device for determining code submission identification information, characterized in that, include: The acquisition module is used to acquire the target source code and determine the branches included in the target source code; The first determining module is used to determine a list of code commit identifiers corresponding to any one of the branches within the target time period, wherein the list of code commit identifiers includes multiple code commit identifiers, and the code commit identifier is an identifier of the user who modified the branch; A filtering module is used to filter out a target code commit identifier list corresponding to a target branch from the code commit identifier list, including: determining the historical branches corresponding to each code commit identifier included in the code commit identifier list; determining the earliest historical branch from each historical branch corresponding to the code commit identifier; comparing the earliest historical branch with the target branch; and adding the code commit identifier corresponding to the earliest historical branch to the target code commit identifier list if the earliest historical branch matches the target branch. The second determining module is used to determine the code commit identifier information corresponding to the target branch based on the target code commit identifier list, wherein the code commit identifier information includes information on the modification of the target branch and information on the user who modified the target branch.

8. A processor, characterized in that, The processor is used to run a program, wherein the program executes the method for determining code submission identification information as described in any one of claims 1 to 6.

9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the method for determining code submission identification information as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Selection method and device for target code

    CN106528071A

  • Code auditing method and device

    CN112835588A