Table file updating method, device, equipment and medium
Patent Information
- Application Number
- CN202210977588.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-15
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2042-08-15
AI Technical Summary
[0004]然而,人工手动修改冲突文件的方式人机交互效率较低
[0026]另一方面,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行本申请实施例中任一所述的表格文件更新方法。
Smart Images

Figure CN117632975B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer software technology, and in particular to a method, apparatus, device and medium for updating a form file. Background Technology
[0002] Git is an open-source distributed version control software. Git has multiple Git branches, and different developers can modify specific content through different Git branches. Git will merge different Git branches to complete the version update of the specified content.
[0003] In related technologies, when merging Git branches, different developers may use different modification methods, leading to conflicts between the two branches on specified files. For example, if two different branches add different content to the same location in a file, the Git branch merge will fail. Developers need to manually modify the conflicting parts, such as modifying the branch code corresponding to the conflicting file.
[0004] However, manually modifying conflicting files is a low-efficiency human-computer interaction method. Summary of the Invention
[0005] This application provides a method, apparatus, device, and medium for updating table files, which can improve the efficiency of human-computer interaction when resolving Git branch merge conflicts. The technical solution is as follows:
[0006] On the one hand, a method for updating a table file is provided, the method comprising:
[0007] The first branch file displays a first difference region. The first branch file is a table file stored in the first file processing terminal for the target content. The first difference region is a region aggregated by the first target cell set according to a preset aggregation method. The target cell set includes multiple cells in the first branch file that differ from the second branch file. The second branch file is a table file stored in the second file processing terminal for the target content.
[0008] The second branch file displays a second difference region, which is a region formed by aggregating the second target cell set according to the preset aggregation method. The second target cell set includes multiple cells in the second branch file that differ from the first branch file.
[0009] In response to receiving an update operation, a target table file is displayed. The target table file is a table generated by synchronizing the difference regions containing multiple cells in the first branch file and the second branch file based on the update operation, wherein the difference regions include at least one of the first difference regions and the second difference regions.
[0010] On the other hand, another method for updating table files is provided, which includes:
[0011] Obtain a first branch file and a second branch file, wherein the first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content;
[0012] According to a preset aggregation method, multiple cells in the first branch file are aggregated into a first sequence; and, according to the preset aggregation method, multiple cells in the second branch file are aggregated into a second sequence;
[0013] A differential analysis is performed on the first sequence and the second sequence to obtain differential analysis results, which are used to indicate the content in the first sequence and the second sequence that has data or positional differences;
[0014] Based on the difference analysis results, an update operation is received to obtain a target table file, which is a table generated after the first branch file and the second branch file are synchronized and updated.
[0015] On the other hand, a form file updating apparatus is provided, the apparatus comprising:
[0016] The display module is used to display a first difference region in a first branch file. The first branch file is a table file stored in a first file processing terminal for the target content. The first difference region is a region aggregated by a first target cell set according to a preset aggregation method. The target cell set includes multiple cells in the first branch file that differ from the second branch file. The second branch file is a table file stored in a second file processing terminal for the target content.
[0017] The display module is further configured to display a second difference region in the second branch file. The second difference region is a region formed by aggregating a second target cell set according to the preset aggregation method. The second target cell set includes multiple cells in the second branch file that differ from the first branch file.
[0018] The display module is further configured to display a target table file in response to receiving an update operation. The target table file is a table generated by synchronizing the difference regions containing multiple cells in the first branch file and the second branch file based on the update operation, wherein the difference regions include at least one of the first difference regions and the second difference regions.
[0019] On the other hand, another form file updating device is provided, the device comprising:
[0020] The acquisition module is used to acquire a first branch file and a second branch file, wherein the first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content;
[0021] An aggregation module is used to aggregate multiple cells in a first branch file into a first sequence according to a preset aggregation method; and to aggregate multiple cells in a second branch file into a second sequence according to the preset aggregation method;
[0022] An analysis module is used to perform differential analysis on the first sequence and the second sequence to obtain differential analysis results, which are used to indicate the content in the first sequence and the second sequence that has data or positional differences.
[0023] The receiving module is used to receive update operations based on the difference analysis results and obtain a target table file, which is a table generated after the first branch file and the second branch file are synchronized and updated.
[0024] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement any of the table file update methods described in the embodiments of this application.
[0025] On the other hand, a computer-readable storage medium is provided, wherein at least one piece of program code is stored in the computer-readable storage medium, the at least one piece of program code being loaded and executed by a processor to implement the table file update method described in any of the embodiments of this application.
[0026] On the other hand, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform any of the table file update methods described in the embodiments of this application.
[0027] The beneficial effects of the technical solutions provided in this application include at least the following:
[0028] By displaying the first and second branch files on the file update interface, developers are provided with a visual interface to resolve conflicts in the branch file merging process, improving the human-computer interaction efficiency when resolving Git branch merge conflicts. Furthermore, the basic unit of the update operation on this interface is a region composed of multiple cells (e.g., single row, multiple rows), which improves the processing efficiency of developers during the file update process. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a schematic diagram of an implementation environment provided by an exemplary embodiment of this application;
[0031] Figure 2 This is a flowchart of a table file update method provided in an exemplary embodiment of this application;
[0032] Figure 3 This is a flowchart of a table file update method provided in another exemplary embodiment of this application;
[0033] Figure 4 This is a schematic diagram of the file alignment process in a table file update method provided in another exemplary embodiment of this application;
[0034] Figure 5 This is a schematic diagram of the table merging interface in a table file updating method provided in another exemplary embodiment of this application;
[0035] Figure 6 This is a schematic diagram illustrating the change of formula information in a table file update method provided in another exemplary embodiment of this application;
[0036] Figure 7This is a flowchart of a table file update method provided in an exemplary embodiment of this application;
[0037] Figure 8 This is a schematic diagram illustrating the triggering process of the "Local First" control in a table file update method provided in an exemplary embodiment of this application;
[0038] Figure 9 This is a schematic diagram illustrating the triggering process of the "remote-first" control in a table file update method provided in an exemplary embodiment of this application;
[0039] Figure 10 This is a schematic diagram illustrating the triggering process of the "Keep Local" control in a table file update method provided in an exemplary embodiment of this application;
[0040] Figure 11 This is a schematic diagram illustrating the triggering process of the "Retain Remote" control in a table file update method provided in an exemplary embodiment of this application;
[0041] Figure 12 This is a schematic diagram illustrating the triggering process of the "Replace all non-conflict areas" control in a table file update method provided in an exemplary embodiment of this application;
[0042] Figure 13 This is a schematic diagram of the interface where a file update is successfully saved in a table file update method provided in an exemplary embodiment of this application;
[0043] Figure 14 This is an overall workflow diagram of a table file update method provided in an exemplary embodiment of this application;
[0044] Figure 15 This is a structural block diagram of a form file updating apparatus provided in an exemplary embodiment of this application;
[0045] Figure 16 This is a structural block diagram of a form file updating apparatus provided in another exemplary embodiment of this application;
[0046] Figure 17 This is a structural block diagram of a form file updating apparatus provided in another exemplary embodiment of this application;
[0047] Figure 18 This is a structural block diagram of a computer device provided in an exemplary embodiment of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] In this application, the terms "first" and "second" are used to distinguish between identical or similar items that have essentially the same function. It should be understood that there is no logical or temporal dependency between "first" and "second", nor is there any limitation on the quantity or execution order.
[0050] First, a brief introduction to the terms used in the embodiments of this application:
[0051] Git: An open-source distributed version control software.
[0052] Git branches: In Git, there are multiple Git branches, and different developers can modify a specific content simultaneously through different Git branches.
[0053] Branch merging: Merges the contents of two Git branches into one branch, that is, merges different Git branches to complete the version update of the specified content.
[0054] File conflicts occur when two different branches of Git both modify the content of a file. When these two branches are merged, file conflicts will occur, mainly involving conflicts in file content and modification location.
[0055] Local branch: A Git branch that has been committed on the local computer.
[0056] Remote branch: Another Git branch that is saved in a terminal other than the local computer and is to be merged into the local branch.
[0057] In related technologies, when merging Git branches, different developers may use different modification methods, leading to conflicts between the two branches on specified files. For example, two different branches might add different content to the same location in a file, causing the Git branch merge to fail. Developers need to manually modify the conflicting parts, such as modifying the branch code corresponding to the conflicting file. However, manually modifying conflicting files is inefficient in terms of human-computer interaction.
[0058] This application provides a method for updating a table file. First, multiple cells in the obtained first branch file and second branch file are aggregated according to a preset aggregation method to obtain a first sequence and a second sequence. Second, a difference analysis is performed on the first sequence and the second sequence to obtain the analysis results. Finally, based on the analysis results, the first branch file and the second branch file are merged using an update operation received on the terminal to obtain the target updated file. Furthermore, by displaying the first branch file and the second branch file on the file update interface, a visual interface is provided for developers to resolve conflicts during the merging process, improving the human-computer interaction efficiency when resolving Git branch merge conflicts. Moreover, the basic unit of the update operation on this interface is a region composed of multiple cells (e.g., a single row, multiple rows), improving the processing efficiency of developers during the file update process.
[0059] Figure 1 This is a schematic diagram of an implementation environment provided by an exemplary embodiment of this application, such as... Figure 1 As shown, the implementation environment includes a terminal 110, a server 120, and a communication network 130. The terminal 110 and the server 120 are connected through the communication network 130. In some optional embodiments, the communication network 130 can be a wired network or a wireless network. This embodiment does not limit this.
[0060] In some alternative embodiments, terminal 110 may be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. Optionally, terminal 110 may have a target application installed and running that provides form file update functionality; this target application may be a software development tool used by software developers.
[0061] Optionally, the first branch file is a table file stored after modifying the target content on terminal 110, and the second branch file is a table file stored on server 120 after modifying the target content on other terminals. For illustration, after terminal 110 completes local terminal development, it sends a request to server 120 to obtain the second branch file. Upon receiving the request, server 120 sends the second branch file to terminal 110.
[0062] After receiving the first branch file and the second branch file, the terminal 110 will merge the second branch file with the first branch file. If there is a conflict between the first branch file and the second branch file during the merging process, the first branch file and the second branch file will be displayed in the file update interface. Each line in the first branch file and the second branch file displayed in the interface corresponds one-to-one. Optionally, the file update interface will use special display methods (such as changing the font color, bolding, adding underlines, etc.) to display the lines or columns that differ between the first branch file and the second branch file respectively.
[0063] The file update interface displays an update control. When the terminal 110 receives a trigger operation on the update control, it will update the first branch file and the second branch file synchronously based on the trigger operation to resolve the merge conflict between the first branch file and the second branch file.
[0064] Optionally, after the merge conflict between the first branch file and the second branch file is resolved, the terminal 110 obtains the merge result of the first branch file and the second branch file. The terminal 110 sends the merge result to the server 120. After receiving the merge result, the server 120 may forward the updated result to other terminals.
[0065] In some optional embodiments, server 120 provides background services for the target application installed on the terminal. It is worth noting that server 120 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0066] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to achieve data computation, storage, processing, and sharing. Based on the cloud computing business model, cloud technology encompasses network technology, information technology, integration technology, management platform technology, and application technology. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to a backend system for logical processing. Data at different levels will be processed separately, and various industry data will require robust system support, which can only be achieved through cloud computing. Optionally, server 120 can also function as a node in a blockchain system.
[0067] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the forms and documents involved in this application were obtained with full authorization.
[0068] Based on the above introduction and implementation environment, the table file updating method provided in the embodiments of this application will be described. Figure 2 This is a flowchart of a table file update method provided in an embodiment of this application, which is applied to, for example... Figure 1 The following explanation uses the terminal shown as an example. Figure 2 As shown, the method includes:
[0069] Step 201: Obtain the first branch file and the second branch file.
[0070] The first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content.
[0071] Optionally, the target content is a table file in the development database corresponding to the current version of the application. For example, in a game, the character attribute table file corresponds to the various attribute values of virtual characters. The first branch file and the second branch file are the table files stored in the terminal after the character attribute table file has been modified by different development ends. Developers can modify the table file during the game development process and version update process.
[0072] The first file processing terminal can be a local terminal with the target application installed, or a remote terminal with the target application installed; the second file processing terminal can be a local terminal with the target application installed, or a remote terminal with the target application installed.
[0073] The target application is a program that provides table file modification functionality. Optionally, the target application may include distributed version update software. For example, Git is used as an example to illustrate the implementation of distributed version update software. In Git, developers can advance the same development task through different Git branches. The first file processing end and the second file processing end are the development terminals corresponding to different branches in Git. Both the first file processing end and the second file processing end can modify the same target content.
[0074] Wherein, the local terminal refers to the terminal currently acquiring the first branch file and the second branch file, and the remote terminal is a terminal other than the local terminal that communicates with the local terminal. Optionally, the method by which the local terminal acquires the first branch file and the second branch file includes at least one of the following methods:
[0075] 1. The first file processing terminal is a local terminal, and the second file processing terminal is a remote terminal.
[0076] To illustrate, after modifying the target content in the distributed version update software on the local terminal to obtain the first branch file, the first branch file is directly stored on the local terminal; after modifying the target content in the distributed version update software on the remote terminal to obtain the second branch file, the second branch file is sent to the local terminal for storage.
[0077] 2. The second file processing terminal is a local terminal, and the first file processing terminal is a remote terminal.
[0078] To illustrate, after modifying the target content in the distributed version update software on the local terminal to obtain the second branch file, the second branch file is directly stored on the local terminal; after modifying the target content in the distributed version update software on the remote terminal to obtain the first branch file, the first branch file is sent to the local terminal for storage.
[0079] Step 202: Aggregate multiple cells in the first branch file into a first sequence according to a preset aggregation method; and aggregate multiple cells in the second branch file into a second sequence according to a preset aggregation method.
[0080] The first sequence contains multiple subsequences, and the second sequence also contains multiple subsequences. The number of subsequences in the first sequence and the number of subsequences in the second sequence can be the same or different.
[0081] Optionally, the preset aggregation method includes: aggregating multiple cells by row, aggregating multiple cells by column, etc., which are not limited in this embodiment. The method for obtaining the first sequence and the second sequence includes at least one of the following methods:
[0082] 1. Aggregate multiple cells in a specified row in the first branch file into a first sequence; and aggregate multiple cells in a specified row in the second branch file into a second sequence.
[0083] Optionally, the specified line may include a single line or multiple lines.
[0084] Optionally, multiple cells in the same row of the first branch file can be aggregated together to form a single data representation, which is one of the subsequences in the first sequence. For example, if table a is a 4-row, 3-column table, the final aggregated first sequence will have 4 subsequences.
[0085] Optionally, multiple subsequences can be sequentially arranged in the first sequence according to the line numbers (i.e., the order of the lines) in the first branch file. For example, if the aggregated data in the first line of the first branch file is 'a', the aggregated data in the second line is 'c', and the aggregated data in the third line is 'b', then the first sequence can be represented as {a, b, c}.
[0086] In some alternative embodiments, the specified row can be multiple consecutive rows in a table, such as aggregating multiple cells in the first and second rows together; or it can be multiple rows in a table containing specified data content, such as aggregating rows containing virtual items of the same type in the attribute table corresponding to virtual items.
[0087] 2. Aggregate multiple cells in a specified column in the first branch file into a first sequence; and aggregate multiple cells in a specified column in the second branch file into a second sequence.
[0088] Optionally, the specified column may include a single column or multiple columns.
[0089] Optionally, multiple cells in the same column of the first branch file can be aggregated together to form a single data representation, which is one of the subsequences in the first sequence. For example, if table b is a 7-row, 8-column table, the final aggregated first sequence will have 8 subsequences.
[0090] Optionally, multiple subsequences can be sequentially arranged in the first sequence according to the column numbers (i.e., the order of the columns) in the first branch file.
[0091] In some optional embodiments, the specified column can be multiple consecutive columns in a table; or it can be multiple columns in a table that contain specified data content.
[0092] It should be noted that the aggregation method for the first branch file and the second branch file is the same. That is, if the first branch file is aggregated according to a single line, then the second branch file must also be aggregated according to a single line.
[0093] Step 203: Perform differential analysis on the first sequence and the second sequence to obtain the differential analysis results.
[0094] The difference analysis results are used to indicate the differences in data or positions between the first and second sequences.
[0095] Differential analysis refers to comparing the data content of the first and second sequences to determine the subsequences that have differences and the subsequences that do not.
[0096] Optionally, the results of the difference analysis include at least one of the following three cases:
[0097] 1. The results of the difference analysis can indicate the conflict between the first sequence and the second sequence.
[0098] To illustrate, let's take a preset aggregation method that implements single-line aggregation as an example. A conflict result refers to the result caused by different file processing terminals making different modifications to the same line in the target content. For example, if the item level in the third row of the virtual item attribute table is 70, and the first file processing terminal modifies the item level in the third row of the virtual item attribute table to 69, and the second file processing terminal modifies the item level in the third row of the target content to 71, then the modification results of the third row of the virtual item attribute table by the first and second file processing terminals are the conflict results.
[0099] 2. The results of the difference analysis can represent subsequences that are newly added in the first sequence but not in the second sequence.
[0100] To illustrate, if the first file processing terminal adds a new row of virtual item data to the virtual item attribute table, but the second file processing terminal adds the same row of virtual item data, then that row of virtual item data will be included in the difference analysis results.
[0101] 3. The results of differential analysis can represent subsequences that are newly added in the second sequence but not in the first sequence.
[0102] As an illustration, if the second file processing terminal adds a new column of virtual item data to the virtual item attribute table, but the first file processing terminal adds the same column of virtual item data, then that column of virtual item data will be included in the difference analysis results.
[0103] It should be noted that the above description of the difference analysis results is merely an illustrative example, and the embodiments of this application do not limit the scope of the application.
[0104] Optionally, a differential analysis is performed on the first sequence and the second sequence to obtain a first differential sequence and a second differential sequence as the differential analysis result. In this case, subsequences that differ between the first sequence and the second sequence are marked.
[0105] Step 204: Receive update operation based on difference analysis results to obtain the target table file.
[0106] The target table file is the table generated after the first branch file and the second branch file are synchronized and updated.
[0107] As an illustration, the first and second differential sequences after differential analysis can be displayed in a table on the terminal. Developers can then perform corresponding update operations on the terminal based on the displayed results and actual needs.
[0108] Optionally, the update operation includes at least one of the following operations:
[0109] 1. The update operation is used to replace the first specified subsequence in the first sequence with the second specified subsequence in the second sequence; or, it is used to replace the second specified subsequence in the second sequence with the first specified subsequence in the first sequence.
[0110] That is, if there is a first modification to the target data in the first branch file and a second modification to the target data in the second branch file, the first modification can be replaced with the second modification, or the second modification can be replaced with the first modification.
[0111] 2. The update operation is used to add the first specified subsequence in the first sequence to the position before / after the position of the second specified subsequence in the second sequence; or to add the second specified subsequence in the second sequence to the position before the position of the first specified subsequence in the first sequence.
[0112] 3. The update operation is used to add a first subsequence that was added in the first sequence but not in the second sequence to the second sequence; or, it is used to add a second subsequence that was added in the second sequence but not in the first sequence to the first sequence.
[0113] 4. The update operation is also used to edit the data content of the first difference sequence displayed on the terminal interface and synchronously update it to the second difference sequence; or, to edit the data content of the second difference sequence displayed on the terminal interface and synchronously update it to the first difference sequence.
[0114] 5. The update operation is also used to add or delete rows / columns in the first difference sequence displayed on the terminal interface and synchronously update the second difference sequence; or, add or delete rows / columns in the second difference sequence displayed on the terminal interface and synchronously update the first difference sequence.
[0115] 6. The update operation is also used to find cells with differences in a subsequence.
[0116] To illustrate, if the data in the first row of the first branch file and the data in the first row of the second branch file are conflicting data (that is, different modification results for the same target content), the update operation can still locate the cells with differences.
[0117] Optionally, based on the update operation, a first update result corresponding to the first sequence and a second update result corresponding to the second sequence can be obtained, which is the target update table. The content and location of the data in the first update result and the second update result are completely consistent.
[0118] In some optional embodiments, after each update operation is completed, the terminal re-analyzes the differences between the first update result and the second update result, and updates the display results on the terminal interface.
[0119] In summary, the table file update method provided in this application firstly aggregates multiple cells in the obtained first branch file and second branch file according to a preset aggregation method to obtain a first sequence and a second sequence; secondly, it performs differential analysis on the first sequence and the second sequence to obtain analysis results; finally, it merges the first branch file and the second branch file based on the analysis results through an update operation received on the terminal to obtain the target updated file. Since the data of a single subsequence in the first sequence and the second sequence represents multiple cells aggregated according to the preset aggregation method, the basic unit of data update during the update operation is multiple cells, which improves the data update efficiency in the process of merging the first branch file and the second branch file.
[0120] Figure 3 This is a flowchart of a table file update method provided in an embodiment of this application, which is applied to, for example... Figure 1 The following explanation uses the terminal shown as an example. Figure 3 As shown, the method includes:
[0121] Step 301: Obtain the first branch file and the second branch file.
[0122] The first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content.
[0123] Step 302: Aggregate multiple cells in the first branch file into a first sequence according to a preset aggregation method; and aggregate multiple cells in the second branch file into a second sequence according to a preset aggregation method.
[0124] Step 303: Perform differential analysis on the first sequence and the second sequence to determine the common subsequence.
[0125] Among them, the common subsequence is used to indicate the sequence in the first sequence and the second sequence that have the same data content.
[0126] Optionally, the common subsequence refers to the longest common subsequence. Illustratively, a sequence is considered the longest common subsequence if it is a subsequence of both the first and second sequences and is the longest of all subsequences. For example, if the first sequence is {1, 3, 4, 5, 6, 7, 7, 8} and the second sequence is {3, 5, 7, 4, 8, 6, 7, 8, 2}, then the longest common subsequence is {3, 4, 6, 7, 8}.
[0127] Optionally, in response to the first sequence and the second sequence being less than a preset number threshold, all subsequences in the first sequence and the second sequence are compared one by one through traversal to determine the longest common subsequence; in response to the first sequence and the second sequence being greater than or equal to the preset number threshold, the longest common subsequence of the first sequence and the second sequence is calculated by the Myers Difference Algorithm.
[0128] Step 304: Align the first sequence and the second sequence according to the order of the common subsequences in the first sequence and the order of the common subsequences in the second sequence to obtain the first alignment result of the first sequence and the second alignment result of the second sequence.
[0129] Among them, the common subsequences are arranged in the same order in the first alignment result and the second alignment result.
[0130] Optionally, the method for obtaining the first alignment result and the second alignment result further includes the following steps:
[0131] 1. Determine the first position set based on the order in which the common subsequences are arranged in the first sequence; and determine the second position set based on the order in which the common subsequences are arranged in the second sequence.
[0132] For illustration, if the first sequence is {1, 3, 4, 5, 6, 7, 7, 8} and the second sequence is {3, 5, 7, 4, 8, 6, 7, 8, 2}, then the longest common subsequence is {3, 4, 6, 7, 8}; therefore, the first position set is {2, 3, 5, 7, 8} and the second position set is {1, 4, 6, 7, 8}.
[0133] 2. During the alignment of common subsequences in the first and second sequences, a first blank sequence with empty data content is added to the first sequence, and a second blank sequence with empty data content is added to the second sequence. The alignment process of common subsequences in the first and second sequences is explained below:
[0134] Step 1: Initialize cursor i and cursor j.
[0135] Wherein, cursor i is the cursor pointing to the first sequence, and cursor j is the cursor pointing to the second sequence.
[0136] Step 2: Move cursor i and cursor j.
[0137] This is illustrative; please refer to it. Figure 4 , Figure 4 This is a schematic diagram illustrating the alignment process of common subsequences in the first and second sequences, as shown below. Figure 4 As shown, when alignment begins, cursors i and j begin to move in the first sequence 401 and the second sequence 402.
[0138] Step 3: If the position of the k-th subsequence in the first sequence does not belong to the first position set, and the position of the h-th subsequence in the second sequence belongs to the second position set, increment k until the position of the (k+n)-th subsequence in the first sequence belongs to the first position set. Add n empty subsequences to the second sequence that are aligned with the n subsequences above the position of the (k+n)-th subsequence. These n empty subsequences are used as the second blank sequence. k, h, and n are positive integers. If the position of the p-th subsequence in the first sequence belongs to the first position set, and the position of the q-th subsequence in the second sequence does not belong to the second position set, increment q until the position of the (q+m)-th subsequence in the first sequence belongs to the first position set. Add m empty subsequences to the first sequence that are aligned with the m subsequences above the position of the (q+m)-th subsequence. These m empty subsequences are used as the first blank sequence. p, q, and m are positive integers.
[0139] Indicative, such as Figure 4As shown, from (1) to (2), cursor i moves to the position of the first subsequence of the first sequence 401, and cursor j moves to the position of the first subsequence of the second sequence 402. Since the position 1 of the first subsequence of the first sequence 401 does not belong to the first position set {2, 3, 5, 7, 8}, and the position 1 of the first subsequence of the second sequence 402 belongs to the second position set {1, 4, 6, 7, 8}, cursor i continues to move. When cursor i moves to the position of the second subsequence of the first sequence 401, since the position 2 of the second subsequence of the first sequence 401 belongs to the first position set {2, 3, 5, 7, 8}, an empty subsequence is added above the position of the first subsequence of the second sequence 402, so that the second subsequence of the first sequence 401 and the first subsequence of the second sequence 402 are aligned.
[0140] Indicative, such as Figure 4 As shown, from (2) to (3), the cursor j continues to move to the position of the second subsequence of the second sequence 402. Since the position 2 of the second subsequence of the first sequence 401 pointed to by the cursor i belongs to the first position set {2, 3, 5, 7, 8}, and the position 2 of the second subsequence of the second sequence 402 does not belong to the second position set {1, 4, 6, 7, 8}, the cursor j continues to move. When the cursor j moves to the position of the fourth subsequence of the second sequence 402, since the position 4 of the fourth subsequence of the second sequence 402 belongs to the second position set {1, 4, 6, 7, 8}, two subsequences with empty data content are added above the position of the third subsequence of the first sequence 401, so that the third subsequence of the first sequence 401 and the second subsequence of the second sequence 402 are aligned.
[0141] From (3) to (4), cursor i moves to the position of the 4th subsequence of the first sequence 401, and cursor j moves to the position of the 5th subsequence of the second sequence 402. Since the position 4 of the 4th subsequence of the first sequence 401 does not belong to the first position set {2, 3, 5, 7, 8}, and the position 5 of the 5th subsequence of the second sequence 402 does not belong to the second position set {1, 4, 6, 7, 8}, the 4th subsequence of the first sequence 401 and the 5th subsequence of the second sequence 402 are determined to be conflicting subsequences (that is, different modifications made by different file processing ends for the same data).
[0142] From (4) to (5), cursor i moves to the position of the 5th subsequence of the first sequence 401, and cursor j moves to the position of the 6th subsequence of the second sequence 402. Since the position 5 of the 5th subsequence of the first sequence 401 belongs to the first position set {2, 3, 5, 7, 8}, and the position 6 of the 6th subsequence of the second sequence 402 belongs to the second position set {1, 4, 6, 7, 8}, it is determined that the 5th subsequence of the first sequence 401 and the 6th subsequence of the second sequence 402 are aligned.
[0143] Cursor i continues to move to the position of the 6th subsequence of the first sequence 401, and cursor j moves to the position of the 7th subsequence of the second sequence 402. Since the position 6 of the 6th subsequence of the first sequence 401 does not belong to the first position set {2, 3, 5, 7, 8}, and the position 7 of the 7th subsequence of the second sequence 402 belongs to the second position set {1, 4, 6, 7, 8}, cursor i continues to move. When cursor i moves to the position of the 7th subsequence of the first sequence 401, since the position 7 of the 7th subsequence of the first sequence 401 belongs to the first position set {2, 3, 5, 7, 8}, an empty subsequence is added above the position of the 7th subsequence of the second sequence 402, so that the 7th subsequence of the first sequence 401 and the 7th subsequence of the second sequence 402 are aligned.
[0144] From (5) to (6), cursor i moves to the position of the 8th subsequence of the first sequence 401, and cursor j moves to the position of the 8th subsequence of the second sequence 402. Since the position 8 of the 8th subsequence of the first sequence 401 belongs to the first position set {2, 3, 5, 7, 8}, and the position 8 of the 8th subsequence of the second sequence 402 belongs to the second position set {1, 4, 6, 7, 8}, it is determined that the 8th subsequence of the first sequence 401 is aligned with the 8th subsequence of the second sequence 402.
[0145] The cursor j continues to move to the position of the 9th subsequence of the second sequence 402. At this time, the position 8 of the 8th subsequence of the first sequence 401 pointed to by the cursor i belongs to the first position set {2, 3, 5, 7, 8}, and the position 9 of the 9th subsequence of the second sequence 402 does not belong to the second position set {1, 4, 6, 7, 8}. In order to keep the number of subsequences of the first sequence 401 and the second sequence 402 consistent, a subsequence with empty data content is added below the position of the 8th subsequence of the first sequence 401.
[0146] 3. The alignment process in response to the common subsequences in the first and second sequences ends, yielding the first alignment result and the second alignment result.
[0147] This is illustrative; please refer to it. Figure 4 ,like Figure 4 As shown in (6), the common subsequences in the first sequence 401 and the second sequence 402 have all been aligned. Therefore, the sequence shown in (6) is taken as the first alignment result and the second alignment result.
[0148] Step 305: Based on the first alignment result and the second alignment result, obtain the difference analysis result.
[0149] The difference analysis results are used to indicate the differences in data or positions between the first and second sequences.
[0150] Optionally, there may be a difference between the first alignment result and the second alignment result, wherein the difference includes at least one of the following results:
[0151] 1. First difference result: The subsequence aligned in the first alignment result with the second blank sequence in the second alignment result, for example: Figure 4 The first and sixth subsequences {1, 7} of the first sequence 401 shown in (6);
[0152] 2. Second Difference Result: The subsequence aligned with the first blank sequence in the first alignment result in the second alignment result, for example: Figure 4 The second, third, and ninth subsequences {5, 7, 2} in the second sequence 402 shown in (6);
[0153] 3. Third difference result: Subsequences that are aligned in the first alignment result and the second alignment result but have inconsistent data content, for example: Figure 4 The fourth subsequence {5} in the first sequence 401 and the fifth subsequence {8} in the second sequence 402 shown in (6).
[0154] Optionally, the font color or font format of the first, second, and third difference results displayed in the file update interface can be set to distinguish them from each other and from common subsequences. The first and second alignment results with the set display methods are then used as the difference analysis results. (Illustrative example: Please refer to...) Figure 5 The diagram illustrates the display interface for the difference analysis results in the tabular file update method provided in this application embodiment, such as... Figure 5 As shown, the row containing the bold text 501 represents the first difference result in the local robot table; the row containing the italic text 502 represents the second difference result in the remote robot table; and the row containing the underlined text 503 represents the third difference result between the local robot table and the remote robot table.
[0155] Step 306: Receive update operation based on difference analysis results to obtain target table file.
[0156] The target table file is the table generated after the first branch file and the second branch file are synchronized and updated.
[0157] As an illustration, on the file update interface, developers can perform different update operations based on the difference analysis results to obtain the target table file.
[0158] Optionally, the first alignment result includes a first difference sequence, and the second alignment result includes a second difference sequence, wherein the first difference sequence and the second difference sequence are aligned with each other and have different data contents. That is, the first difference sequence and the second difference sequence are the third difference result.
[0159] The above update operation includes at least one of the following methods:
[0160] 1. Location-based update method.
[0161] Based on the difference analysis results, a first update operation is received. The first update operation is used to update the difference analysis results by updating the position. A second difference sequence is added below the position of the first difference sequence in the first alignment result, and a first difference sequence is added above the position of the second difference sequence in the second alignment result; or, a second difference sequence is added above the position of the first difference sequence in the first alignment result, and a first difference sequence is added below the position of the second difference sequence in the second alignment result.
[0162] 2. Content replacement-based method.
[0163] Based on the difference analysis results, a second update operation is received. The second update operation is used to update the difference analysis results by replacing data content; replacing the first specified sequence in the first alignment result with the second specified sequence in the second alignment result; or replacing the second specified sequence in the second alignment result with the first specified sequence in the first alignment result; wherein the first specified sequence and the second specified sequence are aligned with each other.
[0164] Optionally, the first difference sequence in the first alignment result is replaced with the second difference sequence in the second alignment result; or, the second difference sequence in the second alignment result is replaced with the first difference sequence in the first alignment result.
[0165] Optionally, the first blank sequence in the first alignment result is replaced with the second difference result in the second alignment result; or, the second blank sequence in the second alignment result is replaced with the first difference result in the first alignment result. That is, the first blank sequence in the first alignment result is filled with the data content corresponding to the second difference result; or, the second blank sequence in the second alignment result is filled with the data content corresponding to the first difference result.
[0166] In some optional embodiments, after each update operation, the first, second, and third difference results in the difference analysis results after the update operation need to be re-labeled. Since the alignment process described above adds blank sequences to the first and second sequences, making the number of subsequences in the first and second sequences the same, and since all subsequent additions and deletions of subsequences are synchronized in both sequences, the number of subsequences in the first and second sequences remains the same throughout the update operation. Therefore, the re-labeling process after each update operation also includes the following steps:
[0167] Step 1: Initialize cursor i and cursor j, and move cursor i and cursor j simultaneously.
[0168] Step 2: If the position of the subsequence in the first sequence pointed to by cursor i belongs to the first position set, and the position of the subsequence in the second sequence pointed to by cursor j belongs to the second position set, continue to move cursor i and cursor j.
[0169] Step 3: If the subsequence in the first sequence pointed to by cursor i is a blank sequence, continue to move cursor i until the first sequence pointed to by cursor i is no longer a blank sequence. Then the subsequence in the second sequence that is aligned with the blank sequence that cursor i has moved through is the second difference result.
[0170] Step 4: If the subsequence in the second sequence pointed to by cursor j is a blank sequence, continue moving cursor j until the second sequence pointed to by cursor j is no longer a blank sequence. Then the subsequence in the first sequence that is aligned with the blank sequence that cursor j has moved through is the first difference result.
[0171] Step 5: If the data content of the subsequence in the first sequence pointed to by cursor i is inconsistent with the data content of the subsequence in the second sequence pointed to by cursor j, then continue to move cursor i and cursor j. The subsequence that cursor i and cursor j pass through is the third difference result.
[0172] In some optional embodiments, the first branch file may include two or more branch files, and the second branch file may also include two or more branch files. That is, the number of sequences obtained by the final aggregation is greater than 2. In this case, all the obtained sequences can be subjected to differential analysis together; or, two sequences can be analyzed first to obtain the updated results, and then the updated results and one sequence that has not been analyzed can be analyzed until all sequences are processed to obtain the final updated results, which is the target table file obtained by this merging.
[0173] Step 307: Adjust the reference addresses of formula information in the cells of the first branch file and the second branch file.
[0174] The reference address is used to indicate when the formula information of a specified cell in the table references other cells.
[0175] This is illustrative; please refer to it. Figure 6 ,like Figure 6 As shown, Table 600 contains the target content to be updated, and the formula in cell 601 is "=SUM(local.\robottable!C2:C11)". Table 610 is the target table file after all update operations are completed, that is, after the first branch file and the second branch file are completed. A 12th row has been added to the target table file, so the formula in cell 611 is "=SUM(local.\robottable!C2:C12)". This means that the formula in the cell before and after the update will change the referenced cells according to the update operation, thereby ensuring that the formula information is correct and the cell is displayed correctly. Optionally, when the formula information is updated, the local branch and the remote branch will be updated synchronously.
[0176] In summary, the table file update method provided in this application firstly aggregates multiple cells in the obtained first branch file and second branch file according to a preset aggregation method to obtain a first sequence and a second sequence; secondly, it performs differential analysis on the first sequence and the second sequence to obtain analysis results; finally, it merges the first branch file and the second branch file based on the analysis results through an update operation received on the terminal to obtain the target updated file. Since the data of a single subsequence in the first sequence and the second sequence represents multiple cells aggregated according to the preset aggregation method, the basic unit of data update during the update operation is multiple cells, which improves the data update efficiency in the process of merging the first branch file and the second branch file.
[0177] Figure 7 This is a flowchart of a table file update method provided in an embodiment of this application, which is applied to, for example... Figure 1 The following explanation uses the terminal shown as an example. Figure 7 As shown, the method includes:
[0178] Step 701: Display the first difference region in the first branch file.
[0179] The first branch file is a table file stored in the first file processing terminal for the target content. The first difference area is an area aggregated by the first target cell set according to a preset aggregation method. The target cell set includes multiple cells in the first branch file that differ from the second branch file. The second branch file is a table file stored in the second file processing terminal for the target content.
[0180] Indicatively, the first difference region corresponds to the first difference result and the first difference sequence mentioned in steps 305 to 306 above. That is, when the first difference result and the first difference sequence are displayed in a table form on the file update interface, it is the first difference region.
[0181] The first file processing terminal can be a local terminal with the target application installed, or a remote terminal with the target application installed; the second file processing terminal can be a local terminal with the target application installed, or a remote terminal with the target application installed.
[0182] Optionally, the first branch file is displayed in the file update interface, which is the display interface of the target application. Optionally, the target application can integrate the modifications made to the target content by different file processing terminals (i.e., the first branch file and the second branch file) and display the modifications. For example, the target application is implemented as Git. Git includes a branch merge conflict resolution tool that provides a table file display interface, which can directly display the table files containing modifications to the same content from different branches stored in Git in a tabular format.
[0183] Step 702: Display the second difference region in the second branch file.
[0184] The second difference region is the region formed by aggregating the second target cell set according to a preset aggregation method. The second target cell set includes multiple cells in the second branch file that differ from the first branch file.
[0185] Indicatively, the second difference region corresponds to the second difference result and the second difference sequence mentioned in steps 305 to 306 above. That is, when the second difference result and the second difference sequence are displayed in a table form on the file update interface, it is the second difference region.
[0186] Step 703: In response to receiving an update operation, display the target table file.
[0187] The target table file is a table generated by synchronizing the difference regions containing multiple cells based on the update operation of the first branch file and the second branch file, wherein the difference regions include at least one of the first difference region and the second difference region.
[0188] The file update interface displays the first branch file and the second branch file. The file update interface includes a first update control, which is used to synchronize the first branch file and the second branch file by updating the position.
[0189] Optionally, the above update operation includes at least one of the following operations:
[0190] 1. The file update interface includes a first update control, which is used to synchronize the first branch file and the second branch file through position update; then, a first trigger operation is received on the first update control; in response to the first trigger operation, a second target cell set is added above the location of the first target cell set, and a first target cell set is added below the location of the second target cell set; or, a second target cell set is added below the location of the first target cell set, and a first target cell set is added above the location of the second target cell set.
[0191] This is an illustrative example, using a local terminal with the target application installed as the first file processing end and a remote terminal with the target application installed as the second file processing end:
[0192] (1) As Figure 8 As shown, the first trigger operation is implemented by triggering the "local first" control.
[0193] Clicking the "Local First" control 801 will insert the content of area 802 in interface 800 into the next line of area 811 in interface 810, and simultaneously insert the content of area 803 in interface 800 into the previous line of 812.
[0194] (2) Figure 9 As shown, the first trigger operation is implemented as a trigger operation on the "remote-first" control.
[0195] Clicking the "Remote in Front" control 901 will insert the content of area 902 in interface 900 into the line above area 911 in interface 910, and simultaneously insert the content of area 903 in interface 900 into the line below 912.
[0196] 2. The file update interface includes a second update control, which is used to synchronize the first branch file and the second branch file by replacing data content; then, a second trigger operation is received on the second update control; in response to the second trigger operation, the first target cell set is replaced with the second target cell set; or, the second target cell set is replaced with the first target cell set.
[0197] (1) As Figure 10 As shown, the second trigger operation is implemented by triggering the "Retain Local" control.
[0198] Clicking the "Keep Local" control 1001 will fill the content of area 1002 in interface 1000 into area 1011 in interface 1010.
[0199] (2) Figure 11 As shown, the second trigger operation is implemented by triggering the "Retain Remote" control.
[0200] Clicking the "Keep Remote" control 1101 will fill the content of area 1102 in interface 1100 into area 1111 in interface 1110.
[0201] (3) Figure 12 As shown, the second triggering operation can also be implemented as a triggering operation for "replacing all non-conflicting areas".
[0202] Clicking the "Replace All Non-Conflict Areas" control 1201 will fill area 1202 in interface 1200 to area 1211 in interface 1210, and fill area 1203 in interface 1200 to area 1212.
[0203] In some optional embodiments, the second update operation described above can also be used to clear the content of region 802 in interface 800 and replace it with the content of region 803; and to clear the content of region 803 in interface 800 and replace it with the content of region 802.
[0204] In some optional embodiments, the document update interface also provides functions for selecting difference regions, selecting difference cells, and editing rows in real time. For illustrative examples, please refer to [reference needed]. Figure 5 :
[0205] (4) Figure 5 As shown, clicking the "Next Difference Area" control 504 in interface 500 will automatically select a difference area per row and display the number of cells with differences in that difference area in the display bar 505.
[0206] (5) Figure 5 As shown, clicking the "Next Difference Cell" control 506 in interface 500 will automatically select difference cells on a cell-by-cell basis.
[0207] (6) Figure 5 As shown, clicking the "Insert New Line" control 507 in interface 500 will insert a new line above or below the currently selected line, and this line insertion operation will be synchronously updated in the local file or remote file.
[0208] (7) Figure 5As shown, clicking the "Delete New Line" control 508 in interface 500 will delete the currently selected line, and this deletion operation will be synchronously updated in the local file or remote file.
[0209] In some optional embodiments, the above update operation is also used to make real-time changes to the tables in the first branch file and synchronously update them to the second branch file.
[0210] Optionally, the update operation can also be used to switch between tables that need to be updated on the file update interface.
[0211] This is illustrative; please refer to it. Figure 5 Below the local file in interface 500, controls 509 and 510 are displayed. Clicking control 509 displays the "Robot Table" in the local file in interface 500; alternatively, clicking control 509 displays the "Robot Table" simultaneously in both the local and remote files in interface 500. Clicking control 510 displays the "Item Table" in the local file in interface 500; alternatively, clicking control 510 displays the "Item Table" simultaneously in both the local and remote files in interface 500.
[0212] Optionally, the update operation can also be used to modify cell content on the file update interface.
[0213] This is illustrative; please refer to it. Figure 5 In interface 500, click on local file cell 511. Input bar 512 will display the corresponding content of 511. You can directly modify the content of cell 511 in input bar 512. Just press Enter to complete the modification, and the modified content will be updated synchronously in remote file cell 513.
[0214] Optionally, after the update operation is complete, that is, after the first branch file and the second branch file are merged, the first branch file and the second branch file can be saved. Specifically, the first branch file can be saved to the local terminal, and the second branch file can be sent to a remote terminal for saving. For illustration, please refer to [reference needed]. Figure 13 The screen at 1300 shows the screen indicating a successful save. After a successful save, you can use the shortcut Alt+Q to exit or click the × in the upper right corner to exit.
[0215] In summary, the table file update method provided in this application provides developers with a visual interface for resolving conflicts in branch files during the merging process by displaying the first branch file and the second branch file on the file update interface. This improves the human-computer interaction efficiency when resolving Git branch merge conflicts. Furthermore, the basic unit of the update operation on this interface is a region composed of multiple cells (e.g., single row, multiple rows, etc.), which improves the processing efficiency of developers during the file update process.
[0216] Figure 14 This is an overall workflow diagram of a table file updating method provided in an embodiment of this application, such as... Figure 14 As shown, the method includes the following steps:
[0217] S1401: Begin.
[0218] This example illustrates how to use a Git-based application as an example. After starting, preprocessing is required in Git, including a configurable branch conflict resolution tool. For example, adding a configuration to the `.gitconfig` file in the `C:\Users\username` directory allows the `git mergetool` tool to be invoked when a conflict occurs. Below is the code for adding this configuration:
[0219]
[0220] The path to the executable file (.exe) that the developer needs can be changed to "D: / Project / ExcelMerge / excelmerge.exe".
[0221] The following is the code that uses the `git mergetool` command to open the conflict resolution tool for the current branch when a file merge conflict occurs in Git:
[0222] E:\he11o-world>git pu11
[0223] hint:Pulling without specifying how to reconcile divergent branches
[0224] hint:discouraged.You can squelch this message by running one of the following
[0225] hint:commands sometime before your next pul1:
[0226] hint:
[0227] hint:
[0228] hint:git config pull.rebase false#merge(the default strategy)
[0229] hint:git config pull.rebase true#rebase
[0230] hint:git config pull.ff only#fast-forward only
[0231] hint:
[0232] hint:You can replace "git config" with "git config --global" to set a default
[0233] hint:preference for all repositories. You can also pass --rebase, --no-rebase,
[0234] hint:or --ff-only on the command line to override the configured default per
[0235] hint:invocation.
[0236] warning:Cannot merge binary files:contact_list.x1sm(HEAD vs. 78063e9ee68cdf66b93586d73fc72d2f62cec5ef)
[0237] Auto-merging contact_list.xlsm
[0238] CONFLICT(content):Merge conflict in contact_list.x1sm Automatic merge failed;fix conflicts and then commit the result.
[0239] E:\hel1o - wor1d>git mergetool
[0240] S1402: Read in the local branch file, the remote branch file, and the formula information.
[0241] This example illustrates how the content and formula information of each cell in the local branch's Excel file are read and stored in a two-dimensional table, with each position in the table corresponding one-to-one with a cell in the Excel file. The content and formula information of each cell in the remote branch's Excel file are also read and stored in a two-dimensional table.
[0242] S1403: Calculate the difference region.
[0243] To illustrate, by taking each row in the two-dimensional table corresponding to the local branch and the remote branch as a unit, we can get two sequences. Each element of the sequence is the content of a row in Excel. The two sequences store the content of the local branch and the remote branch respectively.
[0244] The steps for calculating the difference region also include:
[0245] (1) Use the Myers difference algorithm to calculate the longest common subsequence of the two sequences, and obtain the position set 1 and position set 2 of each element in the longest common subsequence in the two sequences.
[0246] (2) Initialize the difference region.
[0247] The following example illustrates the process of generating the difference region, using the sequence text1 = {1, 3, 4, 5, 6, 7, 7, 8} and text2 = {3, 5, 7, 4, 8, 6, 7, 8, 2} as an example. The longest common subsequence is {3, 4, 6, 7, 8}, corresponding to the position set 1 of text1 being {2, 3, 5, 7, 8} and the position set 2 of text2 being {1, 4, 6, 7, 8}.
[0248] Step 1: i = 0 is a cursor pointing to text1, pointing to the first position of text1, i = 1; j = 0 is a cursor pointing to text2, pointing to the first position of text2, j = 1. Repeat step 2 until both i and j reach the end of the sequence.
[0249] Step 2:
[0250] If i belongs to position set 1 and j belongs to position set 2, then add i and j;
[0251] If i belongs to position set 1 and j does not belong to position set 2, then increase j until j = j1 belongs to position set 2. Then the region [j: j1] is the second difference region (corresponding to the second difference result above). Add the corresponding blank line in text1 so that i = j1.
[0252] If i does not belong to position set 1 and j belongs to position set 2, then increase i until i = i1 belongs to position set 1. Then the region [i: i1] is the first difference region (corresponding to the first difference result above). Add the corresponding blank line in text2 so that j = i1.
[0253] If i does not belong to position set 1 and j does not belong to position set 2, then increase i and j until i = i1 belongs to position set 1 or j = j1 belongs to position set 2. The interval [i: i1] and [j: j1] is the third difference region (corresponding to the third difference result above).
[0254] S1404: UI interface displays differences in certain areas.
[0255] Indicatively, after identifying the first, second, and third difference regions, these regions, along with the common region (corresponding to the longest common subsequence), are displayed together on the visualization interface of the branch conflict handling tool. They are distinguished from each other by marking them with different colors, for example: marking the first difference region in green, the second difference region in red, the third difference region in blue, and the common region in black.
[0256] S1405: In the difference region, select to retain the contents of the local branch file or the remote branch file, and record the correspondence between the changed line numbers and the initial line numbers.
[0257] In other words, when the file content is modified in the UI, the correspondence between the modified line number and the initial line number is recorded.
[0258] Optionally, after selecting to retain the content of the local or remote branch file in the difference region, the difference region needs to be recalculated after each modification. Because the above process adds a whitespace sequence to text1 and text2, making the number of elements (corresponding lines) in text1 and text2 the same, and because all subsequent line additions and deletions are synchronized in text1 and text2, the number of elements (corresponding lines) in text1 and text2 remains the same throughout the update process. Therefore, when modifying the file content in the UI, the steps to recalculate the difference region include:
[0259] Step 1: i = 0 is a cursor pointing to text1 and text2, pointing to the first position of text1 (i = 1) and the first position of text2 (i = 1). Repeat step 2 until i reaches the end of the sequence.
[0260] Step 2:
[0261] If i belongs to both position set 1 and position set 2, increment i;
[0262] If text1[i] is an empty line, increment i until text1[i1] is not empty, and the region [i:i1] is the second difference region;
[0263] If text2[i] is an empty line, increment i until text2[i1] is not empty, and the region [i:i1] is the first difference region;
[0264] If text1[i] is not equal to text2[i], then increment i until i1 belongs to position set 1 or i1 belongs to position set 2, and the region [i: i1] is the third difference region.
[0265] S1406: If all conflicts are resolved, modify the formula information according to the correspondence between the new row numbers and the initial row numbers.
[0266] This illustration shows how the reference addresses of formula information in cells within the merged file are adjusted based on the correspondence between the new and initial row numbers. The reference address indicates how the formula information in a specified cell within the table references other cells.
[0267] S1407: Save file contents.
[0268] Optionally, once all conflicts are resolved, that is, after the local and remote files are merged, the local and remote files can be saved. In other words, the local file can be saved to the local terminal, and the remote file can be sent to the remote terminal for saving.
[0269] S1408: End.
[0270] This is illustrative; please refer to it. Figure 14 The screen at 1400 shows the screen indicating a successful save. After a successful save, you can use the shortcut Alt+Q to exit or click the × in the upper right corner to exit.
[0271] Below is the code for this tool to process an Excel spreadsheet with tens of thousands of rows, save, and submit it:
[0272]
[0273]
[0274] As can be seen from the code, this solution can quickly resolve Excel file conflicts caused by merging branches in Git. For an Excel spreadsheet with tens of thousands of rows, the performance of this solution is as follows:
[0275] Data reading, preprocessing, and interface loading take approximately 10 seconds; real-time recalculation of the longest common subsequence and difference regions takes approximately 30 milliseconds; saving speed is within 10 seconds. This demonstrates that the table file update method provided in this application embodiment can effectively improve the efficiency of handling merge conflicts between different branch files.
[0276] Please refer to Figure 15 The diagram illustrates a structural block diagram of a form file updating apparatus provided in an exemplary embodiment of this application, the apparatus comprising the following modules:
[0277] Display module 1500 is used to display a first difference region in a first branch file. The first branch file is a table file stored in a first file processing terminal for target content. The first difference region is a region aggregated by a first target cell set according to a preset aggregation method. The target cell set includes multiple cells in the first branch file that differ from the second branch file. The second branch file is a table file stored in a second file processing terminal for the target content.
[0278] The display module 1500 is further configured to display a second difference region in the second branch file. The second difference region is a region formed by aggregating a second target cell set according to the preset aggregation method. The second target cell set includes multiple cells in the second branch file that differ from the first branch file.
[0279] The display module 1500 is further configured to display a target table file in response to receiving an update operation. The target table file is a table generated by synchronizing the difference regions containing multiple cells in the first branch file and the second branch file based on the update operation. The difference regions include at least one of the first difference regions and the second difference regions.
[0280] In some optional embodiments, the display module 1500 is further configured to display the first branch file and the second branch file on a file update interface, the file update interface including a first update control, the first update control being used to synchronize the first branch file and the second branch file through position updates; the display module 1500 is further configured to receive a first trigger operation on the first update control; the display module 1500 is further configured to, in response to the first trigger operation, add the second target cell set above the location of the first target cell set, and add the first target cell set below the location of the second target cell set; or, add the second target cell set below the location of the first target cell set, and add the first target cell set above the location of the second target cell set.
[0281] In some optional embodiments, the file update interface includes a second update control, which is used to synchronize the first branch file and the second branch file by replacing data content; the display module 1500 is also used to receive a second trigger operation on the second update control; the display module 1500 is also used to replace the first target cell set with the second target cell set in response to the second trigger operation; or, replace the second target cell set with the first target cell set.
[0282] In summary, the table file updating device provided in this application provides developers with a visual interface for resolving conflicts in branch files during the merging process by displaying the first branch file and the second branch file on the file updating interface, thereby improving the human-computer interaction efficiency when resolving Git branch merging conflicts. Furthermore, the basic unit of the update operation on this interface is a region composed of multiple cells (e.g., a single row, multiple rows, etc.), which improves the processing efficiency of developers during the file updating process.
[0283] Please refer to Figure 16 The diagram illustrates a structural block diagram of a form file updating apparatus provided in an exemplary embodiment of this application, the apparatus comprising the following modules:
[0284] The acquisition module 1600 is used to acquire a first branch file and a second branch file, wherein the first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content;
[0285] The aggregation module 1610 is used to aggregate multiple cells in the first branch file into a first sequence according to a preset aggregation method; and to aggregate multiple cells in the second branch file into a second sequence according to the preset aggregation method.
[0286] Analysis module 1620 is used to perform differential analysis on the first sequence and the second sequence to obtain differential analysis results, which are used to indicate the content in the first sequence and the second sequence that has data or positional differences;
[0287] The receiving module 1630 is used to receive update operations based on the difference analysis results to obtain a target table file, wherein the target table file is a table generated after the first branch file and the second branch file are synchronized and updated.
[0288] Please refer to Figure 17 In some optional embodiments, the aggregation module 1610 is configured to aggregate multiple cells in a specified row of the first branch file into the first sequence; and aggregate multiple cells in the specified row of the second branch file into the second sequence; or, it is configured to aggregate multiple cells in a specified column of the first branch file into the first sequence; and aggregate multiple cells in the specified column of the second branch file into the second sequence.
[0289] In some optional embodiments, the analysis module 1620 includes:
[0290] The determining unit 1621 is used to perform differential analysis on the first sequence and the second sequence to determine common subsequences, wherein the common subsequences are used to indicate sequences in the first sequence and the second sequence that have the same data content;
[0291] Alignment unit 1622 is used to align the first sequence and the second sequence according to the order of the common subsequence in the first sequence and the order of the common subsequence in the second sequence, to obtain a first alignment result of the first sequence and a second alignment result of the second sequence, wherein the common subsequence has the same order in the first alignment result and the second alignment result;
[0292] Processing unit 1623 is used to obtain the difference analysis result based on the first alignment result and the second alignment result.
[0293] In some optional embodiments, the alignment unit 1622 is used to align the common subsequences in the first sequence and the second sequence; the alignment unit 1622 is used to add a first blank sequence with empty data content to the first sequence and a second blank sequence with empty data content to the second sequence during the alignment process of the common subsequences in the first sequence and the second sequence; the alignment unit 1622 is used to obtain the first alignment result and the second alignment result in response to the end of the alignment process of the common subsequences in the first sequence and the second sequence.
[0294] In some alternative embodiments, the apparatus further includes:
[0295] The determining module 1640 is used to determine a first position set based on the arrangement order of the common subsequences in the first sequence, and to determine a second position set based on the arrangement order of the common subsequences in the second sequence; the alignment unit 1622 is further used to, if the position of the k-th subsequence in the first sequence does not belong to the first position set, and the position of the h-th subsequence in the second sequence belongs to the second position set, increment k until the position of the (k+n)-th subsequence in the first sequence belongs to the first position set, and add n empty data elements to the second sequence that are aligned with the n subsequences above the (k+n)-th subsequence position. The first blank sequence is defined as n empty subsequences, where k, h, and n are positive integers. The alignment unit 1622 is further configured to, if the position of the p-th subsequence in the first sequence belongs to the first position set and the position of the q-th subsequence in the second sequence does not belong to the second position set, increment q until the position of the (q+m)-th subsequence in the second sequence belongs to the second position set, add m empty subsequences aligned with the m subsequences above the (q+m)-th subsequence position to the first sequence, and define the m empty subsequences as the second blank sequence, where p, q, and m are positive integers.
[0296] In some optional embodiments, the first alignment result includes a first difference sequence, and the second alignment result includes a second difference sequence, wherein the first difference sequence and the second difference sequence are aligned with each other and have different data contents; the receiving module 1630 is configured to receive a first update operation based on the difference analysis result, the first update operation being configured to update the difference analysis result by means of position update; the receiving module 1630 is configured to add the second difference sequence below the position of the first difference sequence in the first alignment result, and add the first difference sequence above the position of the second difference sequence in the second alignment result; or, add the second difference sequence above the position of the first difference sequence in the first alignment result, and add the first difference sequence below the position of the second difference sequence in the second alignment result.
[0297] In some optional embodiments, the receiving module 1630 is configured to receive a second update operation based on the difference analysis result, the second update operation being configured to update the difference analysis result by replacing data content; the receiving module 1630 is configured to replace a first specified sequence in the first alignment result with a second specified sequence in the second alignment result; or, replace a second specified sequence in the second alignment result with a first specified sequence in the first alignment result; wherein the first specified sequence and the second specified sequence are aligned with each other.
[0298] In some optional embodiments, the cells in the first branch file and the second branch file store formula information; the device further includes:
[0299] The adjustment module 1650 is used to adjust the reference addresses of formula information in cells of the first branch file and the second branch file. The reference addresses are used to indicate the situation where the formula information of a specified cell in the table references other cells.
[0300] In summary, the tabular file updating device provided in this application firstly aggregates multiple cells in the obtained first branch file and second branch file according to a preset aggregation method to obtain a first sequence and a second sequence; secondly, it performs differential analysis on the first sequence and the second sequence to obtain analysis results; finally, it merges the first branch file and the second branch file based on the analysis results through an update operation received on the terminal to obtain the target updated file. Since the data of a single subsequence in the first sequence and the second sequence represents multiple cells aggregated according to the preset aggregation method, the basic unit of data update during the update operation is multiple cells, which improves the data update efficiency in the process of merging the first branch file and the second branch file.
[0301] It should be noted that the table file updating device provided in the above embodiments is only an example of the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the table file updating device and table file updating method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0302] Figure 18 This illustration shows a structural block diagram of a computer device 1800 provided in an exemplary embodiment of this application. The computer device 1800 may be a smartphone, tablet computer, Moving Picture Experts Group Audio Layer III (MP3) player, Moving Picture Experts Group Audio Layer IV (MP4) player, laptop computer, or desktop computer. The computer device 1800 may also be referred to as a user device, portable computer device, laptop computer device, desktop computer device, or other names.
[0303] Typically, computer device 1800 includes a processor 1801 and a memory 1802.
[0304] Processor 1801 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1801 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). Processor 1801 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1801 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1801 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0305] The memory 1802 may include one or more computer-readable storage media, which may be non-transitory. The memory 1802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1802 is used to store at least one instruction, which is executed by the processor 1801 to implement the table file update method provided in the method embodiments of this application.
[0306] This is illustrative; the computer device 1800 also includes other components, as those skilled in the art will understand. Figure 18 The structure shown does not constitute a limitation on the computer device 1800, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0307] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. This program can be stored in a computer-readable storage medium, which may be a computer-readable storage medium included in the memory described in the above embodiments; or it may be a standalone computer-readable storage medium not assembled into a computer device. The computer-readable storage medium stores at least one instruction, at least one program segment, a code set, or an instruction set, which is loaded and executed by the processor to implement any of the table file update methods described in the above embodiments.
[0308] Optionally, the computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), solid-state drives (SSDs), or optical discs, etc. The random access memory may include resistive random access memory (ReRAM) and dynamic random access memory (DRAM). The sequence numbers of the embodiments in this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0309] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0310] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for updating a table file, characterized in that, The method includes: The first branch file displays a first difference region. The first branch file is a table file stored in the first file processing terminal for the target content. The first difference region is a region aggregated by the first target cell set according to a preset aggregation method. The first target cell set includes multiple cells in the first branch file that differ from the second branch file. The second branch file is a table file stored in the second file processing terminal for the target content. The second branch file displays a second difference region, which is a region formed by aggregating the second target cell set according to the preset aggregation method. The second target cell set includes multiple cells in the second branch file that differ from the first branch file. In response to receiving an update operation, a target table file is displayed. The target table file is a table generated by synchronizing the difference regions containing multiple cells in the first branch file and the second branch file based on the update operation, wherein the difference regions include at least one of the first difference regions and the second difference regions.
2. The method according to claim 1, characterized in that, The method further includes: The file update interface displays the first branch file and the second branch file. The file update interface includes a first update control, which is used to synchronize the first branch file and the second branch file by means of position update. The response to receiving an update operation, displaying the target table file, includes: Receive the first trigger operation on the first update control; In response to the first triggering operation, a second target cell set is added above the location of the first target cell set, and a first target cell set is added below the location of the second target cell set; or, a second target cell set is added below the location of the first target cell set, and a first target cell set is added above the location of the second target cell set.
3. The method according to claim 2, characterized in that, The file update interface also includes a second update control, which is used to synchronize the first branch file and the second branch file by replacing data content. The response to receiving an update operation, displaying the target table file, includes: Receive a second trigger operation on the second update control; In response to the second triggering operation, the first target cell set is replaced with the second target cell set; or, the second target cell set is replaced with the first target cell set.
4. A method for updating a table file, characterized in that, The method includes: Obtain a first branch file and a second branch file, wherein the first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content; According to a preset aggregation method, multiple cells in the first branch file are aggregated into a first sequence; and, according to the preset aggregation method, multiple cells in the second branch file are aggregated into a second sequence; A differential analysis is performed on the first sequence and the second sequence to obtain differential analysis results, which are used to indicate the content in the first sequence and the second sequence that has data or positional differences; Based on the difference analysis results, an update operation is received to obtain a target table file, which is a table generated after the first branch file and the second branch file are synchronized and updated.
5. The method according to claim 4, characterized in that, The step of aggregating multiple cells in the first branch file into a first sequence according to a preset aggregation method; and aggregating multiple cells in the second branch file into a second sequence according to the preset aggregation method, includes: Aggregate multiple cells in a specified row of the first branch file into the first sequence; and aggregate multiple cells in the specified row of the second branch file into the second sequence; or, Aggregate multiple cells in a specified column in the first branch file into the first sequence; and aggregate multiple cells in the specified column in the second branch file into the second sequence.
6. The method according to claim 4, characterized in that, The differential analysis of the first sequence and the second sequence to obtain the differential analysis results includes: A differential analysis is performed on the first sequence and the second sequence to determine common subsequences, which are used to indicate sequences in the first sequence and the second sequence that have the same data content; Based on the order of the common subsequences in the first sequence and the order of the common subsequences in the second sequence, the first sequence and the second sequence are aligned to obtain a first alignment result of the first sequence and a second alignment result of the second sequence, wherein the common subsequences are arranged in the same order in the first alignment result and the second alignment result. The difference analysis results are obtained based on the first alignment result and the second alignment result.
7. The method according to claim 6, characterized in that, The step of aligning the first sequence and the second sequence according to the order of the common subsequences in the first sequence and the order of the common subsequences in the second sequence to obtain a first alignment result of the first sequence and a second alignment result of the second sequence includes: Align the common subsequences in the first sequence and the second sequence according to their order of arrangement in the first sequence and the second sequence; During the alignment of the common subsequences in the first sequence and the second sequence, a first blank sequence with empty data content is added to the first sequence, and a second blank sequence with empty data content is added to the second sequence; Upon completion of the alignment process of the common subsequences in the first sequence and the second sequence, the first alignment result and the second alignment result are obtained.
8. The method according to claim 7, characterized in that, The method further includes: A first set of positions is determined based on the order of the common subsequences in the first sequence, and a second set of positions is determined based on the order of the common subsequences in the second sequence; The addition of a first blank sequence with empty data content to the first sequence and a second blank sequence with empty data content to the second sequence include: If the position of the kth subsequence in the first sequence does not belong to the first position set, and the position of the hth subsequence in the second sequence belongs to the second position set, increment k until the position of the (k+n)th subsequence in the first sequence belongs to the first position set. Add n empty subsequences in the second sequence that are aligned with the n subsequences above the position of the (k+n)th subsequence. Use the n empty subsequences as the first blank sequence. k, h, and n are positive integers. If the position of the p-th subsequence in the first sequence belongs to the first position set, and the position of the q-th subsequence in the second sequence does not belong to the second position set, increment q until the position of the (q+m)-th subsequence in the second sequence belongs to the second position set. Add m empty subsequences to the first sequence that are aligned with the m subsequences above the position of the (q+m)-th subsequence. Use the m empty subsequences as the second blank sequence. p, q, and m are positive integers.
9. The method according to any one of claims 6 to 8, characterized in that, The first alignment result includes a first difference sequence, and the second alignment result includes a second difference sequence, wherein the first difference sequence and the second difference sequence are aligned with each other and have different data contents; The step of receiving an update operation based on the difference analysis results to obtain the target table file includes: Based on the difference analysis results, a first update operation is received, wherein the first update operation is used to update the difference analysis results by means of position update; Add the second difference sequence below the position of the first difference sequence in the first alignment result, and add the first difference sequence above the position of the second difference sequence in the second alignment result; or, add the second difference sequence above the position of the first difference sequence in the first alignment result, and add the first difference sequence below the position of the second difference sequence in the second alignment result.
10. The method according to any one of claims 6 to 8, characterized in that, The step of receiving an update operation based on the difference analysis results to obtain the target table file includes: Based on the difference analysis results, a second update operation is received, which is used to update the difference analysis results by replacing data content; Replace the first specified sequence in the first alignment result with the second specified sequence in the second alignment result; or replace the second specified sequence in the second alignment result with the first specified sequence in the first alignment result; The first specified sequence and the second specified sequence are aligned with each other.
11. The method according to claim 4, characterized in that, The cells in the first branch file and the second branch file contain formula information; After receiving the update operation based on the difference analysis results and obtaining the target table file, the process further includes: Adjust the reference addresses of formula information in the cells of the first branch file and the second branch file. The reference addresses are used to indicate whether the formula information of a specified cell in the table references other cells.
12. A form file updating device, characterized in that, The device includes: The display module is used to display a first difference region in a first branch file. The first branch file is a table file stored in a first file processing terminal for the target content. The first difference region is a region aggregated by a first target cell set according to a preset aggregation method. The first target cell set includes multiple cells in the first branch file that differ from those in the second branch file. The second branch file is a table file stored in a second file processing terminal for the target content. The display module is further configured to display a second difference region in the second branch file. The second difference region is a region formed by aggregating a second target cell set according to the preset aggregation method. The second target cell set includes multiple cells in the second branch file that differ from the first branch file. The display module is further configured to display a target table file in response to receiving an update operation. The target table file is a table generated by synchronizing the difference regions containing multiple cells in the first branch file and the second branch file based on the update operation, wherein the difference regions include at least one of the first difference regions and the second difference regions.
13. A form file updating device, characterized in that, The device includes: The acquisition module is used to acquire a first branch file and a second branch file, wherein the first branch file is a table file stored in the first file processing terminal for the target content, and the second branch file is a table file stored in the second file processing terminal for the target content; An aggregation module is used to aggregate multiple cells in a first branch file into a first sequence according to a preset aggregation method; and to aggregate multiple cells in a second branch file into a second sequence according to the preset aggregation method; An analysis module is used to perform differential analysis on the first sequence and the second sequence to obtain differential analysis results, which are used to indicate the content in the first sequence and the second sequence that has data or positional differences. The receiving module is used to receive update operations based on the difference analysis results and obtain a target table file, which is a table generated after the first branch file and the second branch file are synchronized and updated.
14. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one program, which is loaded and executed by the processor to implement the table file update method as described in any one of claims 1 to 11.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one piece of program code, which is loaded and executed by a processor to implement the table file update method as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Data processing method and device for spreadsheet
CN107766314A
Collaborative updating method and device for online document, equipment and storage medium
CN110019279A