CN111124872A - Branch detection method and device based on difference code analysis and storage medium - Google Patents

Branch detection method and device based on difference code analysis and storage medium Download PDF

Info

Publication number
CN111124872A
CN111124872A CN201811288652.4A CN201811288652A CN111124872A CN 111124872 A CN111124872 A CN 111124872A CN 201811288652 A CN201811288652 A CN 201811288652A CN 111124872 A CN111124872 A CN 111124872A
Authority
CN
China
Prior art keywords
unit
dependency
difference
dependent
building
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
CN201811288652.4A
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.)
Shanghai Bilibili Technology Co Ltd
Original Assignee
Shanghai Bilibili Technology 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 Shanghai Bilibili Technology Co Ltd filed Critical Shanghai Bilibili Technology Co Ltd
Priority to CN201811288652.4A priority Critical patent/CN111124872A/en
Publication of CN111124872A publication Critical patent/CN111124872A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a branch detection method based on difference code analysis and a detection device thereof, wherein the method comprises the following steps: responding to a difference detection instruction aiming at the code branch, and acquiring the dependency relationship among all the building units under the root directory of the code warehouse; acquiring a difference unit in the construction units, and acquiring a dependency unit associated with the difference unit according to the dependency relationship, wherein the difference unit represents the construction unit with changed program files in the code branch; classifying the difference units according to the changed types to obtain at least one classification unit; and respectively executing different detection operations on the classification unit and the dependent unit.

Description

Branch detection method and device based on difference code analysis and storage medium
Technical Field
The invention relates to the field of computer software development, in particular to a branch detection method and device based on difference code analysis and a storage medium.
Background
In the agile development process of computer software, continuous integration is particularly sensitive to the requirement of timeliness, for example, a developer needs to know whether a code unit submitted at this time can be constructed, whether a code check is passed, whether a unit test is passed, and the like at the first time.
In the background of a large warehouse, due to the fact that the number of codes is large, if compiling, checking, unit testing and other operations are carried out on all the construction units each time, time is wasted, machine performance is affected, and it cannot be guaranteed that detected construction failure is caused by the submission.
In addition, there may be a dependency relationship between different building units, for example, if the function implementation of the a unit needs to call an interface of the B unit, the a unit depends on the B unit. In the code branch, the problem that the construction units which are actively or passively associated are changed, and the functions of other construction units which have dependency relationship with the construction units are paralyzed is likely to occur.
Aiming at the current situations that the number of construction units is large and complex dependency relationship exists among the construction units in the prior art, an effective code branch detection scheme is not provided at present.
Disclosure of Invention
The invention aims to provide a branch detection method, a branch detection device and a storage medium based on difference code analysis, which at least solve the problem of high code branch detection difficulty caused by large number of code units and high mutual dependence degree in the prior art.
In order to achieve the above object, the present invention provides a branch detection method based on differential code analysis, comprising the following steps:
responding to a difference detection instruction aiming at the code branch, and acquiring the dependency relationship among all the building units under the root directory of the code warehouse;
acquiring a difference unit in the construction unit, and acquiring a dependent unit associated with the difference unit according to the dependency relationship, wherein the difference unit represents a program file changed in the code warehouse;
classifying the difference units according to the changed types to obtain at least one classification unit;
and respectively executing different detection operations on the classification unit and the dependent unit.
Further, the step of obtaining the dependency relationship between all the building units under the root directory of the code warehouse includes:
obtaining one or more other building units which reference the current building unit, and taking the one or more other building units as dependent units associated with the current building unit;
recording an index relation between the current construction unit and the dependency unit;
traversing all the building units under the root directory of the code warehouse, and acquiring and recording the index relationship between each building unit and the dependent unit associated with each building unit.
Further, the step of obtaining the dependency relationships between all the building units under the root directory of the code repository further includes:
generating a dependency graph from the index relationships, the dependency graph characterizing vector reference relationships between the build units and dependency units associated with the build units.
Further, the classification unit comprises one or more of a new adding unit, a modification unit and a deletion unit.
Further, the step of performing different detection operations on the classification unit and the dependent unit respectively comprises:
executing a first type of operation on the newly added unit and the modification unit;
executing a second type of operation on the deletion unit;
performing a third type of operation on the dependent unit.
Further, the first type of operation includes: compiling, checking and testing the newly added unit and the modified unit in sequence, and displaying a file list of the newly added unit and the modified unit at the same time;
the second type of operation includes: checking whether the deleting unit can be compiled or not, if so, continuing to execute the first type of operation on the deleting unit; if not, only showing the file list of the deletion unit;
the third type of operation includes compiling the dependent unit while presenting a file list of the dependent unit.
In order to achieve the above object, the present invention further provides a branch detection apparatus based on differential code analysis, including:
the dependency relationship acquisition module is suitable for responding to a difference detection instruction aiming at the code branch and acquiring the dependency relationship among all the construction units under the root directory of the code warehouse;
the difference unit acquisition module is suitable for acquiring the difference unit in the construction unit and acquiring a dependent unit associated with the difference unit according to the dependent relationship, wherein the difference unit represents a program file which is changed in the code warehouse;
the classification module is suitable for classifying the difference units according to the changed types to obtain at least one classification unit;
and the detection module is suitable for respectively executing different detection operations on the classification unit and the dependency unit.
Further, the obtaining of the dependency relationship comprises:
a dependent unit obtaining module adapted to obtain one or more other building units that refer to a current building unit, the one or more other building units being dependent units associated with the current building unit;
the index recording module is suitable for recording the index relation between the current construction unit and the dependency unit; and
traversing all the building units under the root directory of the code warehouse, and acquiring and recording the index relationship between each building unit and the dependent unit associated with each building unit.
Further, the dependency relationship obtaining module further includes:
and the dependency graph generation module is suitable for generating a dependency graph according to the index relation, and the dependency graph characterizes the vector reference relation between the construction unit and the dependency unit associated with the construction unit.
Further, the classification unit comprises one or more of a new adding unit, a modification unit and a deletion unit.
Further, the detection module includes:
the first detection module is suitable for executing first type operation on the newly added unit and the modification unit;
the second detection module is suitable for executing second type operation on the deleting unit;
and the third detection module is suitable for executing a third type of operation on the dependent unit.
Further, the first type of operation includes: compiling, checking and testing the newly added unit and the modified unit in sequence, and displaying a file list of the newly added unit and the modified unit at the same time;
the second type of operation includes: checking whether the deleting unit can be compiled or not, if so, continuing to execute the first type of operation on the deleting unit; if not, only showing the file list of the deletion unit;
the third type of operation includes compiling the dependent unit while presenting a file list of the dependent unit.
To achieve the above object, the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the branch detection method based on the difference code analysis when executing the computer program.
To achieve the above object, the present invention further provides a computer-readable storage medium having a computer program stored thereon, where the computer program is executed by a processor to implement the steps of the above branch detection method based on difference code analysis.
The invention realizes the branch detection process based on the differential code analysis, and particularly, the method comprises the steps of firstly obtaining the dependency relationship among all the construction units under the root directory of a code warehouse, secondly obtaining the differential unit with program change, further obtaining the dependency unit associated with the differential unit according to the dependency relationship, and after classifying the differential unit according to the change type of the differential unit, respectively executing different operations on the differential unit belonging to different classifications and the dependency unit thereof so as to realize code integration. Specifically, the invention executes compiling operation on the dependent unit to check the compatibility of the dependent unit, and divides the difference unit into a modification unit and a deletion unit according to the change type of the difference unit, wherein the compiling, checking and testing operation is executed on the modification unit to ensure that the modification unit can be constructed, and other operations except for displaying are not required on the deletion unit. The invention clearly classifies different building units in the code warehouse, executes different operations according to different classifications, can greatly improve the efficiency of code branch detection and strongly ensures the reliability of the code branch detection.
Drawings
FIG. 1 is a schematic flow chart of an alternative branch detection method based on differential code analysis according to an embodiment of the present invention;
FIG. 2 is an alternative flow diagram for obtaining dependencies between all building elements according to an embodiment of the invention;
FIG. 3 is an alternative structural diagram of a DAG dependency graph according to an embodiment of the present invention;
FIG. 4 is a block diagram of an alternative program module of a branch detection apparatus based on differential code analysis according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an alternative hardware architecture of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Considering that the number of building units in the prior art is huge and complex dependency relationship exists among the building units, so that the problems that the code branches are easy to make mistakes when being aggregated and the integration efficiency is not high are solved. The following is a detailed description:
example one
Referring to fig. 1, in the present embodiment, a branch detection method based on difference code analysis is provided, which includes the following steps:
s1: in response to a difference detection instruction for a code branch, obtaining dependencies between all build units under a root directory of a code repository.
The dependency relationship in the present invention refers to a reference relationship between the building units, for example, if the building unit a references the building unit B during execution, there is a dependency relationship between the building unit a and the building unit B. At this time, the building unit A is called a reference unit, and the building unit B is called a referenced unit. Referring to fig. 2, the steps for obtaining the dependency relationship in this embodiment are as follows:
s11: one or more other building units that reference the current building unit are obtained and the one or more other building units are taken as dependent units associated with the current building unit.
Generally speaking, the dependency relationship is stated in advance in the program file, and a person skilled in the art can obtain the dependency relationship between the building units from the program file according to the existing statement through a syntax analysis tool, and can specifically obtain the dependency relationship by means of an AST abstract syntax tree and the like.
Taking the current building element as an example, there are usually one or more other elements having a dependency relationship with the current building element, and the other elements having a dependency relationship with the current building element are referred to as dependency elements of the current building element in the present invention, which is obviously one or more.
S12: and recording the index relation between the current construction unit and the dependent unit.
In the embodiment, addressable paths are adopted as identifiers of building units and dependent units, such as go-common/library/ccode, go-common/app/tool/saga/http. The index relationship between the current building unit and the dependent unit can be recorded into a database, preferably hash table hashmap, for example, setting a keyword in the hash table as a dependent unit identifier, and returning a value as the identifier of the current building unit; or setting the key words in the hash table as the identification of the current construction unit, and the return value as the identification of the dependent unit. That is, in this step, an index from the referencing unit to the referenced unit may be established, and an index from the referenced unit to the referencing unit may also be established. Preferably, the index from the referencing unit to the referenced unit and the index from the referenced unit to the referencing unit are established simultaneously.
S13: traversing all the building units under the root directory of the code warehouse, and acquiring and recording the index relationship between each building unit and the dependent unit associated with each building unit.
The number of the building units in the code warehouse is large, and in order to ensure that any piece of dependency relationship data is not lost, the invention traverses all the building units from the root directory of the code warehouse and sequentially obtains the dependency units of each building unit.
S14: generating a dependency graph from the index relationships, the dependency graph characterizing vector reference relationships between the build units and dependency units associated with the build units.
The dependency graph can reflect the dependency relationship between the building units more intuitively and visually compared with the database. And because the reference units and the referenced units have directivity, the dependency graph can directly reflect the reference directions between different building units by using directional arrows. For example, the building element a references the building element B, the reference relationship from the building element a to the building element B can be represented by an arrow pointing from the building element a to the building element B.
The dependency graph in this embodiment is preferably in the form of a DAG (directed acyclic graph), each node represents a building unit, and the specific structure can be seen in fig. 3.
S2: and acquiring a difference unit in the construction unit, and acquiring a dependent unit associated with the difference unit according to the dependency relationship, wherein the difference unit represents the changed program file.
In this embodiment, the difference unit refers to a construction unit in which a change of a program file occurs. The building unit includes a program file and a non-program file, and the present invention only focuses on the change of the program file in this embodiment, which is also the key difference between a certain code branch and other branches or trunks. The method for acquiring the difference unit may be implemented by an existing code version management tool, for example, gitdiff, which is not specifically limited by the present invention.
After acquiring the difference units, the present invention further acquires the dependency units corresponding to each difference unit according to the dependency relationship in the foregoing. The reason for acquiring the dependent unit at the same time in the invention is that it is not enough to consider only the difference unit in the code branch detection operation, when the program file of a certain difference unit changes, the calling interface of the difference unit is likely to change, and if the detection operation is performed only on the difference unit, the situation that the difference unit cannot be called is likely to occur. In order to ensure that each calling interface can work normally, the invention needs to execute corresponding detection operation on the dependent unit which refers to the difference unit. Based on the starting point, the invention simultaneously acquires the dependent unit which has reference relation with the difference unit.
And S3, classifying the difference units according to the changed types to obtain at least one classification unit.
When analyzing a difference unit, the existing code version management tool generally outputs different results according to different modes of generating changes. Taking gitdiff as an example, five kinds of change files are output after analyzing code branches, which are respectively: newly added files (A), modified files (M), deleted files (D), moved files (R) and copied files (C). The invention carries out secondary classification on the changed files in the construction unit on the basis of the output result of the code version management tool, and is used for corresponding to different detection operations. For example, complete compilation, check and test steps need to be performed for newly added files and modified files, no substantive operation needs to be performed for deleted files, and a compiler needs to be executed to determine whether it is available for related files in a dependent unit. For a mobile file, the file is essentially migrated from one addressing path to another addressing path, which is equivalent to two changes of deletion and addition which are executed in sequence; for copying files, it is equivalent to performing a new change on the new addressing path.
Based on the analysis, any change file can be classified into one or more of three change modes of adding, modifying and deleting, so that the classification of the difference units also follows the standard, and the difference units are divided into one or more of adding units, modifying units and deleting units.
S4, different detection operations are respectively executed on the classification unit and the dependent unit.
The invention executes the first kind of operation to the newly added unit and the modified unit, including compiling, checking and testing, and simultaneously displays the file list of the newly added unit and the modified unit.
Executing a second type of operation on a deleting unit, wherein the second type of operation comprises checking whether the deleting unit can be compiled, and if so, continuing to execute the first type of operation on the deleting unit; and if not, only displaying the file list of the deletion unit. It should be noted that if the deletion unit is not compilable, it is indicated that the program file in the unit does not exist, and therefore, only the file list needs to be displayed; if the delete unit is compiled, indicating that the program file in the unit is still available and usable, such as the move file mentioned above, then the delete unit is equivalent to the new add unit on the new addressing path, and therefore the first type of operation needs to be performed.
In addition, the invention also executes a third type of operation on the dependent unit, which comprises compiling the dependent unit and displaying the file list of the dependent unit, thereby ensuring that the dependent unit can realize normal calling on the difference unit.
Through the scheme of executing different operations on different building units, the invention properly considers all the changed files in the code warehouse and the files with reference relations to the changed files and executes corresponding detection operations, thereby ensuring the completeness and the efficiency of the code branches in the integration process.
Example two
Based on the branch detection method provided in the first embodiment, a branch detection apparatus based on code difference analysis is provided in this embodiment, and specifically, fig. 4 shows an optional structural block diagram of the branch detection apparatus based on code difference analysis, and as shown in fig. 4, the branch detection apparatus 10 based on code difference analysis includes:
the dependency relationship obtaining module 11 is adapted to respond to a difference detection instruction for a code branch, and obtain the dependency relationship among all the building units under the root directory of the code warehouse;
a difference unit obtaining module 12, adapted to obtain a difference unit in the building unit, and obtain a dependency unit associated with the difference unit according to the dependency relationship, where the difference unit represents a program file that changes in the code repository;
a classification module 13, adapted to classify the difference unit according to the changed type to obtain at least one classification unit;
a detection module 14 adapted to perform different detection operations on the classification unit and the dependency unit, respectively.
Further, the dependency relationship obtaining module 11 includes:
a dependent unit obtaining module 111, adapted to obtain one or more other building units that refer to the current building unit, and take the one or more other building units as dependent units associated with the current building unit;
an index recording module 112, adapted to record an index relationship between the current building unit and the dependent unit; and
traversing all the building units under the root directory of the code warehouse, and acquiring and recording the index relationship between each building unit and the dependent unit associated with each building unit.
A dependency graph generating module 113 adapted to generate a dependency graph according to the index relationship, where the dependency graph characterizes a vector reference relationship between the building unit and a dependency unit associated with the building unit.
Further, the classification unit comprises one or more of a new adding unit, a modification unit and a deletion unit.
Further, the detection module 14 includes:
a first detection module 141 adapted to perform a first type of operation on the newly added cell and the modified cell;
a second detection module 142, adapted to perform a second type of operation on the deletion unit;
a third detection module 143 adapted to perform a third type of operation on the dependent cells.
Further, the first type of operation includes: compiling, checking and testing the newly added unit and the modified unit in sequence, and displaying a file list of the newly added unit and the modified unit at the same time;
the second type of operation includes: checking whether the deleting unit can be compiled or not, if so, continuing to execute the first type of operation on the deleting unit; if not, only showing the file list of the deletion unit;
the third type of operation includes compiling the dependent unit while presenting a file list of the dependent unit.
EXAMPLE III
In a third preferred embodiment of the present invention, a computer apparatus is provided. Fig. 5 is a schematic diagram of a hardware architecture of an embodiment of a computer device according to the present invention. In the present embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set in advance or stored. For example, the server may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers). As shown, the computer device 2 includes at least, but is not limited to: the memory 21, processor 22, and network interface 23 may be communicatively coupled to each other by a system bus. Wherein:
the memory 21 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 21 may be an internal storage module of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 2. Of course, the memory 21 may also comprise both an internal memory module of the computer device 2 and an external memory device thereof. In this embodiment, the memory 21 is generally used for storing an operating system installed in the computer device 2 and various types of application software, such as program codes of the branch detection method. Further, the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 22 is generally configured to control the overall operation of the computer device 2, such as performing control and processing related to data interaction or communication with the computer device 2. In this embodiment, the processor 22 is configured to execute the program code stored in the memory 21 or process data.
The network interface 23 may comprise a wireless network interface or a wired network interface, and the network interface 23 is typically used to establish a communication connection between the computer device 2 and other computer devices. For example, the network interface 23 is used to connect the computer device 2 with an external terminal through a network, establish a data transmission channel and a communication connection between the computer device 2 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a global system for Mobile communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It is noted that fig. 5 only shows a computer device with components 21-23, but it is to be understood that not all of the shown components are required to be implemented, and that more or less components may be implemented instead.
In this embodiment, the branch detection method based on code difference analysis stored in the memory 21 can be further divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 22) to complete the present invention.
Example four
The present embodiment also provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the branch detection method based on code difference analysis in the first embodiment.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In this embodiment, the computer-readable storage medium is generally used for storing an operating system and various types of application software installed in the computer device, for example, the program code of the branch detection method based on code difference analysis in the first embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (14)

1. A branch detection method based on difference code analysis is characterized by comprising the following steps:
responding to a difference detection instruction aiming at the code branch, and acquiring the dependency relationship among all the building units under the root directory of the code warehouse;
acquiring a difference unit in the construction units, and acquiring a dependency unit associated with the difference unit according to the dependency relationship, wherein the difference unit represents the construction unit with changed program files in the code branch;
classifying the difference units according to the changed types to obtain at least one classification unit;
and respectively executing different detection operations on the classification unit and the dependent unit.
2. The branch detection method according to claim 1, wherein the step of obtaining the dependency relationships between all building units under the root directory of the code repository comprises:
obtaining one or more other building units which reference the current building unit, and taking the one or more other building units as dependent units associated with the current building unit;
recording an index relation between the current construction unit and the dependency unit;
traversing all the building units under the root directory of the code warehouse, and acquiring and recording the index relationship between each building unit and the dependent unit associated with each building unit.
3. The branch detection method according to claim 2, wherein the step of obtaining the dependency relationships between all the building units under the root directory of the code repository further comprises:
generating a dependency graph from the index relationships, the dependency graph characterizing vector reference relationships between the build units and dependency units associated with the build units.
4. The branch detection method according to claim 1, wherein the classification unit comprises one or more of an addition unit, a modification unit, and a deletion unit.
5. The branch detection method according to claim 4, wherein the step of performing different detection operations on the classification unit and the dependent unit respectively comprises:
executing a first type of operation on the newly added unit and the modification unit;
executing a second type of operation on the deletion unit;
performing a third type of operation on the dependent unit.
6. The branch detection method according to claim 5, wherein the first type of operation comprises: compiling, checking and testing the newly added unit and the modified unit in sequence, and displaying a file list of the newly added unit and the modified unit at the same time;
the second type of operation includes: checking whether the deleting unit can be compiled or not, if so, continuing to execute the first type of operation on the deleting unit; if not, only showing the file list of the deletion unit;
the third type of operation includes compiling the dependent unit while presenting a file list of the dependent unit.
7. A branch detection apparatus based on differential code analysis, comprising:
the dependency relationship acquisition module is suitable for responding to a difference detection instruction aiming at the code branch and acquiring the dependency relationship among all the construction units under the root directory of the code warehouse;
the difference unit obtaining module is suitable for obtaining the difference unit in the construction unit and obtaining the dependent unit related to the difference unit according to the dependent relation, and the difference unit represents the construction unit with the changed program file in the code branch;
the classification module is suitable for classifying the difference units according to the changed types to obtain at least one classification unit;
and the detection module is suitable for respectively executing different detection operations on the classification unit and the dependency unit.
8. The branch detection apparatus according to claim 7, wherein the dependency obtaining comprises:
a dependent unit obtaining module adapted to obtain one or more other building units that refer to a current building unit, the one or more other building units being dependent units associated with the current building unit;
the index recording module is suitable for recording the index relation between the current construction unit and the dependency unit; and
traversing all the building units under the root directory of the code warehouse, and acquiring and recording the index relationship between each building unit and the dependent unit associated with each building unit.
9. The branch detection method according to claim 8, wherein the dependency obtaining module further comprises:
and the dependency graph generation module is suitable for generating a dependency graph according to the index relation, and the dependency graph characterizes the vector reference relation between the construction unit and the dependency unit associated with the construction unit.
10. The branch detection method according to claim 7, wherein the classification unit comprises one or more of an addition unit, a modification unit, and a deletion unit.
11. The branch detection method according to claim 10, wherein the detection module comprises:
the first detection module is suitable for executing first type operation on the newly added unit and the modification unit;
the second detection module is suitable for executing second type operation on the deleting unit;
and the third detection module is suitable for executing a third type of operation on the dependent unit.
12. The branch detection method according to claim 11, wherein the first type of operation comprises: compiling, checking and testing the newly added unit and the modified unit in sequence, and displaying a file list of the newly added unit and the modified unit at the same time;
the second type of operation includes: checking whether the deleting unit can be compiled or not, if so, continuing to execute the first type of operation on the deleting unit; if not, only showing the file list of the deletion unit;
the third type of operation includes compiling the dependent unit while presenting a file list of the dependent unit.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of any one of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN201811288652.4A 2018-10-31 2018-10-31 Branch detection method and device based on difference code analysis and storage medium Pending CN111124872A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811288652.4A CN111124872A (en) 2018-10-31 2018-10-31 Branch detection method and device based on difference code analysis and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811288652.4A CN111124872A (en) 2018-10-31 2018-10-31 Branch detection method and device based on difference code analysis and storage medium

Publications (1)

Publication Number Publication Date
CN111124872A true CN111124872A (en) 2020-05-08

Family

ID=70485675

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811288652.4A Pending CN111124872A (en) 2018-10-31 2018-10-31 Branch detection method and device based on difference code analysis and storage medium

Country Status (1)

Country Link
CN (1) CN111124872A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858299A (en) * 2020-06-02 2020-10-30 鹏城实验室 Automatic difference analysis and verification method
CN112817849A (en) * 2021-01-28 2021-05-18 北京达佳互联信息技术有限公司 Test data processing method, device, equipment and storage medium
CN113064814A (en) * 2021-03-09 2021-07-02 青岛海尔科技有限公司 Processing method and device of component reference data, storage medium and electronic device
CN113326402A (en) * 2021-06-16 2021-08-31 上海哔哩哔哩科技有限公司 Directed acyclic graph generation method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7975147B1 (en) * 2003-03-31 2011-07-05 Hewlett-Packard Development Company, L.P. Electronic device network supporting enciphering and deciphering and update generation in electronic devices
CN103699488A (en) * 2013-12-30 2014-04-02 优视科技有限公司 Call relation dependence graph based regression testing method and system
CN104035772A (en) * 2014-06-09 2014-09-10 中国科学院软件研究所 Static analysis based source code multi-versionfunction call relation difference identification method
CN105824756A (en) * 2016-03-17 2016-08-03 南京大学 Automatic detection method and system of outmoded demand on basis of code dependency relationship
CN106294156A (en) * 2016-08-11 2017-01-04 北京邮电大学 A kind of static code fault detection analysis method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7975147B1 (en) * 2003-03-31 2011-07-05 Hewlett-Packard Development Company, L.P. Electronic device network supporting enciphering and deciphering and update generation in electronic devices
CN103699488A (en) * 2013-12-30 2014-04-02 优视科技有限公司 Call relation dependence graph based regression testing method and system
CN104035772A (en) * 2014-06-09 2014-09-10 中国科学院软件研究所 Static analysis based source code multi-versionfunction call relation difference identification method
CN105824756A (en) * 2016-03-17 2016-08-03 南京大学 Automatic detection method and system of outmoded demand on basis of code dependency relationship
CN106294156A (en) * 2016-08-11 2017-01-04 北京邮电大学 A kind of static code fault detection analysis method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111858299A (en) * 2020-06-02 2020-10-30 鹏城实验室 Automatic difference analysis and verification method
CN111858299B (en) * 2020-06-02 2023-06-16 鹏城实验室 Automatic difference analysis and verification method
CN112817849A (en) * 2021-01-28 2021-05-18 北京达佳互联信息技术有限公司 Test data processing method, device, equipment and storage medium
CN113064814A (en) * 2021-03-09 2021-07-02 青岛海尔科技有限公司 Processing method and device of component reference data, storage medium and electronic device
CN113326402A (en) * 2021-06-16 2021-08-31 上海哔哩哔哩科技有限公司 Directed acyclic graph generation method and system
CN113326402B (en) * 2021-06-16 2022-07-19 上海哔哩哔哩科技有限公司 Directed acyclic graph generation method and system

Similar Documents

Publication Publication Date Title
CN107273286B (en) Scene automatic test platform and method for task application
CN110209652B (en) Data table migration method, device, computer equipment and storage medium
US11163731B1 (en) Autobuild log anomaly detection methods and systems
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN107239392B (en) Test method, test device, test terminal and storage medium
CN110231994B (en) Memory analysis method, memory analysis device and computer readable storage medium
CN109032631B (en) Application program patch package obtaining method and device, computer equipment and storage medium
CN107632827B (en) Method and device for generating installation package of application
CN108614702B (en) Byte code optimization method and device
CN113688288B (en) Data association analysis method, device, computer equipment and storage medium
CN109684298B (en) Database migration method, device, equipment and storage medium
US20230259358A1 (en) Documentation enforcement during compilation
US9116714B2 (en) Methods and systems for file processing
CN112860412B (en) Service data processing method and device, electronic equipment and storage medium
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN116578282A (en) Code generation method, device, electronic equipment and medium
CN112346952A (en) Method, equipment and electronic equipment for regression testing of test cases
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
CN112463596B (en) Test case data processing method, device and equipment and processing equipment
CN111400243B (en) Development management system based on pipeline service and file storage method and device
CN115705297A (en) Code call detection method, device, computer equipment and storage medium
CN111400396A (en) Method and device for generating data synchronization script and computer readable storage medium
CN112579705A (en) Metadata acquisition method and device, computer equipment and storage medium
CN110688430A (en) Method and device for obtaining data bypass and electronic equipment

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