Code processing method and device, equipment, storage medium and product
By configuring scripts in the terminal device, the local code is automatically stored and restored, and merged when the server downloads the latest code. This solves the problem of low code processing efficiency caused by developers' manual operations in the existing technology, and achieves a more efficient Code merge processing.
Patent Information
- Application Number
- CN202410596156.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-14
- Publication Date
- 2024-08-30
AI Technical Summary
In the existing technology, developers need to manually save and restore local code, resulting in low code processing efficiency.
By configuring a script in the terminal device, the local code is automatically stored and restored. When the server downloads the latest code, the script is used to merge the local code and the latest code to generate the target code.
It improves the efficiency of code processing, reduces the manual steps for developers, and improves the automation of code merging processing.
Smart Images

Figure CN118567620A
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data, and in particular to a code processing method, device, equipment, storage medium and product. Background Art
[0002] Developers can edit codes and download codes from servers through software tools (eg, GIT tools).
[0003] In the related art, when a developer is editing local code through a software tool, if the developer needs to download the latest code from a server, the developer needs to manually save the local code and then download the latest code from the server. After downloading the latest code, the developer needs to manually restore the saved local code to the software tool and merge the latest code and the local code in the software tool.
[0004] However, in the above process, since the developer is required to manually save the local code and manually restore the local code to the software tool, the efficiency of code processing is low. Summary of the invention
[0005] The present application provides a code processing method, apparatus, device, storage medium and product to solve the technical problem that developers need to manually save local code and manually restore local code to software tools, resulting in low efficiency in code processing.
[0006] In a first aspect, the present application provides a code processing method, comprising:
[0007] Get a code acquisition request, which is used to request to obtain the latest code from the server;
[0008] According to the code acquisition request, local code is stored in a first storage space through a first script, and the latest code is acquired from a server, where the local code is code that is not cached and has not been submitted to the server;
[0009] When it is detected that the latest code has been obtained, the local code is obtained in the first storage space through the second script, and the local code and the latest code are merged to obtain the target code.
[0010] In a possible implementation method, according to the code acquisition request, storing the local code in the first storage space by using the first script includes:
[0011] According to the code acquisition request, determine whether there is local code that is not cached and not submitted to the server;
[0012] When it is determined that there is local code that is not cached and not submitted to the server, the first script is called to store the local code in the first storage space through the first script.
[0013] In a possible implementation method, judging whether there is local code that is not cached and not submitted to the server according to the code acquisition request includes:
[0014] According to the code acquisition request, determine whether there is code in the code editing window;
[0015] If so, the code status of the code in the code editing window is obtained, and if the code status is an uncached state, it is determined that there is local code, and if the code status is a cached state, it is determined that there is no local code;
[0016] If not, it is determined that no native code exists.
[0017] In a possible implementation method, calling a first script to store the local code in a first storage space through the first script includes:
[0018] Determine a first space size of storage space required for the local code by using a first script;
[0019] Determine a first storage space according to the storage space size, wherein the space size of the first storage space is greater than or equal to the first space size;
[0020] The spatial position of the first storage space is determined, and the first script is executed according to the spatial position to store the local code in the first storage space.
[0021] In a possible implementation method, the local code is the code displayed in the code editing window; after the local code is stored in the first storage space by the first script, the method further includes:
[0022] Suppresses display of local code in the code editing window.
[0023] In a possible implementation method, after detecting that the latest code has been obtained, obtaining the local code in the first storage space through the second script includes:
[0024] Determine the download status of the latest code, which is either incomplete or completed;
[0025] When the downloading status is the completed status, the second script is called to determine the spatial position of the first storage space through the second script, and obtain the local code in the first storage space according to the spatial position.
[0026] In a possible implementation method, the local code and the latest code are merged to obtain the target code, including:
[0027] Determine the overlapping codes in the local code and the latest code, wherein the local code and the latest code respectively include the overlapping codes;
[0028] Determine the other codes in the local code except the coincident code as the first difference code, and determine the other codes in the latest code except the coincident code as the second difference code;
[0029] A target code is determined according to the coincidence code, the first difference code and the second difference code.
[0030] In a possible implementation method, determining a target code according to the coincidence code, the first difference code, and the second difference code includes:
[0031] Determining version numbers of the first difference code and the second difference code;
[0032] According to the version numbers of the first difference code and the second difference code, determining a target difference code from the first difference code and the second difference code, wherein the version number of the target difference code is the latest;
[0033] The overlapped code and the target difference code are combined to obtain the target code.
[0034] In a possible implementation method, after merging the local code and the latest code to obtain the target code, the method further includes:
[0035] Displays the target code in the code editing window.
[0036] In a second aspect, the present application provides a code processing device, the device comprising: an acquisition module, a first calling module and a second calling module, wherein:
[0037] The acquisition module is used to obtain a code acquisition request, and the code acquisition request is used to request to obtain the latest code from the server;
[0038] The first calling module is used to, according to the code acquisition request, store the local code in the first storage space through the first script, and obtain the latest code from the server, where the local code is the code that is not cached and not submitted to the server;
[0039] The second calling module is used to, upon detecting that the latest code has been obtained, obtain the local code in the first storage space through the second script, and merge the local code and the latest code to obtain the target code.
[0040] In a possible implementation, the first calling module is specifically used to:
[0041] According to the code acquisition request, determine whether there is local code that is not cached and not submitted to the server;
[0042] When it is determined that there is local code that is not cached and not submitted to the server, the first script is called to store the local code in the first storage space through the first script.
[0043] In a possible implementation, the first calling module is specifically used to:
[0044] According to the code acquisition request, determine whether there is code in the code editing window;
[0045] If so, the code status of the code in the code editing window is obtained, and if the code status is an uncached state, it is determined that there is local code, and if the code status is a cached state, it is determined that there is no local code;
[0046] If not, it is determined that no native code exists.
[0047] In a possible implementation, the first calling module is specifically used to:
[0048] Determine a first space size of storage space required for the local code by using a first script;
[0049] Determine a first storage space according to the storage space size, wherein the space size of the first storage space is greater than or equal to the first space size;
[0050] The spatial position of the first storage space is determined, and the first script is executed according to the spatial position to store the local code in the first storage space.
[0051] In a possible implementation, the first calling module is further configured to:
[0052] Suppresses display of local code in the code editing window.
[0053] In a possible implementation, the second calling module is specifically used to:
[0054] Determine the download status of the latest code, which is either incomplete or completed;
[0055] When the downloading status is the completed status, the second script is called to determine the spatial position of the first storage space through the second script, and obtain the local code in the first storage space according to the spatial position.
[0056] In a possible implementation, the second calling module is specifically used to:
[0057] Determine the overlapping codes in the local code and the latest code, wherein the local code and the latest code respectively include the overlapping codes;
[0058] Determine the other codes in the local code except the coincident code as the first difference code, and determine the other codes in the latest code except the coincident code as the second difference code;
[0059] A target code is determined according to the coincidence code, the first difference code and the second difference code.
[0060] In a possible implementation, the second calling module is specifically used to:
[0061] Determining version numbers of the first difference code and the second difference code;
[0062] According to the version numbers of the first difference code and the second difference code, determining a target difference code from the first difference code and the second difference code, wherein the version number of the target difference code is the latest;
[0063] The overlapped code and the target difference code are combined to obtain the target code.
[0064] In a possible implementation, the second calling module is further configured to:
[0065] Displays the target code in the code editing window.
[0066] In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0067] Memory stores computer-executable instructions;
[0068] The processor executes the computer-executable instructions stored in the memory to implement the method involved in the first aspect and any possible implementation manner.
[0069] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by an electronic device, they are used to implement the method involved in the first aspect and any possible implementation method.
[0070] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the method involved in the first aspect and any possible implementation manner.
[0071] The present application provides a code processing method, apparatus, device, storage medium and product. The terminal device can obtain a code acquisition request, and the code acquisition request is used to request to obtain the latest code from the server. According to the code acquisition request, the local code is stored in the first storage space through the first script, and the latest code is obtained from the server. The local code is the code that is not cached and not submitted to the server. When it is detected that the latest code has been obtained, the local code is obtained in the first storage space through the second script, and the local code and the latest code are merged to obtain the target code, thereby improving the code processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] 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.
[0073] Figure 1 A system architecture diagram for code acquisition provided in an embodiment of the present application;
[0074] Figure 2 A flowchart of a code processing method provided in an embodiment of the present application;
[0075] Figure 3 A flowchart of another code processing method provided in an embodiment of the present application;
[0076] Figure 4 A schematic diagram of an interface for script configuration provided in an embodiment of the present application;
[0077] Figure 5 A schematic diagram of the structure of a code acquisition device provided in an embodiment of the present application;
[0078] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0079] 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
[0080] 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.
[0081] Figure 1 This is a system architecture diagram provided for the embodiment of this application. Figure 1, including a terminal device 101 and a server 102. The terminal device 101 may be a local device of a developer. The terminal device 101 may be provided with a software tool, through which a user can edit code and download code from a server. The terminal device 101 includes a first storage space and a second storage space, the first storage space being used to store local code, and the second storage space being used to temporarily store code waiting to be merged. The server 102 may store the latest code, and the terminal device 101 may obtain the latest code from the server 102. After the terminal device 101 obtains the latest code, it may also merge the latest code with the local code.
[0082] In the related art, when a developer is editing a local code through a software tool, if the developer needs to download the latest code from the server, the developer needs to manually save the local code and then download the latest code from the server. After downloading the latest code, the developer needs to manually restore the saved local code to the software tool and merge the latest code and the local code in the software tool. However, in the above process, since the developer needs to manually save the local code and manually restore the local code to the software tool, the efficiency of code processing is low.
[0083] In an embodiment of the present application, a script can be configured in advance. During the process of downloading the latest code from the server, the local code can be automatically stored and restored through the script. There is no need for the developer to manually save the local code and manually restore the local code to the software tool, thereby improving the efficiency of code processing.
[0084] 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.
[0085] Figure 2 is a flowchart of a code processing method provided in an embodiment of the present application. Figure 2 As shown, the method may include the following steps:
[0086] S201, obtaining a code acquisition request.
[0087] The execution subject of the embodiment of the present application may be a terminal device, or a code processing device arranged in the terminal device. The code processing device may be implemented by software, or by a combination of software and hardware.
[0088] The code acquisition request is used to request to obtain the latest code from the server.
[0089] The latest code can be the code uploaded to the server by other developers.
[0090] A code repository can be set up in the server, and the code repository can be used to store the code uploaded by the developer. Correspondingly, the code acquisition request is used to request the latest code in the code repository of the server.
[0091] The terminal device may be provided with a software tool, and a download icon may be provided in the software tool. When the user needs to download the latest code from the server, the user may click the download icon. After the terminal device detects that the download icon is clicked, a code acquisition request is generated.
[0092] S202: According to the code acquisition request, store the local code in the first storage space through the first script, and obtain the latest code from the server.
[0093] The local code is the code in the editing state in the code editing box of the software tool, that is, the local code is the code that is not cached and not submitted to the server.
[0094] The first storage space is a storage space in the terminal device, and the first storage space can be used to store local codes.
[0095] The first script is a script pre-configured in the terminal device. After obtaining the code acquisition request, the first script can be called to start running the first script. By running the first script, the local code can be stored in the first storage space, and the latest code can be downloaded from the server. After the local code is stored in the first storage space, the latest code can be downloaded from the server.
[0096] Optionally, after obtaining the code acquisition request, it is also possible to determine whether the local code in the editing state exists, and when it is determined that the local code in the editing state exists, the first script is called. In this way, when the local code does not exist, calling the first script can be avoided, thereby saving resources.
[0097] S203: If it is detected that the latest code has been obtained, the local code is obtained in the first storage space through the second script, and the local code and the latest code are merged to obtain the target code.
[0098] The second script is a script pre-configured in the terminal device.
[0099] The download status of the latest code can be obtained in real time. When the download status of the latest code is completed, the second script can be called to start running the second script. By running the second script, the local code can be obtained in the first storage space, and the local code and the latest code are merged to obtain the target code.
[0100] After obtaining the target code, the target code can also be displayed in the code editing window of the software tool.
[0101] In an embodiment of the present application, when it is necessary to obtain the latest code from the server, the local code can be stored through the first script and the latest code can be obtained from the server. After the latest code is obtained, the stored local code can be obtained through the second script, and the local code and the latest code are merged to obtain the target code. In the above process, by configuring the script in advance, in the process of downloading the latest code from the server, the local code can be automatically stored and restored through the script, without the need for the developer to manually save the local code and manually restore the local code to the software tool, thereby improving the efficiency of code processing.
[0102] Figure 3 A flowchart of another code processing method provided in an embodiment of the present application. Figure 3 As shown, the method may include the following steps:
[0103] S301: Obtain a code acquisition request.
[0104] The code acquisition request is used to request to obtain the latest code from the server.
[0105] It should be noted that the execution process of S301 can refer to S201 and will not be described in detail here.
[0106] S302: According to the code acquisition request, it is determined whether there is local code that is not cached and not submitted to the server.
[0107] The local code is located in the code editing window of the software tool. The local code is the code that is not cached to the storage space of the terminal device and is not submitted to the server.
[0108] Whether there is local code can be determined in the following way: based on the code acquisition request, determine whether there is code in the code editing window; if so, obtain the code status of the code in the code editing window, if the code status is an uncached state, it is determined that there is local code, if the code status is a cached state, it is determined that there is no local code; if not, it is determined that there is no local code.
[0109] The code editing window is a window in the software tool for users to edit codes. The code status of the code in the code editing window includes a cached state and an uncached state. The cached state is used to indicate that the code in the code editing window has been cached to the storage space of the terminal device, and the uncached state is used to indicate that the code in the code editing window has not been cached to the storage space of the terminal device.
[0110] If it is determined that there is local code that is not cached and not submitted to the server, S303 is executed.
[0111] It should be noted that if it is determined that there is no local code that is not cached and not submitted to the server, the latest code can be obtained from the server in a conventional manner.
[0112] S303: When it is determined that there is local code that is not cached and not committed, determine a first space size of a storage space required for the local code by using a first script.
[0113] The first space size is the space size required to store the local code.
[0114] For example, the first space size may be 100KB, 3M, etc.
[0115] S304: Determine a first storage space according to the size of the storage space.
[0116] The space size of the first storage space is greater than or equal to the first space size.
[0117] In order to ensure that the local code can be normally stored in the first storage space, the space size of the first storage space may be larger than the first space size. For example, the difference between the first storage space size and the first space size may be a preset value, and the preset value is a positive number.
[0118] S305: Determine a spatial position of the first storage space, and execute a first script according to the spatial position to store the local code in the first storage space.
[0119] The spatial position may be used as an input parameter of the first script and the first script may be called. During the running of the first script, the local code may be stored in the first storage space corresponding to the spatial position according to the input parameter (spatial position).
[0120] S306. Cancel displaying the local code in the code editing window.
[0121] The terminal program can detect the local code storage status in real time, and when it is detected that the local code storage status is completed, the code in the code editing window is cleared, that is, the display of the local code is cancelled.
[0122] For example, you can call a preset command in a software tool to cancel the display of local code in the code editing window. The preset command can be a code clearing command.
[0123] S307. Obtain the latest code from the server through the first script.
[0124] The latest code can be the code uploaded to the server by other developers.
[0125] Optionally, after the latest code is obtained, the latest code may be stored in the second storage space of the terminal device.
[0126] The second storage space is a storage space in the terminal device, and the second storage space is used to store the code downloaded from the server.
[0127] S308: Determine the download status of the latest code.
[0128] The download status is either an unfinished status or a completed status. The terminal program can detect the download status of the latest code in real time. During the process of downloading the latest code from the server, the download status of the latest code is an unfinished status. When the latest code is completely downloaded, the download status is a completed status.
[0129] Optionally, after the server sends the latest code to the terminal device, it may send a download completion flag to the terminal device. When the terminal device receives the download completion flag, the terminal device may determine that the latest code has been completely downloaded.
[0130] S309: When the downloading status is completed, call the second script to determine the spatial location of the first storage space through the second script.
[0131] Optionally, after the first script determines the first storage space, the spatial position of the first storage space may be written into the preset storage space. Correspondingly, the second script may obtain the spatial position of the first storage space from the preset storage space.
[0132] S310: Obtain a local code in a first storage space according to a spatial position.
[0133] After the local code is acquired from the first storage space, the local code may be stored in the second storage space, and the local code may be deleted from the first storage space.
[0134] S311. Determine overlapping codes between the local code and the latest code.
[0135] The local code and the latest code respectively include overlapping codes, that is, the overlapping codes are the overlapping codes in the local code and the latest code.
[0136] In the case where the local code and the latest code are respectively located in the second storage space, a code comparison process may be performed on the local code and the latest code in the second storage space to determine overlapping codes in the local code and the latest code.
[0137] S312: Determine the other codes in the local code except the coincident code as the first difference code, and determine the other codes in the latest code except the coincident code as the second difference code.
[0138] Optionally, the first difference code may be a code portion modified by a developer corresponding to the terminal device, and the second difference code may be a code portion modified by other developers.
[0139] S313. Determine a target code according to the coincidence code, the first difference code, and the second difference code.
[0140] The target code may be determined in the following manner: determining the version numbers of the first difference code and the second difference code, determining the target difference code in the first difference code and the second difference code according to the version numbers of the first difference code and the second difference code, and merging the overlapping code and the target difference code to obtain the target code.
[0141] The version numbers of the first difference code and the second difference code may be compared, and the difference code with the latest version number may be used as the target difference code. Alternatively, the modification dates of the first difference code and the second difference code may be determined, and the code with the latest modification date may be determined as the target difference code.
[0142] S314. Display the target code in the code editing window.
[0143] After the target code is displayed in the code editing window, the code in the second storage space can also be deleted.
[0144] It should be noted that in Figure 3 The various processing steps (S301-S314) shown in the embodiment do not constitute a specific limitation on the code processing process. In other embodiments of the present application, the code processing process may include: Figure 3 Embodiments may include more or fewer steps, for example, the code processing process may include Figure 6 Some steps in the embodiment, or, Figure 6 Some steps in the embodiment may be replaced by steps having the same functions, or, Figure 6 Some steps in the embodiments may be split into multiple steps, etc.
[0145] In an embodiment of the present application, a first script and a second script are pre-configured in a terminal device. When it is necessary to obtain the latest code from the server, if there is local code in an uncached and unsubmitted state in the terminal device, the local code can be stored in the first storage space through the first script, and the latest code can be downloaded from the server. After the latest code is downloaded from the server, the local code can be obtained in the first storage space through the second script, and the overlap code, the first difference code and the second difference code can be determined by comparing the local code with the latest code. According to the overlap code, the first difference code and the second difference code, the target code is determined, and the target code is displayed in the code editing window. In the above process, by configuring the script in advance, the local code can be automatically stored and restored in the process of obtaining the code from the server, and the target code can be automatically obtained by merging the latest code and the local code, without the need for the developer to manually save the local code and restore the code, thereby improving the code processing efficiency.
[0146] Based on any of the above embodiments, Figure 4 , the process of configuring the first script and the second script is described.
[0147] Figure 4 This is a schematic diagram of a script configuration interface provided in an embodiment of the present application. Figure 4 , including interface 401-interface 403.
[0148] Please refer to interface 401. Interface 401 is a configuration interface in the software tool in the terminal device. Interface 401 includes a "tool" control. When the user needs to configure the script, the user can click the "tool" control to make the terminal device display the script configuration interface 402.
[0149] Please refer to interface 402, which is a script configuration interface. Interface 402 includes a "script" control. When a user needs to configure a script, the user can click the "script" control to display a "settings-script" area on the right side of interface 402. The user can configure the script in the "settings-script" area. For example, when a user needs to add a new script, the user can click the "add" control and edit the script information of the new script in the interface. For example, the script information includes name, command, parameter, execution time, etc.
[0150] Please refer to interface 403. After the user completes editing the script information of the newly added script, the user can click the "OK" control to complete the newly added script. For example, the newly added first script and second script can be as shown in interface 403. The command corresponding to the first script can be "store local code", and the execution time of the first script is: before obtaining the latest code, and the parameters corresponding to the first script are storage parameters. The command corresponding to the second script can be "restore local code, and merge local code and latest code", and the execution time of the second script is: after obtaining the latest code, and the parameters corresponding to the second script are restore parameters.
[0151] In an embodiment of the present application, the script is pre-configured in the script configuration interface. When the script needs to be configured, click the "Tool" control in the configuration interface in the software tool to display the script configuration interface on the terminal device. Click the "Script" control in the script configuration interface to display the "Settings-Script" area on the right, and configure the script in the "Settings-Script" area. After the script information is configured, you can click the "OK" control to complete the addition of the script. In the above process, by configuring the script information in advance in the script configuration interface, the local code can be automatically stored and restored during the process of the server acquiring the code, and the target code is automatically obtained by merging the latest code and the local code, without the need for developers to manually save the local code and restore the code, thereby improving the code processing efficiency.
[0152] Figure 5 This is a schematic diagram of the structure of a code acquisition device provided in an embodiment of the present application. Figure 5 The code acquisition device 10 includes an acquisition module 11, a first calling module 12 and a second calling module 13.
[0153] The acquisition module 11 is used to obtain a code acquisition request, where the code acquisition request is used to request to obtain the latest code from the server;
[0154] The first calling module 12 is used to store the local code in the first storage space through the first script according to the code acquisition request, and obtain the latest code from the server, where the local code is the code that is not cached and not submitted to the server;
[0155] The second calling module 13 is used to, upon detecting that the latest code has been obtained, obtain the local code in the first storage space through the second script, and merge the local code and the latest code to obtain the target code.
[0156] A code acquisition device provided in an 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.
[0157] In a possible implementation, the first calling module 12 is specifically used to:
[0158] According to the code acquisition request, determine whether there is local code that is not cached and not submitted to the server;
[0159] When it is determined that there is local code that is not cached and not submitted to the server, the first script is called to store the local code in the first storage space through the first script.
[0160] In a possible implementation, the first calling module 12 is specifically used to:
[0161] According to the code acquisition request, determine whether there is code in the code editing window;
[0162] If so, the code status of the code in the code editing window is obtained, and if the code status is an uncached state, it is determined that there is local code, and if the code status is a cached state, it is determined that there is no local code;
[0163] If not, it is determined that no native code exists.
[0164] In a possible implementation, the first calling module 12 is specifically used to:
[0165] Determine a first space size of storage space required for the local code by using a first script;
[0166] Determine a first storage space according to the storage space size, wherein the space size of the first storage space is greater than or equal to the first space size;
[0167] The spatial position of the first storage space is determined, and the first script is executed according to the spatial position to store the local code in the first storage space.
[0168] In a possible implementation, the first calling module 12 is further configured to:
[0169] Suppresses display of local code in the code editing window.
[0170] In a possible implementation, the second calling module 13 is specifically used to:
[0171] Determine the download status of the latest code, which is either incomplete or completed;
[0172] When the downloading status is the completed status, the second script is called to determine the spatial position of the first storage space through the second script, and obtain the local code in the first storage space according to the spatial position.
[0173] In a possible implementation, the second calling module 13 is specifically used to:
[0174] Determine the overlapping codes in the local code and the latest code, wherein the local code and the latest code respectively include the overlapping codes;
[0175] Determine the other codes in the local code except the coincident code as the first difference code, and determine the other codes in the latest code except the coincident code as the second difference code;
[0176] A target code is determined according to the coincidence code, the first difference code and the second difference code.
[0177] In a possible implementation, the second calling module 13 is specifically used to:
[0178] Determining version numbers of the first difference code and the second difference code;
[0179] According to the version numbers of the first difference code and the second difference code, determining a target difference code from the first difference code and the second difference code, wherein the version number of the target difference code is the latest;
[0180] The overlapped code and the target difference code are combined to obtain the target code.
[0181] In a possible implementation, the second calling module 13 is further configured to:
[0182] Displays the target code in the code editing window.
[0183] A code acquisition device provided in an 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.
[0184] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 6 The electronic device 20 may include: a memory 21 and a processor 22. Exemplarily, the memory 21 and the processor 22 are interconnected via a bus 23.
[0185] The memory 21 is used to store computer-executable instructions;
[0186] The processor 22 is used to execute the program instructions stored in the memory, so as to enable the electronic device 20 to execute the method shown in the above method embodiment.
[0187] The electronic device provided 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.
[0188] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the above method can be implemented.
[0189] The embodiment of the present application may also provide a computer program product, including a computer program, which can implement the above method when executed by a processor.
[0190] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0191] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0192] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0193] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0194] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0195] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0196] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0197] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0198] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A code processing method, characterized in that: include: Obtain a code acquisition request, wherein the code acquisition request is used to request to obtain the latest code from the server; According to the code acquisition request, local code is stored in a first storage space by a first script, and the latest code is acquired from the server, wherein the local code is code that is not cached and not submitted to the server; When it is detected that the latest code has been obtained, the local code is obtained in the first storage space through a second script, and the local code and the latest code are merged to obtain the target code.
2. The method according to claim 1, characterized in that According to the code acquisition request, storing the local code in the first storage space by using a first script includes: According to the code acquisition request, determining whether there is the local code that has not been cached and submitted to the server; When it is determined that there is the local code that is not cached and not submitted to the server, the first script is called to store the local code in the first storage space through the first script.
3. The method according to claim 2, characterized in that According to the code acquisition request, determining whether there is the local code that is not cached and not submitted to the server includes: According to the code acquisition request, determining whether there is a code in the code editing window; If yes, then obtain the code status of the code in the code editing window, if the code status is an uncached state, determine that the local code exists, if the code status is a cached state, determine that the local code does not exist; If not, it is determined that the local code does not exist.
4. The method according to claim 2 or 3, characterized in that: Calling the first script to store the local code in the first storage space through the first script includes: Determine, by means of the first script, a first space size of a storage space required by the local code; Determine the first storage space according to the storage space size, where the space size of the first storage space is greater than or equal to the first space size; The spatial position of the first storage space is determined, and the first script is executed according to the spatial position to store the native code in the first storage space.
5. The method according to any one of claims 1 to 3, characterized in that: The local code is the code displayed in the code editing window; After the local code is stored in the first storage space by the first script, the method further includes: Suppresses display of the native code in the code editing window.
6. The method according to any one of claims 1 to 3, characterized in that: After detecting that the latest code has been obtained, obtaining the local code in the first storage space through a second script includes: Determine the download status of the latest code, where the download status is an unfinished state or a completed state; When the download status is the completed status, the second script is called to determine the spatial position of the first storage space through the second script, and the local code is obtained in the first storage space according to the spatial position.
7. The method according to any one of claims 1 to 3, characterized in that: The local code and the latest code are merged to obtain a target code, including: Determine a coincident code in a local code and the latest code, wherein the local code and the latest code respectively include the coincident code; Determine the other codes in the local code except the coincident code as the first difference code, and determine the other codes in the latest code except the coincident code as the second difference code; The target code is determined according to the coincidence code, the first difference code and the second difference code.
8. The method according to claim 7, characterized in that Determining the target code according to the coincidence code, the first difference code, and the second difference code includes: Determining version numbers of the first difference code and the second difference code; Determine a target difference code from among the first difference code and the second difference code according to the version numbers of the first difference code and the second difference code, wherein the version number of the target difference code is the latest; The overlap code and the target difference code are combined to obtain the target code.
9. The method according to any one of claims 1 to 8, characterized in that: After merging the local code and the latest code to obtain the target code, the method further includes: The object code is displayed in a code editing window.
10. A code acquisition device, comprising: An acquisition module, a first calling module and a second calling module, wherein: The acquisition module is used to obtain a code acquisition request, and the code acquisition request is used to request to obtain the latest code from the server; The first calling module is used to store the local code in the first storage space through the first script according to the code acquisition request, and obtain the latest code from the server, where the local code is the code that is not cached and not submitted to the server; The second calling module is used to, upon detecting that the latest code has been obtained, obtain the local code in the first storage space through the second script, and merge the local code and the latest code to obtain the target code.
11. 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 9.
12. 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 9 when executed by a processor.
13. 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 9 when being executed by a processor.
