CN115878901A - Code warehouse keyword searching method, device, equipment and storage medium - Google Patents

Code warehouse keyword searching method, device, equipment and storage medium Download PDF

Info

Publication number
CN115878901A
CN115878901A CN202310005228.9A CN202310005228A CN115878901A CN 115878901 A CN115878901 A CN 115878901A CN 202310005228 A CN202310005228 A CN 202310005228A CN 115878901 A CN115878901 A CN 115878901A
Authority
CN
China
Prior art keywords
code
warehouse
information
keyword
search
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.)
Pending
Application number
CN202310005228.9A
Other languages
Chinese (zh)
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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202310005228.9A priority Critical patent/CN115878901A/en
Publication of CN115878901A publication Critical patent/CN115878901A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a code warehouse keyword searching method, a code warehouse keyword searching device and a code warehouse keyword searching storage medium, which can be applied to the technical field of computers. The method comprises the following steps: acquiring all code warehouse information, and instantiating all the code warehouse information to a database; responding to a search request for a specified keyword and a search warehouse range, and acquiring a warehouse address list related to the search warehouse range from the database; building a code pulling request in a multithread mode, and pulling a plurality of code warehouse information in the warehouse address list to the local; and traversing each branch file of the plurality of code warehouse information locally, searching whether the keyword is contained or not, and generating a search result report.

Description

Code warehouse keyword searching method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a medium, and a program product for searching a code repository keyword.
Background
A company that develops software typically has multiple code repositories that explode security breaches or need to find out if the code contains specified keywords. In the current gitee platform, each repository needs to be manually pulled to be local and then a development tool is used for global search. When the number of the warehouses is large, a large amount of time is invested to repeat the operations of pulling codes and searching. This can result in a multiple increase in workload if multiple branches are contained within each warehouse.
Specifically, the existing global search keyword of the code repository is divided into the following steps: (1) The user acquires the URL of a warehouse pull code on gite and then uses git to pull the project to the local; (2) Globally searching keywords for each branch by using a code development tool; (3) And repeating the steps until the searching of all the warehouses is finished. In the prior art, keywords can be searched for all warehouses, but the problems of high manpower investment, long execution operation time, complex operation steps and the like are solved.
Disclosure of Invention
In view of the foregoing, the present disclosure provides code repository keyword lookup methods, apparatus, devices, media and program products.
According to a first aspect of the present disclosure, there is provided a code repository keyword search method, including: acquiring all code warehouse information, and instantiating all the code warehouse information to a database; responding to a search request for a specified keyword and a search warehouse range, and acquiring a warehouse address list related to the search warehouse range from the database; building a code pulling request in a multithread mode, and pulling a plurality of code warehouse information in the warehouse address list to the local; and traversing each branch file of the plurality of code warehouse information locally, searching whether the keyword is contained or not, and generating a search result report.
According to an embodiment of the present disclosure, the acquiring all code repository information and instantiating the all code repository information to a database includes: and acquiring all code warehouse information in real time by using an openapi function on a gite platform, and instantiating all the code warehouse information to a database.
According to an embodiment of the present disclosure, the lookup repository scope is determined according to the following manner: and establishing a corresponding warehouse identifier for each code warehouse, and distinguishing different code warehouses through different warehouse identifiers.
According to the embodiment of the disclosure, the multithreading building code pulling request for pulling the plurality of code warehouse information in the warehouse address list to the local includes: constructing the code pulling request by using a jgit package; and determining the number of preset threads, controlling each thread of the number of threads to read one code warehouse information, and pulling a plurality of code warehouse information in the warehouse address list to the local at one time.
According to the embodiment of the present disclosure, before each thread controlling the number of threads reads one piece of code warehouse information, at least one of the following is further included: determining that the code pulling request conforms to a preset administrator authority; determining that the code pulling request conforms to preset identity authentication information; determining that the local storage location is error free.
According to an embodiment of the present disclosure, traversing each branch file of the plurality of code repository information locally to find whether the keyword is contained includes:
specifying the number of branches to be queried; traversing the branch number of the plurality of code warehouse information, and matching the content of each branch file under the branch number with the keyword.
According to an embodiment of the present disclosure, the search result report includes: a list of at least one target code repository containing the keyword; and a location in the target code repository where at least one target branch file containing the keyword is located.
According to an embodiment of the present disclosure, after the generating the search result report, the method further includes: deleting the local code repositories.
A second aspect of the present disclosure provides a code repository keyword search apparatus, including: the warehouse information instantiation module is used for acquiring all code warehouse information and instantiating the all code warehouse information to the database; the system comprises a warehouse list acquisition module, a database searching module and a database searching module, wherein the warehouse list acquisition module is used for responding to a searching request for a specified keyword and a searching warehouse range and acquiring a warehouse address list related to the searching warehouse range from the database; the multithreading pulling module is used for constructing a code pulling request in a multithreading manner and pulling a plurality of code warehouse information in the warehouse address list to the local; and the traversal searching module is used for locally traversing each branch file of the plurality of code warehouse information, searching whether the keyword is contained or not, and generating a search result report.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-described method.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described method.
A fifth aspect of the disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above method.
According to the code warehouse keyword searching method, device, equipment, medium and program product provided by the disclosure, the code warehouse is pulled in a multithread manner, the keyword is searched in each branch in a traversing manner, and the local warehouse is deleted after searching, so that the condition that all warehouses or the appointed warehouse contain the keyword is automatically searched through the code. On the one hand, the keyword search is carried out on all warehouses by one-time operation, the advantages of automation, flexibility and high efficiency are achieved, the keyword search efficiency is greatly improved, and the workload of people is reduced. On the other hand, all code warehouse information is acquired from the enterprise perspective, the warehouse information is stored in the database, and the code warehouse is managed through the macroscopic view, so that a new idea is provided for company-level warehouse management, the warehouse management mode is widened, and the warehouse is managed uniformly from the macroscopic level. Therefore, the technical problem that the keyword searching efficiency in the existing code warehouse is low is solved at least partially.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a code repository keyword lookup method, apparatus, device, medium and program product according to an embodiment of the disclosure;
FIG. 2 schematically illustrates a flow diagram of a code repository keyword lookup method according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a detailed operational flow diagram of a code repository keyword lookup method according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow diagram of a multi-threaded pull process according to an embodiment of the disclosure;
FIG. 5 schematically illustrates a flow diagram of a traversal lookup process according to an embodiment of the present disclosure;
FIG. 6 schematically shows a flow diagram after report generation according to an embodiment of the present disclosure;
FIG. 7 is a block diagram schematically illustrating a structure of a code repository keyword lookup apparatus according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates a block diagram of an electronic device suitable for implementing a code repository keyword lookup method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction should be interpreted in the sense one having ordinary skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B, a and C, B and C, and/or A, B, C, etc.).
In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure, application and other processing of the related data (such as but not limited to personal information of the user) are all in accordance with the regulations of related laws and regulations, and necessary security measures are taken without violating the customs of the public order.
Before describing in detail specific embodiments of the present disclosure, technical terms are first explained to facilitate a better understanding of the present disclosure.
Gitee: is a code hosting service based on Git (distributed version control system) launched by OSChina (open source china).
Java: the system is an object-oriented programming language and has the two characteristics of strong function, simplicity and easy use. Java excellently realizes an object-oriented theory, and provides requirements for characteristics of distribution, robustness, safety, platform performance, portability and the like for program development.
Code repository: a remote repository of codes for a project, an IT company typically has a large number of repositories.
Key words: a string or code fragment that needs to be looked up.
The embodiment of the disclosure provides a code warehouse keyword searching method, which comprises the following steps: acquiring all code warehouse information, and instantiating all the code warehouse information to a database; responding to a search request for a specified keyword and a search warehouse range, and acquiring a warehouse address list related to the search warehouse range from a database; building a code pulling request in a multithread mode, and pulling a plurality of code warehouse information in a warehouse address list to the local; and traversing each branch file of the plurality of code warehouse information locally, searching whether the keyword is contained or not, and generating a search result report.
Fig. 1 schematically illustrates an application scenario diagram of a code repository keyword lookup method, apparatus, device, medium and program product according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium of communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may interact with the server 105 via the network 104 using at least one of the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages or the like. Various communication client applications, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, social platform software, etc. (for example only), may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server that provides various services, such as a background management server that provides support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (for example only). The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the code repository keyword search method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the code repository keyword lookup apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 105. The code repository keyword search method provided by the embodiment of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103 and/or the server 105. Correspondingly, the code repository keyword searching apparatus provided in the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The code repository keyword search method according to the embodiment of the present disclosure will be described in detail below with reference to fig. 2 to 6 based on the scenario described in fig. 1.
FIG. 2 schematically shows a flow diagram of a code repository keyword lookup method according to an embodiment of the present disclosure. Fig. 3 schematically illustrates a specific operation flowchart of a code repository keyword search method according to an embodiment of the present disclosure.
Referring to fig. 2 and 3, the code repository keyword search method of the embodiment includes operations S210 to S240.
In operation S210, all code repository information is acquired and instantiated to the database.
According to the method provided by the embodiment of the disclosure, java is used as a development language, and springboot is used as a development framework to establish an independent project. On the basis, all code warehouse information of a certain target enterprise targeted by a user is acquired in real time based on openapi functions provided by a gite platform, and the code warehouse information is instantiated to a database, so that a foundation is laid for subsequent operation.
In operation S220, in response to the search request for the specified keyword and the search repository range, a list of repository addresses referred to by the search repository range is obtained from the database.
The keywords and the search warehouse scope can be input by a manager, wherein the keywords are provided by a quality control department according to the inspection requirement, and the keywords are determined as what is seen and what is obtained. The range of the search warehouse can be flexibly selected according to the requirement. Illustratively, a corresponding repository identification is established for each code repository, and different code repositories are distinguished by different repository identifications. Therefore, the range of the search warehouse required by the manager can be flexibly determined.
Next, the server 105 shown in fig. 1 receives the search request, and obtains the list of warehouse addresses related to the search warehouse scope from the database.
Illustratively, the list of repository addresses is a list of repository URLs.
In operation S230, a code pull request is constructed by multiple threads, and a plurality of code warehouse information in the warehouse address list is pulled to the local.
FIG. 4 schematically shows a flow diagram of a multi-threaded pull process according to an embodiment of the disclosure.
As shown in fig. 4, in the embodiment of the present disclosure, building a code pull request in multiple threads, and pulling a plurality of code warehouse information in the warehouse address list to the local may further include operations S2301 to S2302.
In operation S2301, a code pull request is constructed using a jgit package.
It should be understood that different code repositories correspond to different URLs for pull code requests.
In operation S2302, a preset number of threads is determined, each thread controlling the number of threads reads one code warehouse information, and a plurality of code warehouse information in the warehouse address list is pulled to the local at one time.
Illustratively, the number of threads is generally 10, i.e., ten threads operate ten warehouses at the same time, each thread operates one warehouse, and each thread operates the next warehouse after completing the operation of the current warehouse.
Through the embodiment, the warehouse is read one time by using a single thread conventionally, so that the efficiency is low when the warehouse quantity is large; and multiple warehouses can be operated simultaneously by adopting multiple threads, so that the execution efficiency is improved to a great extent.
Further, before each thread of the control thread number reads one code warehouse information, at least one of the following is included: determining that the code pulling request conforms to a preset administrator authority; determining that the code pulling request conforms to preset identity authentication information; the local storage location is determined to be error free.
Illustratively, according to the open source api requirements of the gite platform, administrator privileges are required to read the full-scale warehouse. At the same time, authentication information needs to be provided. In addition, it is necessary to determine the local location, specifically to read the code repository information to a local storage location, thereby pulling the remote code information to the local.
In operation S240, each branch file of the plurality of code repository information is traversed locally to find whether a keyword is contained, and a search result report is generated.
After pulling a plurality of pieces of code warehouse information once, traversing each branch file in the code warehouse information, and searching whether the file content contains a keyword or not. The matching method of the keywords is equal, and the content of the file containing the keywords is matched successfully, namely the branch file containing the keywords is searched.
In the embodiment of the present disclosure, the search result report includes: a list of at least one object code repository containing keywords; and the position of at least one target branch file containing the keyword in the target code warehouse.
Therefore, the search result report provides a code warehouse list containing the keywords and the position of the branch file, and the code warehouse list and the position of the branch file can be used by a manager.
FIG. 5 schematically shows a flow diagram of a traversal lookup process according to an embodiment of the disclosure.
As shown in fig. 5, in the embodiment of the present disclosure, the locally traversing each branch file of the plurality of code repository information in operation S240 to find whether the branch file contains a keyword may further include operations S2401 to S2402.
In operation S2401, the number of branches to be queried is specified.
In operation S2402, the number of branches of the plurality of code repository information is traversed, and the content of each branch file under the number of branches is matched with the keyword.
Because one code warehouse has a plurality of branches, the number of branches to be inquired can be flexibly set so as to further reduce the traversal times and improve the keyword search efficiency.
Fig. 6 schematically shows a flow diagram after report generation according to an embodiment of the present disclosure.
As shown in fig. 6, in the embodiment of the present disclosure, after the generating of the search result report in operation S240, operation S250 may be further included.
In operation S250, the local code repositories are deleted.
Through the embodiment, the local code warehouse is deleted in time after the keyword search is finished, and the occupation of the disk space is avoided.
According to the code warehouse keyword searching method provided by the embodiment of the disclosure, a multi-thread code warehouse is adopted, keywords are searched for each branch in a traversing manner, and a local warehouse is deleted after searching, so that the condition that all warehouses or a designated warehouse contain the keywords is automatically searched through codes. On one hand, the method realizes keyword search on all warehouses by one-time operation, has the advantages of automation, flexibility and high efficiency, greatly improves the keyword search efficiency and reduces the workload of people. On the other hand, the method acquires all code warehouse information from the enterprise perspective, stores the warehouse information into the database, and macroscopically manages the code warehouse, so that a new thought is provided for company-level warehouse management, warehouse management modes are widened, and the warehouse is uniformly managed from a macroscopic level.
Based on the method, the disclosure also provides a device for searching the keywords of the code warehouse. The apparatus will be described in detail below with reference to fig. 7.
Fig. 7 schematically shows a block diagram of a code repository keyword lookup apparatus according to an embodiment of the present disclosure.
As shown in fig. 7, the code warehouse keyword lookup apparatus 700 of this embodiment includes a warehouse information instantiation module 710, a warehouse list acquisition module 720, a multi-thread pull module 730, and a traversal lookup module 740.
And the repository information instantiation module 710 is used for acquiring all the code repository information and instantiating all the code repository information to the database. In an embodiment, the repository information instantiation module 710 may be configured to perform the operation S210 described above, which is not described herein again.
The repository list obtaining module 720 is configured to obtain, from the database, a repository address list related to the repository scope in response to the search request for the specified keyword and the repository scope. In an embodiment, the warehouse list obtaining module 720 may be configured to perform the operation S220 described above, which is not described herein again.
And the multithreading pulling module 730 is used for constructing a code pulling request in a multithreading manner and pulling a plurality of code warehouse information in the warehouse address list to the local. In an embodiment, the multi-thread pull module 730 can be configured to perform the operation S230 described above, which is not described herein again.
And the traversal searching module 740 is configured to locally traverse each branch file of the plurality of pieces of code repository information, search whether a keyword is included, and generate a search result report. In an embodiment, the traversal search module 740 may be configured to perform the operation S240 described above, which is not described herein again.
According to the embodiment of the disclosure, a multi-thread code pulling warehouse is adopted, keywords are searched for each branch in a traversing manner, and the local warehouse is deleted after the keywords are searched, so that the condition that all warehouses or a specified warehouse contain the keywords is automatically searched through the codes. On the one hand, the device realizes keyword search on all warehouses by one-time operation, has the advantages of automation, flexibility and high efficiency, greatly improves the keyword search efficiency and reduces the workload of people. On the other hand, the device acquires all code warehouse information from the enterprise view angle, stores the warehouse information into the database, and manages the code warehouse in a macroscopic view, thereby providing a new idea for company-level warehouse management, widening the warehouse management mode, and managing the warehouse in a unified way from a macroscopic level.
According to an embodiment of the present disclosure, any multiple modules of the warehouse information instantiation module 710, the warehouse list acquisition module 720, the multithreading pull module 730, and the traversal lookup module 740 may be combined and implemented in one module, or any one of the modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the warehouse information instantiation module 710, the warehouse list acquisition module 720, the multi-thread pull module 730, and the traversal lookup module 740 may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of three implementations of software, hardware, and firmware, or in any suitable combination of any of them. Alternatively, at least one of repository information instantiation module 710, repository list acquisition module 720, multi-threaded pull module 730, and traversal lookup module 740 may be at least partially implemented as a computer program module that, when executed, may perform a corresponding function.
FIG. 8 schematically illustrates a block diagram of an electronic device suitable for implementing a code repository keyword lookup method according to an embodiment of the present disclosure.
As shown in fig. 8, an electronic device 800 according to an embodiment of the present disclosure includes a processor 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. The processor 801 may include, for example, a general purpose microprocessor (e.g., CPU), an instruction set processor and/or related chip sets and/or a special purpose microprocessor (e.g., application Specific Integrated Circuit (ASIC)), among others. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flows according to embodiments of the present disclosure.
In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are stored. The processor 801, the ROM802, and the RAM 803 are connected to each other by a bus 804. The processor 801 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM802 and/or RAM 803. Note that the programs may also be stored in one or more memories other than the ROM802 and RAM 803. The processor 801 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 800 may also include input/output (I/O) interface 805, input/output (I/O) interface 805 also connected to bus 804, according to an embodiment of the present disclosure. Electronic device 800 may also include one or more of the following components connected to I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be embodied in the device/apparatus/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: 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), 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 present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM802 and/or RAM 803 described above and/or one or more memories other than the ROM802 and RAM 803.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated in the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the code warehouse keyword searching method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 801. The above described systems, devices, modules, units, etc. may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted in the form of a signal on a network medium, distributed, downloaded and installed via communication section 809, and/or installed from removable media 811. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by the processor 801, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It will be appreciated by a person skilled in the art that various combinations or/and combinations of features recited in the various embodiments of the disclosure and/or in the claims may be made, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (12)

1. A code warehouse keyword search method comprises the following steps:
acquiring all code warehouse information, and instantiating all the code warehouse information to a database;
responding to a search request for a specified keyword and a search warehouse range, and acquiring a warehouse address list related to the search warehouse range from the database;
building a code pulling request in a multithread mode, and pulling a plurality of code warehouse information in the warehouse address list to the local;
and traversing each branch file of the plurality of code warehouse information locally, searching whether the keyword is contained or not, and generating a search result report.
2. The method of claim 1, wherein the obtaining and instantiating all code repository information to a database comprises:
and acquiring all code warehouse information in real time by using an openapi function on a gite platform, and instantiating all the code warehouse information to a database.
3. The method of claim 1, wherein the lookup repository scope is determined according to:
and establishing a corresponding warehouse identifier for each code warehouse, and distinguishing different code warehouses through different warehouse identifiers.
4. The method of claim 2, wherein the multithreading build code pull request to pull locally a plurality of code warehouse information under the list of warehouse addresses comprises:
constructing the code pulling request by using a jgit package;
and determining the number of preset threads, controlling each thread of the number of threads to read one code warehouse information, and pulling a plurality of code warehouse information in the warehouse address list to the local at one time.
5. The method of claim 4, wherein prior to each thread controlling the number of threads reading a code repository information, further comprising at least one of:
determining that the code pulling request conforms to a preset administrator authority;
determining that the code pulling request conforms to preset identity authentication information;
determining that the local storage location is error free.
6. The method of claim 1, wherein traversing each branch file of the plurality of code repository information locally for the presence of the keyword comprises:
specifying the number of branches to be queried;
traversing the branch number of the plurality of code warehouse information, and matching the content of each branch file under the branch number with the keyword.
7. The method of claim 1, wherein the search result report comprises:
a list of at least one object code repository containing the keyword; and
the target code repository includes a location of at least one target branch file of the keyword.
8. The method of claim 1, wherein after the generating a search result report, further comprising:
deleting the local code repositories.
9. A code repository keyword lookup apparatus comprising:
the warehouse information instantiation module is used for acquiring all code warehouse information and instantiating the all code warehouse information to the database;
the system comprises a warehouse list acquisition module, a database searching module and a database searching module, wherein the warehouse list acquisition module is used for responding to a searching request for a specified keyword and a searching warehouse range and acquiring a warehouse address list related to the searching warehouse range from the database;
the multithreading pulling module is used for constructing a code pulling request in a multithreading manner and pulling a plurality of code warehouse information in the warehouse address list to the local;
and the traversal searching module is used for locally traversing each branch file of the plurality of code warehouse information, searching whether the keyword is contained or not, and generating a search result report.
10. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-8.
11. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 8.
12. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8.
CN202310005228.9A 2023-01-04 2023-01-04 Code warehouse keyword searching method, device, equipment and storage medium Pending CN115878901A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310005228.9A CN115878901A (en) 2023-01-04 2023-01-04 Code warehouse keyword searching method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310005228.9A CN115878901A (en) 2023-01-04 2023-01-04 Code warehouse keyword searching method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115878901A true CN115878901A (en) 2023-03-31

Family

ID=85758000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310005228.9A Pending CN115878901A (en) 2023-01-04 2023-01-04 Code warehouse keyword searching method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115878901A (en)

Similar Documents

Publication Publication Date Title
JP6813152B2 (en) Methods, systems, and programs for determining the identification of software in a software container
CN109194714B (en) File pushing method and device, terminal device and storage medium
US20180196647A1 (en) Application Programming Interface Discovery Using Pattern Recognition
CN114253734A (en) Resource calling method and device, electronic equipment and computer readable storage medium
CN111666293A (en) Database access method and device
CN110895534A (en) Data splicing method, device, medium and electronic equipment
CN115587575A (en) Data table creation method, target data query method, device and equipment
US20170078138A1 (en) Real-time tagger
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
CN116450622B (en) Method, apparatus, device and computer readable medium for data warehouse entry
CN113448570A (en) Data processing method and device, electronic equipment and storage medium
CN114237765B (en) Functional component processing method, device, electronic equipment and medium
CN115514632A (en) Resource template arranging method, device and equipment for cloud service and storage medium
CN115878901A (en) Code warehouse keyword searching method, device, equipment and storage medium
CN115033574A (en) Information generation method, information generation device, electronic device, and storage medium
CN113918525A (en) Data exchange scheduling method, system, electronic device, medium, and program product
CN113535574A (en) Automatic generation method, device, equipment and medium for test user data
US20200272679A1 (en) Missing web page relocation
CN116401319B (en) Data synchronization method and device, electronic equipment and computer readable storage medium
CN114363172B (en) Decoupling management method, device, equipment and medium for container group
CN113495747B (en) Gray scale release method and device
CN114266547A (en) Method, device, equipment, medium and program product for identifying business processing strategy
CN114817041A (en) Test module construction method and device, electronic equipment and storage medium
CN117176576A (en) Network resource changing method, device, equipment and storage medium
CN113535568A (en) Verification method, device, equipment and medium for application deployment version

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