File conversion method and device, equipment and storage medium
By determining historical files and differences algorithms from the version control system, only the difference parts of the development files are converted in format, the problem of low efficiency in the development file format conversion is solved, and an efficient file conversion and testing process is realized.
Patent Information
- Application Number
- CN202410959805.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-08
AI Technical Summary
During the software development process, the data format of the development file is different from the data format supported by the test tool, resulting in low file format conversion efficiency. Especially when development files are frequently updated, the overall format conversion efficiency is low, which affects the development efficiency.
By determining the historical files and the difference algorithm from the version control system, only the difference parts of the source file are formatted to convert the patch data, and merged with the historical files to obtain the target file, reducing the workload of format conversion.
Improves the efficiency of file conversion, reduces the workload of format conversion, and improves testing and development efficiency.
Smart Images

Figure CN118916328A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a file conversion method, device, equipment and storage medium. Background Art
[0002] During the software development process, developers write code on a specific development architecture to obtain development files, and then test the development files using specific testing tools to verify whether the development files achieve the expected goals.
[0003] In actual applications, the data format of the development file is different from the data format supported by the test tool. In order to implement the test normally, the format of the development file needs to be converted into the data format supported by the test tool.
[0004] However, in a scenario where development files are frequently updated, format conversion of development files is inefficient. Summary of the invention
[0005] The present application provides a file conversion method, device, equipment and storage medium to improve the efficiency of file conversion.
[0006] In a first aspect, the present application provides a file conversion method, comprising: receiving a conversion request, the conversion request comprising a source file and a target data format; determining a historical file and a conversion file corresponding to the historical file from a version control system according to the conversion request, and determining target data, the historical file being a file of a previous version of the source file, and the target data being the difference between the source file and the historical file; performing format conversion processing on the target data according to the target data format to obtain patch data; and merging the patch data with the conversion file corresponding to the historical file to obtain a target file.
[0007] In one possible design, determining a historical file and a conversion file corresponding to the historical file from a version control system includes: determining a current data format of the source file and a current version number of the source file from file information of the source file; determining the historical file from the version control system based on the current data format and the current version number, the data format of the historical file being the current data format, and the version number of the historical file being a version number previous to the current version number; determining a conversion file corresponding to the historical file from the version control system based on the target data format, the data format of the conversion file corresponding to the historical file being the target data format.
[0008] In a possible design, determining the target data includes: inputting the source file and the historical file into a difference algorithm of the version control system to obtain the target data.
[0009] In one possible design, the target data is format-converted according to the target data format to obtain patch data, including: determining a mapping relationship according to the current data format and the target data format; and format-converting the target data according to the mapping relationship to obtain the patch data.
[0010] In one possible design, the patch data and the conversion file corresponding to the historical file are merged to obtain a target file, including: determining a merge rule; merging the patch data and the conversion file corresponding to the historical file according to the merge rule to obtain an intermediate file; determining context information of the target data from the source file and the historical file; verifying the intermediate file according to the context information to obtain a verification result, wherein the verification result includes verification passed or verification failed; if the verification result is verification passed, determining the intermediate file as the target file.
[0011] In one possible design, determining the merge rule includes: determining an update type between the source file and the history file from the version control system, the update type including at least one of the following: addition, deletion or modification; and determining the merge rule based on the update type.
[0012] In a possible design, the conversion request includes a source address and a target address; the method further includes: determining a file under the source address as the source file; and sending the target file to the target address.
[0013] In a second aspect, the present application provides a file conversion device, comprising: a receiving module, used to receive a conversion request, the conversion request including a source file and a target data format; a determination module, used to determine a historical file and a conversion file corresponding to the historical file from a version control system according to the conversion request, and determine the target data, the historical file being a file of a previous version of the source file, and the target data being the difference between the source file and the historical file; a conversion module, used to perform format conversion processing on the target data according to the target data format to obtain patch data; and a merging module, used to merge the patch data with the conversion file corresponding to the historical file to obtain the target file.
[0014] In one possible design, the determination module is specifically used to determine the current data format of the source file and the current version number of the source file from the file information of the source file; the determination module is also specifically used to determine the historical file from the version control system based on the current data format and the current version number, the data format of the historical file is the current data format, and the version number of the historical file is the previous version number of the current version number; the determination module is also specifically used to determine the conversion file corresponding to the historical file from the version control system based on the target data format, and the data format of the conversion file corresponding to the historical file is the target data format.
[0015] In a possible design, the determination module is specifically configured to input the source file and the historical file into a difference algorithm of the version control system to obtain the target data.
[0016] In one possible design, the device also includes: a mapping module, used to determine a mapping relationship based on the current data format and the target data format; the mapping module is also used to perform format conversion processing on the target data according to the mapping relationship to obtain the patch data.
[0017] In one possible design, the device also includes: a verification module, used to determine a merge rule; the verification module is also used to merge the patch data and the conversion file corresponding to the historical file according to the merge rule to obtain an intermediate file; the verification module is also used to determine the context information of the target data from the source file and the historical file; the verification module is also used to verify the intermediate file according to the context information to obtain a verification result, and the verification result includes verification passed or verification failed; the verification module is also used to determine the intermediate file as the target file if the verification result is verification passed.
[0018] In one possible design, the verification module is specifically used to determine the update type between the source file and the historical file from the version control system, and the update type includes at least one of the following: addition, deletion or modification; the verification module is also specifically used to determine the merge rule based on the update type.
[0019] In one possible design, the device further includes: an automation module, configured to determine the file under the source address as the source file; and the automation module, configured to send the target file to the target address.
[0020] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer execution instructions; the at least one processor executes the computer execution instructions stored in the memory, so that the at least one processor executes the file conversion method described in the first aspect and various possible designs of the first aspect.
[0021] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the file conversion method described in the first aspect and various possible designs of the first aspect is implemented.
[0022] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the file conversion method described in the first aspect and various possible designs of the first aspect.
[0023] The file conversion method, device, equipment and storage medium provided by the present application include: receiving a conversion request, the conversion request includes a source file and a target data format; according to the conversion request, determining a historical file and a conversion file corresponding to the historical file from a version control system, and determining the target data, the historical file is a file of the previous version of the source file, and the target data is the difference between the source file and the historical file; performing format conversion processing on the target data according to the target data format to obtain patch data; merging the patch data with the conversion file corresponding to the historical file to obtain the target file. The above scheme performs format conversion on the difference between the source file and the historical file to obtain patch data, and obtains the target file according to the patch data. Compared with format conversion of the entire source file, it can reduce the workload of format conversion, thereby improving the efficiency of format conversion. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0025] Figure 1 A schematic diagram of an application scenario of a file conversion method provided in an embodiment of the present application;
[0026] Figure 2 A flowchart of a file conversion method provided in an embodiment of the present application;
[0027] Figure 3 A flowchart of a file conversion method provided in an embodiment of the present application;
[0028] Figure 4 A schematic diagram of determining target data provided in an embodiment of the present application;
[0029] Figure 5 A schematic diagram of the verification process provided in the embodiment of the present application;
[0030] Figure 6 A schematic diagram of sending a target file provided in an embodiment of the present application;
[0031] Figure 7 A schematic diagram of the structure of a file conversion device provided in an embodiment of the present application;
[0032] Figure 8 A schematic diagram of the structure of a file conversion device provided in an embodiment of the present application;
[0033] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0034] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0035] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0036] In the technical solution of this application, the collection, storage, use, processing, transmission, provision and disclosure of information such as financial data or user data involved shall comply with the provisions of relevant laws and regulations and shall not violate public order and good morals.
[0037] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0038] Figure 1 This is an application scenario diagram of file conversion in the prior art. Figure 1 As shown, the source file is converted according to the target data format to obtain the target file, and the data format of the target file is the target data format.
[0039] Combined with the scenario example, the developer uses the go+swagger architecture to develop software locally, defines the test cases of each interface in yaml format, and uses swagger to test the interface. However, if the test demander needs to test on postman, then it is necessary to convert the swagger yaml file into a json case file that supports postman.
[0040] In the prior art, data conversion is performed on the entire source file. In the scenario where the source file is frequently updated or the source file is too large, data conversion on the entire source file has the problem of low conversion efficiency, which leads to low software development efficiency.
[0041] In response to the above technical problems, the present application proposes the following technical concept: only perform data conversion processing on the updated part of the source file to obtain patch data, merge the patch data with the conversion file corresponding to the historical file to obtain the target file, thereby reducing the workload of data conversion.
[0042] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0043] Figure 2 A flowchart of a file conversion method provided in an embodiment of the present application, the method comprising the following steps:
[0044] S201: Receive a conversion request, where the conversion request includes a source file and a target data format.
[0045] As an example, the execution subject of this embodiment may be a file conversion device, and there are many implementations of the file conversion device. For example, it may be program software, or a medium storing relevant computer programs, such as a USB flash drive, etc.; or, the device may also be a physical device integrated or installed with relevant computer programs, such as a chip, a smart terminal, a computer, a server, etc.
[0046] The source file is a file in a data format to be converted, and the target data format is a data format to be converted. The conversion request is used to request to convert the data format of the source file into the target data format.
[0047] Illustratively, a conversion format is used to enable the file to be read correctly.
[0048] Combined with the scenario example, a new version of the source file is obtained through software development. In order to test whether the source file meets expectations, the source file needs to be tested. If the test tool does not support the data format of the source file, the source file cannot be tested directly. The test is achieved by converting the source file to the target data format supported by the test tool.
[0049] S202: According to the conversion request, determine the historical file and the conversion file corresponding to the historical file from the version control system, and determine the target data.
[0050] The history file is a file of the previous version of the source file, and the target data is the difference between the source file and the history file.
[0051] The version control system stores each version of the file in the software development process and the converted files of each file for developers to trace back.
[0052] In combination with the scenario example, if the version number of the source file is 1.06, the file corresponding to the previous version number 1.05 is determined as the historical file. It can be understood that the historical file of the previous version is the file closest to the source file, and the difference between the two is the least.
[0053] Optionally, the files in the version control system are pre-sorted according to version numbers, and the file ranked first is the latest version of the file in the version control system, that is, the previous version of the source file, and the file ranked first is determined as a historical file.
[0054] Optionally, the target data is obtained through a difference algorithm in a version control system.
[0055] S203: Perform format conversion processing on the target data according to the target data format to obtain patch data.
[0056] Patch data is a small data package or code snippet used to update or modify existing files.
[0057] In the related art, the format conversion process is performed on the entire source file, while the present application only performs the format conversion process on the target data.
[0058] Combined with the scenario example, if the software development process is frequently updated or the source file is too large, directly converting the source file format will be inefficient, which may lead to low test efficiency. By reducing the workload of format conversion processing, the test efficiency can be improved.
[0059] S204: merge the patch data and the conversion file corresponding to the historical file to obtain a target file.
[0060] The conversion file corresponding to the historical file is a file obtained by performing format conversion processing on the historical file, and the data format of the conversion file corresponding to the historical file is the target data format.
[0061] Combined with the scenario example, by merging the patch data with the conversion file corresponding to the historical file, the difference part can be supplemented on the basis of the conversion file corresponding to the historical file, thereby obtaining a target file corresponding to the content of the source file but with a different data format.
[0062] The file conversion method provided in the embodiment of the present application receives a conversion request, the conversion request includes a source file and a target data format; according to the conversion request, determines a historical file and a conversion file corresponding to the historical file from a version control system, and determines the target data, the historical file is a file of the previous version of the source file, and the target data is the difference between the source file and the historical file; performs format conversion processing on the target data according to the target data format to obtain patch data; merges the patch data and the conversion file corresponding to the historical file to obtain the target file. The above scheme performs format conversion on the difference between the source file and the historical file to obtain patch data, and obtains the target file according to the patch data. Compared with format conversion of the entire source file, it can reduce the workload of format conversion, thereby improving the efficiency of format conversion.
[0063] Based on any of the above embodiments, Figure 3 , which explains the detailed process of file conversion.
[0064] Figure 3 A flowchart of a file conversion method provided in an embodiment of the present application is shown below. Figure 3 As shown, the method includes:
[0065] S301: Receive a conversion request, where the conversion request includes a source file and a target data format.
[0066] It should be noted that the execution process of S301 refers to S201 and will not be repeated here.
[0067] S302: Determine the current data format of the source file and the current version number of the source file from the file information of the source file.
[0068] Among them, the current data format is the data format of the source file written when the source file is developed, and the current version number of the source file corresponds to the current version of the source file.
[0069] Exemplarily, the version number corresponds to the version one by one, and the version of the source file can be accurately determined by the version number.
[0070] In conjunction with the scenario example, after a source file is generated, the current data format and version number of the source file are also generated and stored in the file information of the source file.
[0071] Optionally, the current data format and the current version number of the source file are obtained from the development record of the development file.
[0072] Combined with the scenario example, the file information is stored in the source file and may be modified due to a fault. The development record is encrypted and can only be viewed with permission. By obtaining the current data format and the current version number of the source file from the development record, the accuracy of the current data format and the current version number can be improved.
[0073] S303: Determine the historical file from the version control system according to the current data format and the current version number.
[0074] The data format of the historical file is the current data format, and the version number of the historical file is the previous version number of the current version number.
[0075] Combined with the scenario example, the version control system stores each version of the file and the corresponding version number. By comparing the version number, the historical file of the previous version of the source file can be accurately determined.
[0076] Optionally, the version control system stores the validity of each file, and the historical file is determined based on the validity of the file in the version control system.
[0077] Combined with the scenario example, there will be faulty files in the software development process. The faulty files can be identified through testing or user feedback. Faulty files are invalid files. Faulty marks are added to the faulty files, and the faulty marks are stored in the version control system. When obtaining historical files, exclude files with faulty marks to avoid affecting the validity of the source files.
[0078] Optionally, valid files and invalid files in the version control system are stored separately, thereby effectively avoiding determining historical files from invalid files.
[0079] Optionally, add calling permissions to invalid files. The file conversion does not have this permission, so invalid files cannot be obtained from the version control system, thereby preventing invalid files from causing the conversion file to be invalid, and improving the accuracy of the target file.
[0080] S304: Determine the conversion file corresponding to the historical file from the version control system according to the target data format.
[0081] Among them, the data format of the conversion file corresponding to the historical file is the target data format.
[0082] Exemplarily, the version control system may store multiple files corresponding to the historical files that have undergone format conversion processing, and the multiple files corresponding to the historical files correspond to different data formats and are used in different application scenarios.
[0083] Combined with the scenario example, the historical file may correspond to multiple files in different data formats, for example, the multiple data formats may be XML, CSV or ISON, etc. If the target data format is JSON format, the JSON format file will be determined as the conversion file corresponding to the historical file from the multiple files corresponding to the historical file.
[0084] Optionally, the files stored in the version control system are grouped according to the type of data format, each group corresponds to a data format identifier, the target group is determined according to the target data format and the identifier of the data format corresponding to each group, and the conversion file corresponding to the historical file is determined from the target group. For example, if the target data format is JSON format, the identifier of the data format corresponding to the determined target group is also JSON format, and the format of all files under the target group is JSON format.
[0085] It can be understood that determining the conversion file corresponding to the historical file according to the target data format can improve the accuracy of the file.
[0086] S305: Input the source file and the historical file into the difference algorithm of the version control system to obtain the target data.
[0087] The difference algorithm of the version control system can obtain target data by comparing files line by line or dividing files into blocks and comparing them block by block, where the target data is the difference between the files.
[0088] Exemplarily, the difference algorithm stored in the version control system is used to efficiently manage file changes and reduce storage requirements.
[0089] Next, combine Figure 4 Determining target data is described.
[0090] Figure 4 This is a schematic diagram of determining target data provided by an embodiment of the present application. Figure 4 As shown, the current data format and current version number of the source file are determined according to the file information of the source file, and the historical file is determined from the version control system according to the current data format and current version number. The source file and the historical file are compared by a difference algorithm to obtain the difference between the source file and the historical file, that is, the target data.
[0091] S306: Determine a mapping relationship according to the current data format and the target data format.
[0092] The mapping relationship refers to how data elements in the current data format correspond to data elements in the target data format.
[0093] Exemplarily, the mapping relationship includes but is not limited to at least one of the following:
[0094] 1. Path mapping, for example: the path / users / {userId} in Swagger is mapped to the URL path https: / / example.com / users / 123 in Postman.
[0095] 2. Request method mapping, for example: the request method GET in Swagger is mapped to the request method GET in Postman.
[0096] 3. Request parameter mapping, for example: the path parameter {userId} in Swagger is mapped to the request parameter in Postman. In Postman, the request parameters are placed in the parameter field.
[0097] 4. Request URL mapping, for example, the request URL information in Swagger is mapped to the request URL in Postman. The url field in Postman includes raw, protocol, host, path and other information.
[0098] 5. Request header mapping, for example: No request header is specified in Swagger, so the header field in Postman is an empty array.
[0099] 6. Request body mapping, for example: the request body is not specified in Swagger, so the body field in Postman is an empty object.
[0100] 7. Response mapping, for example, the response information in Swagger can be mapped to the response in Postman. In Postman, the response information is placed in the response field.
[0101] S307 , performing format conversion processing on the target data according to the mapping relationship to obtain patch data.
[0102] Exemplarily, each record or field in the target data is traversed by a data reading tool, and the value of each record or field is converted according to the mapping relationship to obtain corresponding converted data, and the converted data is determined as patch data.
[0103] Optionally, the version control system includes a command for generating patch data, and patch data can be generated according to target data by running the command.
[0104] S308: Merge the patch data and the conversion file corresponding to the historical file to obtain a target file.
[0105] A feasible implementation method can perform the merging process through the following method: determine the merging rules; merge the conversion files corresponding to the patch data and the historical files according to the merging rules to obtain an intermediate file; determine the context information of the target data from the source files and the historical files; verify the intermediate file according to the context information to obtain a verification result, and the verification result includes verification passed or verification failed; if the verification result is verification passed, the intermediate file is determined as the target file.
[0106] The context information of the target data is associated with the target data.
[0107] Combined with the scenario example, the file includes a specific logical structure. For example, merging the patch data with the conversion file corresponding to the historical file may cause a change in the logical structure, which in turn causes the target file to be different from the source file. The context information of the target data can reflect the logical structure associated with the target data. The context information is used to verify whether the logical structure of the intermediate file is correct, thereby verifying whether the intermediate file is valid.
[0108] Next, combine Figure 5 The verification process will be described.
[0109] Figure 5 This is a schematic diagram of the verification process provided in the embodiment of the present application. Figure 5 As shown, according to the historical file, the conversion file corresponding to the historical file is determined from the version control system, and the patch data is merged with the conversion file corresponding to the historical file to obtain an intermediate file, and the validity of the intermediate file is to be determined. The intermediate file is verified through the context information. If the verification passes, it means that the intermediate file is valid, and the intermediate file is determined as the target file.
[0110] Optionally, if the verification passes, the intermediate file is stored in a version control system for merging processing of subsequent versions of the file conversion.
[0111] Optionally, if the verification fails, the format conversion process is repeated until the verification passes.
[0112] In this feasible implementation, whether the merged file is valid can be determined through verification processing, thereby improving the accuracy of file conversion.
[0113] A feasible implementation method can determine the merge rule by the following method: determine the update type between the source file and the historical file from the version control system, the update type includes at least one of the following: addition, deletion or modification; determine the merge rule according to the update type.
[0114] Combined with the scenario example, if the update type is addition, it means that the source file has new content compared to the historical file, and the target data is the new content. The corresponding merging rule is to add the patch data corresponding to the target data based on the conversion file corresponding to the historical file.
[0115] Optionally, a correspondence between the update type and the merge rule is established, and the merge rule is determined according to the correspondence.
[0116] Exemplarily, the corresponding relationship includes multiple update types and a merge rule corresponding to each update type, and the corresponding merge rule can accurately perform the merge processing of files of the update type.
[0117] In this feasible implementation, the merging rules determined according to the update type meet the actual merging requirements, thereby improving the accuracy of file conversion.
[0118] In a feasible implementation manner, the conversion request includes a source address and a target address; the file conversion method further includes: determining the file under the source address as the source file; and sending the target file to the target address.
[0119] Exemplarily, the present application performs file conversion via a pre-written program tool.
[0120] Optionally, the program tool includes an input box and / or an option box, and the input box and / or the option box are used to input file conversion instructions.
[0121] In combination with the scenario example, the user enters the file conversion instruction in the input box and / or option box, and the program tool automatically performs the file conversion. If the source address is entered, the program tool automatically obtains the source file from the source address. If the target address is entered, the program tool automatically sends the target file obtained by executing the file conversion to the target address.
[0122] Next, combine Figure 6 Describe the file to be sent.
[0123] Figure 6 A schematic diagram of sending a target file provided in an embodiment of the present application. Figure 6 As shown, the program tool receives the conversion request, parses the conversion request, obtains the source address, the target address, and the target data format. The program tool automatically obtains the source file from the source address, performs file conversion through the target data format to obtain the target file, and sends the target file to the target address.
[0124] Optionally, there can be multiple source files under the source address.
[0125] Combined with the scenario example, the program tool automatically converts each source file under the source address to obtain multiple target files, and automatically sends the multiple targets to the target address.
[0126] In this feasible implementation, through the conversion request containing address information, the source file can be automatically obtained from the source address and the target file can be sent to the target address, thereby reducing user operations and improving the efficiency of file conversion.
[0127] Figure 7 The following is a schematic diagram of the structure of a file conversion device provided in an embodiment of the present application. Figure 7 As shown, the file conversion device 70 may include: a receiving module 71, a determining module 72, a conversion module 73 and a merging module 74, wherein:
[0128] The receiving module 71 is used to receive a conversion request, where the conversion request includes a source file and a target data format.
[0129] The determination module 72 is used to determine the historical file and the conversion file corresponding to the historical file from the version control system according to the conversion request, and determine the target data. The historical file is the previous version of the source file, and the target data is the difference between the source file and the historical file.
[0130] The conversion module 73 is used to perform format conversion processing on the target data according to the target data format to obtain patch data.
[0131] The merging module 74 is used to merge the patch data with the conversion file corresponding to the historical file to obtain a target file.
[0132] Optionally, the receiving module 71 may execute Figure 2 S201 in the embodiment.
[0133] Optionally, the determination module 72 may execute Figure 2 S202 in the embodiment.
[0134] Optionally, the conversion module 73 may execute Figure 2 S203 in the embodiment.
[0135] Optionally, the merge module 74 may execute Figure 2 S204 in the embodiment.
[0136] It should be noted that the file conversion device shown in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0137] In a possible implementation, the determination module 72 is specifically configured to:
[0138] Determine the current data format of the source file and the current version number of the source file from the file information of the source file; determine the historical file from the version control system based on the current data format and the current version number, the data format of the historical file is the current data format, and the version number of the historical file is the previous version number of the current version number; determine the conversion file corresponding to the historical file from the version control system based on the target data format, and the data format of the conversion file corresponding to the historical file is the target data format.
[0139] In a possible implementation, the determination module 72 is specifically configured to:
[0140] Input the source files and historical files into the difference algorithm of the version control system to obtain the target data.
[0141] Figure 8 A schematic diagram of the structure of a file conversion device provided in an embodiment of the present application. Figure 7 Based on the embodiment shown, Figure 8 As shown, the file conversion device 80 further includes: a mapping module 75, a verification module 76 and an automation module 77, wherein:
[0142] The mapping module 75 is used to:
[0143] A mapping relationship is determined according to the current data format and the target data format; and the target data is format converted according to the mapping relationship to obtain patch data.
[0144] The verification module 76 is used to:
[0145] Determine a merge rule; merge the patch data and the conversion file corresponding to the historical file according to the merge rule to obtain an intermediate file; determine the context information of the target data from the source file and the historical file; verify the intermediate file according to the context information to obtain a verification result, which includes a verification pass or a verification fail; if the verification result is a verification pass, determine the intermediate file as the target file.
[0146] In a possible implementation, the verification module 76 is specifically configured to:
[0147] Determine the update type between the source file and the history file from the version control system, where the update type includes at least one of the following: addition, deletion or modification; and determine a merge rule based on the update type.
[0148] The automation module 77 is used to determine the file under the source address as the source file; and send the target file to the target address.
[0149] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. Each module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The functions of each module. In addition, all or part of these modules can be integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.
[0150] Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device may include: a transceiver 91 , a processor 92 , and a memory 93 .
[0151] The processor 92 executes the computer execution instructions stored in the memory, so that the processor 92 executes the scheme in the above embodiment. The processor 92 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0152] The memory 93 is connected to the processor 92 via a system bus and completes communication between them. The memory 93 is used to store computer program instructions.
[0153] The transceiver 91 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.
[0154] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to implement communication between the database access device and other computers (such as a client, a read-write library, and a read-only library). The memory may include a random access memory (RAM) and may also include a non-volatile memory. The electronic device provided in the embodiment of the present application may be a terminal device of the above embodiment.
[0155] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the file conversion method in the above embodiment.
[0156] The embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the file conversion method of the above embodiment.
[0157] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the file conversion method in the above embodiment can be implemented.
[0158] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0159] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to implement the solution of this embodiment.
[0160] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each module can exist physically separately, or two or more modules can be integrated into one unit. The above-mentioned module-composed unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0161] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods of various embodiments of the present application.
[0162] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor.
[0163] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.
[0164] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.
[0165] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0166] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic control unit or a main control device.
[0167] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0168] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A file conversion method, characterized in that: include: receiving a conversion request, wherein the conversion request includes a source file and a target data format; According to the conversion request, determine a history file and a conversion file corresponding to the history file from a version control system, and determine target data, wherein the history file is a file of a previous version of the source file, and the target data is a difference between the source file and the history file; Performing format conversion processing on the target data according to the target data format to obtain patch data; The patch data and the conversion file corresponding to the history file are merged to obtain a target file.
2. The method according to claim 1, characterized in that Determining a historical file and a conversion file corresponding to the historical file from a version control system includes: Determine the current data format of the source file and the current version number of the source file from the file information of the source file; Determine the history file from the version control system according to the current data format and the current version number, wherein the data format of the history file is the current data format, and the version number of the history file is a version number previous to the current version number; According to the target data format, a conversion file corresponding to the historical file is determined from the version control system, and the data format of the conversion file corresponding to the historical file is the target data format.
3. The method according to claim 2, characterized in that Identify target data, including: The source file and the history file are input into the difference algorithm of the version control system to obtain the target data.
4. The method according to claim 2 or 3, characterized in that: Performing format conversion processing on the target data according to the target data format to obtain patch data includes: Determine a mapping relationship according to the current data format and the target data format; The target data is format converted according to the mapping relationship to obtain the patch data.
5. The method according to any one of claims 1 to 4, characterized in that The patch data and the conversion file corresponding to the historical file are merged to obtain a target file, including: Determine the merger rules; According to the merging rule, merging the patch data with the conversion file corresponding to the historical file to obtain an intermediate file; Determine the context information of the target data from the source file and the history file; Performing verification processing on the intermediate file according to the context information to obtain a verification result, wherein the verification result includes verification passed or verification failed; If the verification result is that the verification is passed, the intermediate file is determined as the target file.
6. The method according to claim 5, characterized in that Determine the consolidation rules, including: Determining an update type between the source file and the history file from the version control system, the update type including at least one of the following: addition, deletion or modification; The merging rule is determined according to the update type.
7. The method according to any one of claims 1 to 6, characterized in that The conversion request includes a source address and a target address; the method further includes: Determine the file under the source address as the source file; Send the target file to the target address.
8. A file conversion device, characterized in that: include: A receiving module, used for receiving a conversion request, wherein the conversion request includes a source file and a target data format; a determination module, configured to determine, from a version control system, a history file and a conversion file corresponding to the history file according to the conversion request, and determine target data, wherein the history file is a file of a previous version of the source file, and the target data is a difference between the source file and the history file; A conversion module, used for performing format conversion processing on the target data according to the target data format to obtain patch data; The merging module is used to merge the patch data with the conversion file corresponding to the historical file to obtain a target file.
9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
11. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.
Citation Information
Patent Citations
Method and computer-readable medium for incremental data conversion using a synchronization information record
CN108885644A
Patch generation method and device
CN111008034A
Incremental data real-time synchronization method and device, electronic equipment and storage medium
CN114398333A
Incremental data conversion using a syncronization information record
US20170277592A1
Cited By
Data format conversion method, system and equipment and storage medium
CN119336830A
