CN113296756A - Merging method and system for user-modifiable workpieces - Google Patents

Merging method and system for user-modifiable workpieces Download PDF

Info

Publication number
CN113296756A
CN113296756A CN202110591005.6A CN202110591005A CN113296756A CN 113296756 A CN113296756 A CN 113296756A CN 202110591005 A CN202110591005 A CN 202110591005A CN 113296756 A CN113296756 A CN 113296756A
Authority
CN
China
Prior art keywords
workpiece
merging
user
temp
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110591005.6A
Other languages
Chinese (zh)
Inventor
邵力强
周明聪
许忠文
袁瑞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Xieying Technology Co ltd
Original Assignee
Chengdu Xieying Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Xieying Technology Co ltd filed Critical Chengdu Xieying Technology Co ltd
Priority to CN202110591005.6A priority Critical patent/CN113296756A/en
Publication of CN113296756A publication Critical patent/CN113296756A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/35Creation or generation of source code model driven

Abstract

The invention discloses a merging system capable of modifying workpieces by a user, which comprises the following steps: s1, collecting a workpiece generated by a software process in the current iteration process to obtain a temp workpiece; s2, judging whether the temp workpiece is different from the gen workpiece, if so, entering a step S3, otherwise, deleting the temp workpiece and ending; s3, judging whether a source workpiece exists, if so, entering a step S4, otherwise, copying the temp workpiece into the source workpiece category, and entering a step S5; s4, judging whether the workpiece which can be modified by the user is modified, if yes, copying the temp workpiece to the merge workpiece category, executing the merging step, and entering the step S5, otherwise, copying the temp workpiece to the source workpiece category, and entering the step S5; s5, copying the temp workpiece to the gen workpiece category, and deleting the temp workpiece.

Description

Merging method and system for user-modifiable workpieces
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a merging method and a merging system for workpieces capable of being modified by a user.
Background
As computer software development becomes more complex, software developers are increasingly using models. For example, a UML creation model may be used, a Model Driven Architecture (MDA) tool to generate source code and other artifacts, and a model of software used as the basis for source code generation. Artifacts can be generally described as tangible byproducts generated during software development and include independent software components that can run on a computer. Examples of workpieces include, but are not limited to: code, build generation files, component descriptors, documents, and models. After the MDA tool generates the artifacts, the user may modify some of the artifacts. However, software development is an iterative process where the user modifies the source model and regenerates the source code. In fact, the user may modify the model and the artifact generated by the model simultaneously.
According to one known method, code and a generate folder are generated into a build environment directory set in system environment variables. In the built catalog, a number of artifacts are contained, which are generated based on the MDA tool and can be modified by the user. If the model that generated the artifact is changed, any user modifications to the artifact will be overwritten when the artifact is regenerated from the model. This modification may also create other problems, for example, modifying a file outside of the production process may create a new need to maintain these changes with each different production of the automated artifact source. Furthermore, if the model and the artifact generated by the model are modified simultaneously, a conflict may occur.
Disclosure of Invention
Aiming at the defects in the prior art, the merging method and the merging system for the user-modifiable workpieces provided by the invention solve the problems in the prior art.
In order to achieve the purpose of the invention, the invention adopts the technical scheme that: a method of merging user-modifiable workpieces, comprising the steps of:
s1, collecting a workpiece generated by a software process in the current iteration process to obtain a temp workpiece;
s2, judging whether the temp workpiece is different from the gen workpiece, if so, entering a step S3, otherwise, deleting the temp workpiece and ending;
s3, judging whether a source workpiece exists, if so, entering a step S4, otherwise, copying the temp workpiece into the source workpiece category, and entering a step S5;
s4, judging whether the workpiece which can be modified by the user is modified, if yes, copying the temp workpiece to the merge workpiece category, executing the merging step, and entering the step S5, otherwise, copying the temp workpiece to the source workpiece category, and entering the step S5;
s5, copying the temp workpiece into the gen workpiece category, and deleting the temp workpiece;
the gen artifact represents a previously generated artifact and the merge artifact represents a merged artifact.
Further, the workpiece in step S1 includes code, component generation files, component descriptors, documents, and models, and the user-modifiable workpiece includes all history generation workpieces.
Further, the specific method for determining whether the temp workpiece and the gen workpiece are different in step S2 is as follows: and comparing the temp workpiece with the gen workpiece line by adopting a two-way merging algorithm, and judging whether the files in the temp workpiece and the gen workpiece are completely the same or not, if so, the files are the same, otherwise, the files are different.
Further, the specific method for executing the merging step in step S4 is as follows: traversing all elements of the temp workpiece and the merge workpiece, respectively storing the elements in the source set and the target set, deleting source elements which do not have corresponding items with the target elements in the source set, adding the source elements which do not have corresponding items in the target set, redirecting the reference to the corresponding target elements, and finishing the merging step.
Further, the detecting of the merging conflict is performed by a merging function before the performing of the merging step.
The invention has the beneficial effects that:
(1) the invention provides a merging method and a merging system for workpieces capable of being modified by a user, which can quickly judge whether generated workpieces and modified workpieces need to be merged, effectively reduce the workload of the user and improve the working efficiency.
(2) The invention adopts two-way combination and recursive three-way combination algorithms to automatically judge whether combination is needed or not, thereby reducing the error rate of possible manual operation. Embodiments of the present invention may be extended to a variety of industries and fields of implementation based on the principles and embodiments of the present invention.
A merging system capable of modifying workpieces by a user comprises a workpiece acquisition module, a workpiece generation comparison module, a merging analysis module, a workpiece merging module, a previous workpiece generation module and a user workpiece comparison module;
the generated workpiece comparison module is respectively in communication connection with the previously generated workpiece module, the workpiece acquisition module and the merging analysis module, and the merging analysis module is respectively in communication connection with the previously generated workpiece module, the workpiece merging module and the user workpiece comparison module.
Further, the workpiece collecting module is used for collecting the current generated workpiece and transmitting the current generated workpiece to the generated workpiece comparator module; the previously generated workpiece module is used for storing previously generated workpieces; the workpiece comparator module is used for receiving the previously generated workpiece and the currently generated workpiece, comparing whether the previously generated workpiece and the currently generated workpiece are the same or not, if the previously generated workpiece and the currently generated workpiece are different, transmitting the currently generated workpiece to the merging analysis module, and if not, deleting the currently generated workpiece; the merging analysis module is used for reading whether the user-modifiable workpiece is modified or not, if so, executing a merging step, and otherwise, updating the user-modifiable workpiece and the previously generated workpiece by using the currently generated workpiece; the workpiece merging module is used for executing a merging step; the user workpiece comparison module is used for acquiring whether the workpiece which can be modified by the user is modified or not and sending the modified state to the merging analysis module.
The invention has the beneficial effects that: the merging system for the workpieces capable of being modified by the user is provided, whether the workpieces need to be merged or not is judged automatically, manual comparison is not needed, the workload of the user is effectively reduced, the working efficiency is improved, merging is completed automatically according to a merging function, and the error rate which possibly occurs in manual operation is reduced.
Drawings
FIG. 1 is a flow chart of a merging method for user-modifiable workpieces according to the present invention;
FIG. 2 is a schematic diagram of a merging system for user-modifiable workpieces according to the present invention.
Detailed Description
The following description of the embodiments of the present invention is provided to facilitate the understanding of the present invention by those skilled in the art, but it should be understood that the present invention is not limited to the scope of the embodiments, and it will be apparent to those skilled in the art that various changes may be made without departing from the spirit and scope of the invention as defined and defined in the appended claims, and all matters produced by the invention using the inventive concept are protected.
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
As shown in fig. 1, a method of merging user-modifiable workpieces, comprising the steps of:
s1, collecting a workpiece generated by a software process in the current iteration process to obtain a temp workpiece;
s2, judging whether the temp workpiece is different from the gen workpiece, if so, entering a step S3, otherwise, deleting the temp workpiece and ending;
s3, judging whether a source workpiece exists, if so, entering a step S4, otherwise, copying the temp workpiece into the source workpiece category, and entering a step S5;
s4, judging whether the workpiece which can be modified by a user is modified, judging by a comparison algorithm, wherein the comparison algorithm is described by Java language, acquiring all metadata of the model, rewriting hashCode () and equals () methods of the object, the equals is judged, the hashCode reduces the search cost and improves the execution speed; if so, copying the temp artifact into the merge artifact type, executing the merge step, and proceeding to step S5, otherwise, copying the temp artifact into the source artifact type, and proceeding to step S5;
s5, copying the temp workpiece into the gen workpiece category, and deleting the temp workpiece;
the gen artifact represents a previously generated artifact and the merge artifact represents a merged artifact.
The workpiece in step S1 includes code, component generation files, component descriptors, documents, and models, and the user-modifiable workpiece includes all history generation workpieces.
The specific method for judging whether the temp workpiece and the gen workpiece are different in step S2 is as follows: and comparing the temp workpiece with the gen workpiece line by adopting a two-way merging algorithm, and judging whether the files in the temp workpiece and the gen workpiece are completely the same or not, if so, the files are the same, otherwise, the files are different.
The specific method for executing the merging step in step S4 is as follows: traversing all elements of the temp workpiece and the merge workpiece, respectively storing the elements in the source set and the target set, deleting source elements which do not have corresponding items with the target elements in the source set, adding the source elements which do not have corresponding items in the target set, redirecting the reference to the corresponding target elements, and finishing the merging step.
The detection of a merging conflict is performed by a merging function before the step of performing merging.
In this embodiment, the user-modifiable artifact may be modified multiple times by the user and/or by changes in the generated artifact. The current and previously generated artifacts are compared to the user modifiable artifact. A merge condition is detected and a merged item is generated only if it is determined that the current and previously generated items are different and that a user-modifiable artifact has been modified after generation. The merging step may include an automatic or manual merging operation, which may be performed in response to the generation of merged artifacts. The process may be described as a method of integrating changes to artifacts generated from and modified outside of a software process.
In addition to artifacts that are automatically generated by a user modifiable in a software process, embodiments of the present invention also create current and previously generated artifacts that correspond to the generation of artifacts in current and previous iterations of the software process. In addition to user-modifiable artifacts, known methods may retain a single "generated" version, but use two such copies to perform the change impact analysis described in the present invention.
The term "artifact" as used herein refers to a tangible byproduct of a software development process, and may include individual software components that may run on a computer, examples of artifacts including, but not limited to: code, building block generation files, component descriptors, documents, and models. The term "user-modifiable artifact" as used in this disclosure refers to an artifact that is generated as an iterative output of a software process in a computing environment. A software process may be described as part of generating an artifact. The artifacts that are created by the software process when the artifact is modifiable by the user and exist without using an embodiment of the present invention. This artifact can be viewed and modified by the user, and is most similar to artifacts generated in the "build" catalog. In the present embodiment, the artifact generating section is a model conversion engine that can generate a model as a user-modifiable artifact.
The terms "temp" file and "currently generated artifact" are used herein to refer to files generated from a current iteration of a software process and may be described as the output of the process. Temp files are used by embodiments of the present invention to determine if merging is required and are not manipulated by the user to determine if the generated artifact has changed. In a model-based environment, it may be described as determining whether a model has been altered. The lifetime of the temp file is less than the process iteration. The terms "gen" file and "previously generated artifact" are used herein to refer to files generated from previous iterations of a software process and may be described as the output of the process. The previous iteration may be the last or previous iteration of the software process in which an item was modified. The previous iterations may be the same iterations of the process for generating the user-modifiable artifact. The gen file may exist after the current iteration of the software process. It is used by embodiments of the present invention to determine whether a merge is required and is not manipulated by the user.
The gen file is compared to the temp file to determine if the generated workpiece has been altered. The gen file is compared to the user modifiable artifact to determine if the artifact was modified after generation. In a model-based environment, these components may be described as determining whether a model has been altered. At the end of the flow iteration, the gen file always contains the latest artifact and, when actually implemented on disk, is the version written the last time the file was changed. In this embodiment, the gen file is updated or modified in response to detection of a change in the generated workpiece.
According to one embodiment of the present invention, a merge condition is identified and a merged artifact is created only in response to a determination that the generated artifact has changed and that a user-modifiable artifact has been modified after generation. The terms "merge" file and "merged artifact" are used herein to denote a merged artifact that is accessible to a user. Alternatively, in response to the creation of the merge file, the merge can be performed automatically, or the system user needs to merge and can use the merge file with a user-modifiable artifact. After merging is completed, the merge file will be deleted. Merge functions are well known in the art, and embodiments of the present invention may be used with any number of such functions, without modification according to the particular merge function used.
The gen file and the temp file may be described as "procedure support files" that the user does not need to operate on in order to determine the conditions under which the merging is performed when storing the files. The. gen,. temp and. merge files are artifacts, but will also be referred to in this disclosure as files without limitation, in order to distinguish them from user-modifiable artifacts that are a natural output of a software process.
In this embodiment, the user-modifiable artifact is a software artifact, such as an artifact generated from code generated from a software model, and the artifacts described herein may be generated by any iterative process.
The aforementioned artifacts and files may be stored in a computer readable memory. In this embodiment, the temp and gen files and the merge file and user-modifiable artifacts, which are not manipulated by the user, are all stored in the same directory structure, with each file or artifact having attributes that define viewing/read/write permissions.
In this embodiment, the. temp and. gen file is stored in a first location and the. merge file and user-modifiable artifact are stored in a second location. These locations may be in the same directory structure or in different directory structures. In an exemplary embodiment, the user-modifiable artifact and the merged file are stored in a source directory accessible to the user. The temp and gen files are stored in a production directory that is not manipulated by the user, and attributes may be set to make this directory selectively visible/invisible to the user, if desired.
While the examples will be described in connection with source directory and generate directory structures, this is merely an example and files and artifacts may be stored according to any of the above schemes or other suitable schemes to those of ordinary skill in the art.
The source directory contains the source code for the components in the model, and the user can view and modify artifacts in the source directory structure. Thus, artifacts in the source catalog will include any modifications made by the user after the last code generation operation. The user may view the merged file created in the source directory structure. A generative catalog is a catalog created to avoid merging or minimization whose catalog structure is a mirror of the source catalog structure, the generative catalog not being manipulated by the user.
As shown in FIG. 2, a user modifiable workpiece merge system includes a workpiece acquisition module, a generated workpiece comparison module, a merge analysis module, a workpiece merge module, a previously generated workpiece module, and a user workpiece comparison module;
the generated workpiece comparison module is respectively in communication connection with the previously generated workpiece module, the workpiece acquisition module and the merging analysis module, and the merging analysis module is respectively in communication connection with the previously generated workpiece module, the workpiece merging module and the user workpiece comparison module.
The workpiece acquisition module is used for acquiring a currently generated workpiece and transmitting the currently generated workpiece to the generated workpiece comparator module; the previously generated workpiece module is used for storing previously generated workpieces; the workpiece comparator module is used for receiving the previously generated workpiece and the currently generated workpiece, comparing whether the previously generated workpiece and the currently generated workpiece are the same or not, if the previously generated workpiece and the currently generated workpiece are different, transmitting the currently generated workpiece to the merging analysis module, and if not, deleting the currently generated workpiece; the merging analysis module is used for judging whether the user-modifiable workpiece is modified, if so, executing a merging step, and otherwise, updating the user-modifiable workpiece and the previously generated workpiece by using the currently generated workpiece; the workpiece merging module is used for executing a merging step.
The present embodiments also provide a computer-readable medium storing statements and instructions that, when executed, cause a processor to perform a method for detecting a merge condition of a user-modifiable artifact in a computing environment. The user-modifiable artifact is generated by an iterative software process. The method performed by the processor may comprise the steps and features recited above in relation to a method according to an embodiment of the invention.

Claims (7)

1. A method of merging user-modifiable workpieces, comprising the steps of:
s1, collecting a workpiece generated by a software process in the current iteration process to obtain a temp workpiece;
s2, judging whether the temp workpiece is different from the gen workpiece, if so, entering a step S3, otherwise, deleting the temp workpiece and ending;
s3, judging whether a source workpiece exists, if so, entering a step S4, otherwise, copying the temp workpiece into the source workpiece category, and entering a step S5;
s4, judging whether the workpiece which can be modified by the user is modified, if yes, copying the temp workpiece to the merge workpiece category, executing the merging step, and entering the step S5, otherwise, copying the temp workpiece to the source workpiece category, and entering the step S5;
s5, copying the temp workpiece into the gen workpiece category, and deleting the temp workpiece;
the gen artifact represents a previously generated artifact and the merge artifact represents a merged artifact.
2. The method of claim 1, wherein the artifacts in step S1 include code, component generation files, component descriptors, documents, and models, and wherein the user-modifiable artifacts include all historical generation artifacts.
3. The method of claim 2, wherein the step S2 of determining whether the temp workpiece and the gen workpiece differ comprises: and comparing the temp workpiece with the gen workpiece line by adopting a two-way merging algorithm, and judging whether the files in the temp workpiece and the gen workpiece are completely the same or not, if so, the files are the same, otherwise, the files are different.
4. The method of claim 2, wherein the combining step performed in step S4 is performed by: and traversing all elements of the temp workpiece and the merge workpiece by adopting a recursive three-way merging algorithm, respectively storing the elements in the source set and the target set, deleting source elements which do not have corresponding items with the target elements in the source set, adding source elements which do not have corresponding items in the target set, redirecting the quotes to the corresponding target elements, and finishing the merging step.
5. The method of claim 4, wherein the detecting of merge conflicts is performed by a merge function prior to the performing the merging step.
6. A merging system capable of modifying workpieces by a user is characterized by comprising a workpiece acquisition module, a generated workpiece comparison module, a merging analysis module, a workpiece merging module, a previously generated workpiece module and a user workpiece comparison module;
the generated workpiece comparison module is respectively in communication connection with the previously generated workpiece module, the workpiece acquisition module and the merging analysis module, and the merging analysis module is respectively in communication connection with the previously generated workpiece module, the workpiece merging module and the user workpiece comparison module.
7. The user-modifiable workpiece merge system according to claim 6, wherein said workpiece capture module is adapted to capture a currently generated workpiece and transmit the currently generated workpiece to said generated workpiece comparator module; the previously generated workpiece module is used for storing previously generated workpieces; the workpiece comparator module is used for receiving the previously generated workpiece and the currently generated workpiece, comparing whether the previously generated workpiece and the currently generated workpiece are the same or not, if the previously generated workpiece and the currently generated workpiece are different, transmitting the currently generated workpiece to the merging analysis module, and if not, deleting the currently generated workpiece; the merging analysis module is used for reading whether the user-modifiable workpiece is modified or not, if so, executing a merging step, and otherwise, updating the user-modifiable workpiece and the previously generated workpiece by using the currently generated workpiece; the workpiece merging module is used for executing a merging step; the user workpiece comparison module is used for acquiring whether the workpiece which can be modified by the user is modified or not and sending the modified state to the merging analysis module.
CN202110591005.6A 2021-05-28 2021-05-28 Merging method and system for user-modifiable workpieces Pending CN113296756A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110591005.6A CN113296756A (en) 2021-05-28 2021-05-28 Merging method and system for user-modifiable workpieces

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110591005.6A CN113296756A (en) 2021-05-28 2021-05-28 Merging method and system for user-modifiable workpieces

Publications (1)

Publication Number Publication Date
CN113296756A true CN113296756A (en) 2021-08-24

Family

ID=77326072

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110591005.6A Pending CN113296756A (en) 2021-05-28 2021-05-28 Merging method and system for user-modifiable workpieces

Country Status (1)

Country Link
CN (1) CN113296756A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050261787A1 (en) * 2004-05-19 2005-11-24 Frederic Plante Method for synchronization of concurrently modified interdependent semi-derived artifacts
US20080046858A1 (en) * 2006-08-15 2008-02-21 Zeligsoft Inc. Method and apparatus for merge condition detection
CN105930739A (en) * 2016-04-14 2016-09-07 北京金山安全软件有限公司 Method and terminal for preventing file from being deleted

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050261787A1 (en) * 2004-05-19 2005-11-24 Frederic Plante Method for synchronization of concurrently modified interdependent semi-derived artifacts
US20080046858A1 (en) * 2006-08-15 2008-02-21 Zeligsoft Inc. Method and apparatus for merge condition detection
CN105930739A (en) * 2016-04-14 2016-09-07 北京金山安全软件有限公司 Method and terminal for preventing file from being deleted

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李郑等: "基于抽象语法树分析的版本控制分支合并算法", 《计算机系统应用》, pages 139 - 146 *

Similar Documents

Publication Publication Date Title
US8566810B2 (en) Using database knowledge to optimize a computer program
US10394694B2 (en) Unexplored branch search in hybrid fuzz testing of software binaries
US11579856B2 (en) Multi-chip compatible compiling method and device
US20120030652A1 (en) Mechanism for Describing Values of Optimized Away Parameters in a Compiler-Generated Debug Output
US8856752B2 (en) Monitoring asset state to enable partial build
CA2321018A1 (en) Optimizing compilation by forward store movement
US20110126179A1 (en) Method and System for Dynamic Patching Software Using Source Code
CN110413272B (en) Front-end project construction method, device, storage medium and equipment
EP3198452A1 (en) On-demand loading of dynamic scripting language code for reduced memory usage
US20080046858A1 (en) Method and apparatus for merge condition detection
CN114090013A (en) Method and device for determining change set of executable code file
JPH0565892B2 (en)
CN113296756A (en) Merging method and system for user-modifiable workpieces
CN112527304A (en) Self-adaptive node fusion compiling optimization method based on heterogeneous platform
JP6176389B2 (en) Source code generation apparatus, source code generation method, and recording medium
US9032372B2 (en) Runtime environment and method for non-invasive monitoring of software applications
CN109019217B (en) Elevator control software field debugging system
JP5199975B2 (en) Memory management method, memory management program, and information processing apparatus
WO2023155863A1 (en) Methods and devices for compiler function fusion
CN113535528B (en) Log management system, method and medium for distributed graph iterative computation job
CN117687681B (en) Version management method and system for low-code application
CN117075911B (en) Variable code conversion method from PL language to C language, storage medium and apparatus
CN113296786B (en) Data processing method, device, electronic equipment and storage medium
US20030177420A1 (en) Generating a common symbol table for symbols of independent applications
US8290917B2 (en) Reordering of data elements in a data parallel system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination