[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN114860294A - Cross-version function code migration method, device and medium - Google Patents

Cross-version function code migration method, device and medium Download PDF

Info

Publication number
CN114860294A
CN114860294A CN202210461451.XA CN202210461451A CN114860294A CN 114860294 A CN114860294 A CN 114860294A CN 202210461451 A CN202210461451 A CN 202210461451A CN 114860294 A CN114860294 A CN 114860294A
Authority
CN
China
Prior art keywords
function
version
code
file
information
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
CN202210461451.XA
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202210461451.XA priority Critical patent/CN114860294A/en
Publication of CN114860294A publication Critical patent/CN114860294A/en
Pending legal-status Critical Current

Links

Images

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method, a device and a medium for migrating cross-version function codes, and relates to the technical field of computers. Acquiring first difference information of a code of a basic version and a code of a functional version, and acquiring second difference information of the code of the basic version and the code of a new version; the function version is a version which is developed based on the basic version and has function codes, and the new version is an updated version of the basic version; traversing the files in the first difference information, and marking the files according to the second difference information to obtain marking information; and migrating the function codes in the file to the new version according to the marking information so as to obtain the target version. Therefore, according to the scheme, different marking information is generated by comparing the new version code with the difference between the function code and the basic version code to determine the position of the function code in the new version, so that the function code is migrated to the new version, the workload of developers is reduced, and the development efficiency is improved.

Description

Cross-version function code migration method, device and medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a medium for migrating a cross-version function code.
Background
Migration of functional code is very common in project development, and is generally performed based on a basic version of code, and migration can be easily and successfully performed in a patch mode. After the basic version is upgraded, the function code developed based on the basic version needs to be migrated to the upgraded version, and the process is equivalent to secondary development of the development function. At present, when function codes are migrated between versions, manual comparison between high-version codes and basic-version codes is needed, and the function codes developed in the basic version are migrated into the high version.
However, if the file content is modified more and more complicated, the manual migration modification is easy to be omitted; and if the basic version is frequently upgraded, the function codes need to be continuously migrated by developers, so that the method is very complicated and boring, the time and energy of the developers are seriously wasted, and the efficiency is low.
In view of the foregoing problems, it is an urgent need to solve the above problems by those skilled in the art to design a method for migrating cross-version function codes.
Disclosure of Invention
The application aims to provide a method, a device and a medium for migrating cross-version function codes, and solves the problem of low efficiency of artificial code migration.
In order to solve the above technical problem, the present application provides a method for migrating a cross-version function code, including:
acquiring first difference information of a code of a basic version and a code of a functional version, and acquiring second difference information of the code of the basic version and the code of a new version; wherein the functional version is a version with functional code developed based on the base version, the new version being an updated version of the base version;
traversing the file in the first difference information, and marking the file according to the second difference information to obtain marking information;
and migrating the function codes in the file to the new version according to the marking information so as to obtain a target version.
Preferably, the marking the file according to the second difference information to obtain marking information includes:
if the file in the second difference information is not modified, the marking information of the file is first marking information;
if the file in the second difference information is modified, the mark information of the file is second mark information;
if the file in the second difference information is deleted, judging whether a newly added file exists in a directory of the file in the second difference information;
if so, the marking information of the file is third marking information;
if not, the marking information of the file is fourth marking information.
Preferably, the migrating the function codes in the file to the new version according to the marking information includes:
if the marking information of the file is the first marking information, directly migrating the function codes in the file to the new version;
if the mark information of the file is the second mark information, migrating the function codes in the file to the new version according to the function where the function codes in the file are located and the corresponding function in the second difference information;
if the mark information of the file is the third mark information, acquiring the code similarity of a function where the function code in the file in the basic version is located and a function in the newly added file in the second difference information; migrating the function codes in the file to the new version according to the code similarity;
and if the marking information of the file is the fourth marking information, the function code in the file is not migrated.
Preferably, the obtaining of the code similarity between the function of the function code in the file in the base version and the function in the newly added file in the second difference information includes:
acquiring a function of a function code in the basic version;
and calculating the similarity between the function and each function in the newly added file in the second difference information through the variable in the code of the function, the function call and the branch processing process.
Preferably, the migrating the function code in the file to the new version according to the function where the function code in the file is located and the corresponding function in the second difference information includes:
traversing the function where the function code in the file is located;
if the corresponding function in the second difference information is not changed, migrating the function code of the function to the new version;
if the corresponding function in the second difference information changes, acquiring a context code of the function code change in the corresponding function, and migrating the function code in the function to the new version according to the context code;
and if the corresponding function does not exist in the second difference information, traversing the newly added function in the second difference information, obtaining the code similarity of the newly added function and the corresponding function in the basic version, and migrating the function code in the file to the new version according to the code similarity.
Preferably, after the obtaining the target version, the method further includes:
verifying the migrated function codes in the target version;
judging whether the verification is successful;
if yes, confirming that the function code is successfully migrated;
and if not, modifying the wrong function code in the target version.
Preferably, after the confirming that the function code migration is successful, the method further includes:
and outputting the information that the function codes are successfully migrated.
In order to solve the above technical problem, the present application further provides a cross-version function code migration apparatus, including:
the acquisition module is used for acquiring first difference information of a code of a basic version and a code of a functional version and acquiring second difference information of the code of the basic version and the code of a new version; wherein the functional version is a version with functional code developed based on the base version, the new version being an updated version of the base version;
the traversal marking module is used for traversing the file in the first difference information and marking the file according to the second difference information to obtain marking information;
and the migration module is used for migrating the function codes in the file to the new version according to the marking information so as to obtain a target version.
In order to solve the above technical problem, the present application further provides another cross-version function code migration apparatus, including:
a memory for storing a computer program;
and the processor is used for realizing the steps of the cross-version function code migration method when the computer program is executed.
In order to solve the above technical problem, the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps of the cross-version function code migration method described above.
According to the method for migrating the cross-version function codes, the first difference information of the codes of the basic version and the codes of the function version is obtained, and the second difference information of the codes of the basic version and the codes of the new version is obtained; the function version is a version which is developed based on the basic version and has function codes, and the new version is an updated version of the basic version; traversing the files in the first difference information, and marking the files according to the second difference information to obtain marking information; and migrating the function codes in the file to the new version according to the marking information so as to obtain the target version. Therefore, according to the scheme, different marking information is generated by comparing the new version code with the difference between the function code and the basic version code to determine the position of the function code in the new version, so that the function code is migrated to the new version, the workload of developers is reduced, and the development efficiency is improved.
In addition, the embodiment of the application also provides a cross-version function code migration device and a computer readable storage medium, and the effect is the same as that of the cross-version function code migration device.
Drawings
In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of a cross-version function code migration method according to an embodiment of the present application;
fig. 2 is a flowchart of function code migration under different marking information according to an embodiment of the present application;
fig. 3 is a flowchart of a context function code migration according to second flag information provided in an embodiment of the present application;
FIG. 4 is a flowchart of another cross-version function code migration method provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a cross-version function code migration apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another cross-version function code migration apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any creative effort belong to the protection scope of the present application.
The core of the application is to provide a method, a device and a medium for migrating cross-version function codes.
In order that those skilled in the art will better understand the disclosure, the following detailed description will be given with reference to the accompanying drawings.
The migration of the function codes is very common in project development, after the basic version is upgraded, the function codes developed based on the basic version need to be migrated to the upgraded version, and the process is equivalent to secondary development of development functions. At present, when function codes are migrated between different versions, the high-version codes and the basic-version codes need to be manually contrasted, and the function codes developed in the basic version are migrated into the high version. However, if the file content is modified more and more complicated, the manual migration modification is easy to be missed; and if the basic version is frequently upgraded, the function codes need to be continuously migrated by developers, which is very tedious and boring, seriously wastes the time and energy of the developers and has low efficiency, so that the method for migrating the cross-version function codes is provided. Fig. 1 is a flowchart of a cross-version function code migration method according to an embodiment of the present application. As shown in fig. 1, includes:
s10: acquiring first difference information of a code of a basic version and a code of a functional version, and acquiring second difference information of the code of the basic version and the code of a new version; the function version is a version developed based on the basic version and provided with function codes, and the new version is an updated version of the basic version.
S11: and traversing the file in the first difference information, and marking the file according to the second difference information to obtain marking information.
S12: and migrating the function codes in the file to the new version according to the marking information so as to obtain the target version.
It is to be understood that the function version is a version with a specific function developed based on the base version, and the new version is a version after update and upgrade are performed on the base version. If the basic version is upgraded to a new version, the function codes developed based on the basic version need to be migrated to the upgraded new version, that is, the function codes of the function version are migrated to the new version, and finally the target version with the function codes is obtained.
Therefore, it is first required to determine what function codes of the function version are, and what the new version is different from the base version; namely, first difference information of the code of the base version and the code of the function version is obtained, and second difference information of the code of the base version and the code of the new version is obtained. Specifically, the first difference information and the second difference information of the function version and the new version compared with the base version may be obtained through diff operation in the Linux system, or the difference information may be obtained in other manners, which is not limited in this embodiment and is determined according to a specific implementation situation.
And traversing the files in the first difference information after the two difference information are obtained, and marking the files according to the second difference information to obtain the marked information. It can be understood that, since a file in the second difference information corresponding to the file in the first difference information may be changed in the update of the base version, for example, the file is modified or deleted, the function code of the file in the first difference information cannot be directly migrated into the new version, but the file in the first difference information is marked according to the second difference information, and different states of the file are marked differently to determine the position of the function code in the new version, and thus determine the specific migration manner of the function code. The specific acquisition manner of the mark information in this embodiment is not limited, and is determined according to a specific implementation situation.
And after different marking information is obtained, migrating the function codes in the file to a new version according to the marking information so as to obtain a target version. It can be understood that, because different marks exist in the process of marking the file, different migration modes can be adopted for the function code according to different mark information in the process of migrating the function code, so that the function code is smoothly migrated to a new version. In this embodiment, a specific migration manner of the function code is not limited, and is determined according to a specific implementation situation.
In the embodiment, first difference information of a code of a basic version and a code of a functional version is obtained, and second difference information of the code of the basic version and the code of a new version is obtained; the function version is a version which is developed based on the basic version and has function codes, and the new version is an updated version of the basic version; traversing the files in the first difference information, and marking the files according to the second difference information to obtain marking information; and migrating the function codes in the file to the new version according to the marking information so as to obtain the target version. Therefore, according to the scheme, different marking information is generated by comparing the new version code with the difference between the function code and the basic version code to determine the position of the function code in the new version, so that the function code is migrated to the new version, the workload of developers is reduced, and the development efficiency is improved.
On the basis of the above-described embodiment:
as a preferred embodiment, marking the file according to the second difference information to obtain the marking information includes:
if the file in the second difference information is not modified, the marking information of the file is the first marking information;
if the file in the second difference information is modified, the marking information of the file is second marking information;
if the file in the second difference information is deleted, judging whether a newly added file exists in the directory of the file in the second difference information;
if so, the marking information of the file is third marking information;
if not, the marking information of the file is fourth marking information.
In the above embodiments, the specific obtaining manner of the mark information is not limited, and is determined according to the specific implementation situation. As a preferred embodiment, in this embodiment, the specific manner of acquiring the mark information is as follows:
and traversing the files in the first difference information, and judging the state of each file according to the second difference information. Specifically, it is determined whether the file is modified in the second difference information. If the file in the second difference information is not modified, the marking information of the file is the first marking information; if the file in the second difference information is modified, the flag information of the file is the second flag information. If the file in the second difference information is deleted, judging whether a newly added file exists in the directory of the file in the second difference information; if the newly added file exists, the marking information of the file is third marking information; and if the newly added file does not exist in the directory, the marking information of the file is fourth marking information.
In this embodiment, the state of the file of the first difference information in the second difference information is determined, so that the label information of different files is obtained, and the function codes in the files are migrated according to the label information.
On the basis of the above-described embodiment:
as a preferred embodiment, migrating the function code in the file to the new version according to the marking information includes:
if the marking information of the file is the first marking information, directly migrating the function codes in the file to a new version;
if the marking information of the file is the second marking information, migrating the function codes in the file to a new version according to the function where the function codes in the file are located and the corresponding function in the second difference information;
if the mark information of the file is the third mark information, acquiring the code similarity of the function code in the file in the basic version and the function in the newly added file in the second difference information; migrating the function codes in the file to a new version according to the code similarity;
and if the marking information of the file is the fourth marking information, the function codes in the file are not migrated.
In the above embodiments, the specific migration manner of the function code is not limited, and is determined according to the specific implementation situation. As a preferred embodiment, in this embodiment, the function code is migrated according to the flag information of the file.
Fig. 2 is a flowchart of function code migration under different label information according to an embodiment of the present application. As shown in fig. 2, specifically, the flag information of the file is traversed, and if the flag information of the file is the first flag information, that is, the file is not modified, it is considered that the function code in the file can be directly migrated to the new version.
If the marking information of the file is the second marking information, namely the file is modified, the function codes in the file need to be selectively migrated to a new version; specifically, the function code in the file is migrated to the new version according to the function in which the function code in the file is located and the corresponding function in the second difference information. It should be noted that, in the process of obtaining a new version based on the base version, a file containing the function code may be modified, and a function in which the function code is located in the file may also be modified; therefore, in the above process, the function code needs to be migrated according to different situations of the function. In this embodiment, a specific process of migrating the function code according to the function where the function code is located and the corresponding function in the second difference information is not limited, and is determined according to a specific implementation situation.
If the mark information of the file is the third mark information, that is, the file in the second difference information is deleted, but a new file exists in the file directory. Acquiring the code similarity of the function code in the file in the basic version and the function in the newly added file in the second difference information; and migrating the function codes in the file to the new version according to the code similarity. In this embodiment, the code similarity obtaining manner is not limited, and is determined according to a specific implementation situation.
If the flag information of the file is the fourth flag information, that is, the file in the second difference information is deleted, and no new file exists in the file directory, it is determined that the function code of the file does not need to be migrated. And migrating the function codes in sequence according to the marking information of the files until the marking information of all the files is traversed.
In this embodiment, the function codes in the file are migrated to the new version according to the four kinds of flag information, and different migration modes are adopted according to different states of the file, so that migration of the function codes is realized.
On the basis of the above-described embodiment:
as a preferred embodiment, the obtaining of the code similarity between the function in the file in the base version and the function in the newly added file in the second difference information includes:
acquiring a function of the function code in the basic version;
and calculating the similarity between the function and each function in the newly added file in the second difference information through the variable in the code of the function, the function call and the branch processing process.
In the above embodiments, the code similarity obtaining manner is not limited, and is determined according to specific implementation situations. As a preferred embodiment, in this embodiment, a function of the function code in the base version is first obtained, and the similarity between the function and each function in the newly added file in the second difference information is calculated through variables in the code of the function, function calls, and branch processing procedures.
It is understood that the similarity of the judgment codes can be judged through the processes of variable definition, function call, branch processing, variable operation and the like. Since the position of the variable definition is variable, and under the framework of function call and branch processing determination, the variable operation has little influence on the function code. Therefore, the code block similarity can be verified and confirmed according to the flow of function calling and branch processing in the code. Here, assuming that the Code block of the function in the newly added file in the second difference information is Code1, and the Code block of the function where the function Code in the file is located is Code2, the specific checking process of the Code similarity is as follows:
traversing the Code1, and if the Code1 is a variable, continuing traversing; if Code1 is a function call or branch handling, all locations in Code2 where the function or branch handling was called are found and recorded, and if Code2 does not call the function or handle the branch, the two pieces of Code are considered dissimilar.
If there is a call to the function or a transaction to the branch in Code2, then the two pieces of Code are considered similar and the traversal of Code1 continues. If Code1 is a function call or branch handling, the location recorded by the function call or branch handling in Code2 is traversed to verify whether the location is followed by the corresponding function or branch in Code 1. If not, then the next location of the function call or branch process record in Code2 is traversed.
If all the positions have no corresponding function call or branch processing, the two sections of codes are considered to be dissimilar. If so, the above process is repeated until the Code1 Code traversal is completed, and the two pieces of Code are considered similar.
In the embodiment, by acquiring the function of the function code in the basic version; and calculating the similarity between the function and each function in the newly added file in the second difference information through the variable, function call and branch processing process in the code of the function, so that the calculation of the code similarity is realized, and the subsequent migration of the function code is facilitated.
On the basis of the above-described embodiment:
as a preferred embodiment, migrating the function code in the file to the new version according to the function in which the function code in the file is located and the corresponding function in the second difference information includes:
traversing the function where the function code in the file is located;
if the corresponding function in the second difference information is not changed, migrating the function code of the function to a new version;
if the corresponding function in the second difference information changes, acquiring a context code corresponding to the function code change in the function, and migrating the function code in the function to a new version according to the context code;
and if the corresponding function does not exist in the second difference information, traversing the newly added function in the second difference information, acquiring the code similarity of the newly added function and the corresponding function in the basic version, and migrating the function code in the file to the new version according to the code similarity.
In the above embodiment, the specific process of migrating the function code according to the function where the function code is located and the corresponding function in the second difference information is not limited, and is determined according to the specific implementation situation. Fig. 3 is a flowchart of a context function code migration according to second flag information provided in an embodiment of the present application. As a preferred embodiment, in this embodiment, as shown in fig. 3, a specific process of migrating the function code according to the function where the function code is located is as follows:
and traversing the function where the function code in the file is located, and when the corresponding function can be found in the file of the second difference information, if the function of the file corresponding to the second difference information is not changed, directly migrating the function code in the function to the corresponding file of the new version.
If the function of the file corresponding to the second difference information changes, acquiring a context code of the function code change in the corresponding function, and if the corresponding upper code position can be found in the corresponding function of the second difference information, migrating the corresponding function code to be below the upper position; if the corresponding context code position can be found in the corresponding function of the second difference information, the corresponding function code is migrated to the context position; if the corresponding context code positions can be found simultaneously in the corresponding functions of the second difference information, the corresponding function codes are migrated between the context positions; and if the corresponding context code position cannot be found in the corresponding function of the second difference information, the part of the function code is not migrated.
And traversing the newly added function in the file of the second difference information and calculating the code similarity between the newly added function and the corresponding function in the basic version if the corresponding function cannot be found in the file of the second difference information. The code similarity is calculated in the same manner as in the above-described embodiment. If the code is similar to the code, the code can be migrated; and because the file function is changed, executing the step, and migrating the corresponding function code in a mode of acquiring the context code of the function code change. If not, the functional code is not migrated.
It should be noted that, since the acquisition of the code similarity is also involved in the function code migration process in which the flag information of the file is the third flag information, the migration manner after the code similarity is acquired is consistent with the function code migration process of the second flag information, and the corresponding function code is also migrated by acquiring the context code of the function code change.
In this embodiment, the function code of the function in which the file is located is migrated to the new version according to different conditions of the corresponding function in the second difference information, so that migration of the function code under the second flag information is realized.
Fig. 4 is a flowchart of another cross-version function code migration method according to an embodiment of the present application.
As shown in fig. 4, after obtaining the target version, the method further includes:
s13: and verifying the migrated function codes in the target version.
S14: judging whether the verification is successful; if yes, go to step S15; if not, the process proceeds to step S16.
S15: and confirming that the function code is successfully migrated.
S16: the incorrect function code in the target version is modified.
It will be appreciated that the target version is obtained after migration of the completed function code to the new version. After the target version is obtained, it is also necessary to confirm whether the function code is migrated successfully. Therefore, the migrated function codes in the target version are verified, and whether verification is successful or not is judged. The verification method may be various, and is not limited in this embodiment, and is determined according to a specific implementation situation. And when the verification is successful, confirming that the function code is successfully migrated. And when the verification fails, the function code migration is considered to have an error, and the wrong function code in the target version needs to be modified. The modification method may actively search for and modify the function code of the error portion, or select another modification method, which is not limited in this embodiment and depends on the specific implementation.
In this embodiment, by verifying the migrated function code in the target version, the wrong function generation is completed, and a final target version is formed.
As shown in fig. 4, after confirming that the function code migration is successful, the method further includes:
s17: and outputting the information that the function codes are successfully migrated.
It can be understood that after the function code in the target version is confirmed to be successfully migrated, the information that the function code is successfully migrated is output to prompt the user that the function code migration is completed, so that the user can conveniently perform subsequent operations on the target version.
In the foregoing embodiments, the cross-version function code migration method is described in detail, and the present application also provides embodiments corresponding to the cross-version function code migration apparatus. It should be noted that the present application describes the embodiments of the apparatus portion from two perspectives, one is based on the functional module, and the other is based on the hardware structure.
Fig. 5 is a schematic structural diagram of a cross-version function code migration apparatus according to an embodiment of the present application. As shown in fig. 5, the cross-version function code migration apparatus includes:
the acquiring module 10 is configured to acquire first difference information between a code of a base version and a code of a function version, and acquire second difference information between the code of the base version and the code of a new version; the function version is a version with function codes developed based on the basic version, and the new version is an updated version of the basic version.
And the traversal marking module 11 is configured to traverse the file in the first difference information, and mark the file according to the second difference information to obtain mark information.
And the migration module 12 is configured to migrate the function code in the file to the new version according to the marking information, so as to obtain the target version.
Since the embodiments of the apparatus portion and the method portion correspond to each other, please refer to the description of the embodiments of the method portion for the embodiments of the apparatus portion, which is not repeated here.
Fig. 6 is a schematic structural diagram of another cross-version function code migration apparatus according to an embodiment of the present application, and as shown in fig. 6, the cross-version function code migration apparatus includes:
a memory 20 for storing a computer program;
a processor 21 for implementing the steps of the method of cross-version function code migration as mentioned in the above embodiments when executing the computer program.
The cross-version function code migration apparatus provided in this embodiment may include, but is not limited to, a smart phone, a tablet computer, a notebook computer, or a desktop computer.
The processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The Processor 21 may be implemented in hardware using at least one of a Digital Signal Processor (DSP), a Field-Programmable Gate Array (FPGA), and a Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 21 may be integrated with a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 21 may further include an Artificial Intelligence (AI) processor for processing computational operations related to machine learning.
The memory 20 may include one or more computer-readable storage media, which may be non-transitory. Memory 20 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used for storing the following computer program 201, wherein after being loaded and executed by the processor 21, the computer program can implement the relevant steps of the cross-version function code migration method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202, data 203, and the like, and the storage manner may be a transient storage manner or a permanent storage manner. Operating system 202 may include, among other things, Windows, Unix, Linux, etc. Data 203 may include, but is not limited to, data involved with cross-version function code migration methods.
In some embodiments, the cross-version function code migration apparatus may further include a display 22, an input/output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
Those skilled in the art will appreciate that the architecture shown in FIG. 6 does not constitute a limitation of a cross-version function code migration apparatus and may include more or fewer components than those shown.
Finally, the application also provides a corresponding embodiment of the computer readable storage medium. The computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps as set forth in the above-mentioned method embodiments.
It is to be understood that if the method in the above embodiments is implemented in the form of software functional units and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium and executes all or part of the steps of the methods described in the embodiments of the present application, or all or part of the technical solutions. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The method, the device and the medium for migrating the cross-version function codes provided by the application are described in detail above. The embodiments are described in a progressive mode in the specification, the emphasis of each embodiment is on the difference from the other embodiments, and the same and similar parts among the embodiments can be referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.

Claims (10)

1. A cross-version function code migration method is characterized by comprising the following steps:
acquiring first difference information of a code of a basic version and a code of a functional version, and acquiring second difference information of the code of the basic version and the code of a new version; wherein the functional version is a version with functional code developed based on the base version, the new version being an updated version of the base version;
traversing the file in the first difference information, and marking the file according to the second difference information to obtain marking information;
and migrating the function codes in the file to the new version according to the marking information so as to obtain a target version.
2. The method for migrating cross-version functional code according to claim 1, wherein the marking the file according to the second difference information to obtain marking information comprises:
if the file in the second difference information is not modified, the marking information of the file is first marking information;
if the file in the second difference information is modified, the mark information of the file is second mark information;
if the file in the second difference information is deleted, judging whether a newly added file exists in a directory of the file in the second difference information;
if so, the marking information of the file is third marking information;
if not, the marking information of the file is fourth marking information.
3. The method for migrating cross-version function codes according to claim 2, wherein the migrating function codes in the file to the new version according to the marking information comprises:
if the marking information of the file is the first marking information, directly migrating the function codes in the file to the new version;
if the mark information of the file is the second mark information, migrating the function codes in the file to the new version according to the function where the function codes in the file are located and the corresponding function in the second difference information;
if the mark information of the file is the third mark information, acquiring the code similarity of a function where the function code in the file in the basic version is located and a function in the newly added file in the second difference information; migrating the function codes in the file to the new version according to the code similarity;
and if the marking information of the file is the fourth marking information, the function code in the file is not migrated.
4. The method for migrating cross-version function codes according to claim 3, wherein the obtaining of the code similarity between the function in which the function code in the file in the base version is located and the function in the newly added file in the second difference information includes:
acquiring a function of a function code in the basic version;
and calculating the similarity between the function and each function in the newly added file in the second difference information through the variable in the code of the function, the function call and the branch processing process.
5. The method for migrating cross-version function codes according to claim 3, wherein migrating the function codes in the file to the new version according to the function where the function codes in the file are located and the corresponding function in the second difference information comprises:
traversing the function where the function code in the file is located;
if the corresponding function in the second difference information is not changed, migrating the function code of the function to the new version;
if the corresponding function in the second difference information changes, acquiring a context code of the function code change in the corresponding function, and migrating the function code in the function to the new version according to the context code;
and if the corresponding function does not exist in the second difference information, traversing the newly added function in the second difference information, obtaining the code similarity of the newly added function and the corresponding function in the basic version, and migrating the function code in the file to the new version according to the code similarity.
6. The method for migrating cross-version functional code according to claim 3, further comprising, after the obtaining the target version:
verifying the migrated function codes in the target version;
judging whether the verification is successful;
if yes, confirming that the function code is successfully migrated;
and if not, modifying the wrong function code in the target version.
7. The cross-version function code migration method according to claim 3, further comprising, after the confirming that the function code migration is successful:
and outputting the information that the function codes are successfully migrated.
8. An apparatus for cross-version function code migration, comprising:
the acquisition module is used for acquiring first difference information of a code of a basic version and a code of a functional version and acquiring second difference information of the code of the basic version and the code of a new version; wherein the functional version is a version with functional code developed based on the base version, the new version being an updated version of the base version;
the traversal marking module is used for traversing the file in the first difference information and marking the file according to the second difference information to obtain marking information;
and the migration module is used for migrating the function codes in the file to the new version according to the marking information so as to obtain a target version.
9. An apparatus for cross-version function code migration, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the cross-version functional code migration method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, carries out the steps of the cross-version functionality code migration method according to any one of claims 1 to 7.
CN202210461451.XA 2022-04-28 2022-04-28 Cross-version function code migration method, device and medium Pending CN114860294A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210461451.XA CN114860294A (en) 2022-04-28 2022-04-28 Cross-version function code migration method, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210461451.XA CN114860294A (en) 2022-04-28 2022-04-28 Cross-version function code migration method, device and medium

Publications (1)

Publication Number Publication Date
CN114860294A true CN114860294A (en) 2022-08-05

Family

ID=82633820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210461451.XA Pending CN114860294A (en) 2022-04-28 2022-04-28 Cross-version function code migration method, device and medium

Country Status (1)

Country Link
CN (1) CN114860294A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118519674A (en) * 2024-05-13 2024-08-20 北京长擎软件有限公司 System difference data acquisition method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118519674A (en) * 2024-05-13 2024-08-20 北京长擎软件有限公司 System difference data acquisition method and device

Similar Documents

Publication Publication Date Title
CN111596863B (en) Data reading method, device and equipment and readable storage medium
US10489591B2 (en) Detection system and method thereof
CN110427215A (en) A kind of program version mRNA differential display mRNA method and device applied to front end exploitation
US20070239774A1 (en) Migration of database using serialized objects
CN107463485B (en) Method stack-based log acquisition method and device and terminal
WO2019041891A1 (en) Method and device for generating upgrade package
CN114860294A (en) Cross-version function code migration method, device and medium
CN108694049B (en) Method and equipment for updating software
CN114780173B (en) Method for loading plug-in application, computing device and storage medium
CN115599437A (en) Software version processing method and device, electronic equipment and storage medium
CN113741931B (en) Software upgrading method and device, electronic equipment and readable storage medium
CN115269021A (en) Operation processing method, device and medium for network card
US11573772B2 (en) Mechanism for information propagation and resolution in graph-based programming languages
CN112685040B (en) Method, device, equipment and storage medium for generating interface file in android system
CN104298618A (en) Instruction processing method and device for intelligent terminal
CN109766125B (en) Identification method and device for leveling conflict among batches
CN114816772B (en) Debugging method, debugging system and computing device for application running based on compatible layer
CN107562423B (en) UI page development method and device
CN110765008A (en) Data processing method and device
CN114840198A (en) Function execution method, building block function rewriting method and related equipment
CN113901025A (en) Database management method, device, equipment and storage medium
CN115167822A (en) Branch code merging method, device, equipment and storage medium
CN108920216B (en) Method, device, terminal and storage medium for closing software compatible mode
CN113703753A (en) Method and device for product development and product development system
CN113590224B (en) Method and device for detecting server, electronic equipment and storage medium

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