CN102253992B - Object-orientation based file difference comparing method and system - Google Patents

Object-orientation based file difference comparing method and system Download PDF

Info

Publication number
CN102253992B
CN102253992B CN 201110188141 CN201110188141A CN102253992B CN 102253992 B CN102253992 B CN 102253992B CN 201110188141 CN201110188141 CN 201110188141 CN 201110188141 A CN201110188141 A CN 201110188141A CN 102253992 B CN102253992 B CN 102253992B
Authority
CN
China
Prior art keywords
file
change information
engineering
function
living
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.)
Expired - Fee Related
Application number
CN 201110188141
Other languages
Chinese (zh)
Other versions
CN102253992A (en
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.)
Guangdong Gaohang Intellectual Property Operation Co ltd
Nantong Guangshuo Communication Equipment Co ltd
Original Assignee
Vtron Technologies 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 Vtron Technologies Ltd filed Critical Vtron Technologies Ltd
Priority to CN 201110188141 priority Critical patent/CN102253992B/en
Publication of CN102253992A publication Critical patent/CN102253992A/en
Application granted granted Critical
Publication of CN102253992B publication Critical patent/CN102253992B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The invention related to the technical field related to the software version management, and in particular relates to an object-orientation based file difference comparing method and system. The method comprises the following steps of: finding out computer language description objects in the engineering of a new version and the engineering of an old version to be compared with each other through semantic analysis using keywords, respectively; and analysing the same computer language description objects to find out the change information in the two versions, and storing the change information as a change information recording file. The method realizes the comparison of the whole engineering, and as each computer language description object is compared respectively, the technical problems of also comparing the null string sentences with the annotation sentences in the files are reduced; therefore, the efficiency of the file difference comparison function in actual use is improved.

Description

A kind of based on OO file difference comparative approach and system thereof
Technical field
The present invention relates to the software version management correlative technology field, particularly a kind of based on OO file difference comparative approach and system thereof.
Background technology
Existing popular Version, such as SVN(subversion), it has Version Control and backup server two large functions, the user can be with its file backup server as oneself, be more preferably, it can help the archive content of user on remembeing at every turn to upload onto the server, and gives automatically each change a version.For this reason, the designer can select SVN as the file difference comparing function that the code administration instrument provides when carrying out the designing and developing of software, and realizes the code of different software versions is carried out differentiation relatively.
The file difference comparing function that SVN self provides, its principle are that two files are compared line by line as text, and then find out the difference of two files that will compare.When needs compared the code file difference of two different editions, SVN will at first download to two versions of the code file that will compare on the local host, then compares line by line.
Although the file difference comparing function that SVN self provides is easy to use, and can compare very accurately the difference of file destination different editions, but this function has following two shortcomings: the first, and this function can only compare file, and can't whole engineering compare; The second, because this function employing is the mode that compares line by line, nature can also compare null statement and the comment statement in the file.Therefore, its efficient is comparatively low in actual use for the file difference comparing function that provides of SVN self.
Summary of the invention
It is a kind of based on OO file difference comparative approach that first goal of the invention of the present invention is to provide, with solve the existing version management tool to carry out based on OO computer programming projects diversity ratio than the time inefficiency technical matters.
The first goal of the invention of the present invention adopts following technical scheme to realize:
A kind of based on OO file difference comparative approach, to carrying out diversity ratio based on OO computer programming projects, described method comprises:
Find out respectively computerese description object in the engineering of new and old two versions that will compare by utilizing key word to carry out syntax parsing;
Identical computerese description object analyzed find out the change information in two versions and save as the change information log file.
As a kind of preferred version, described method adopts XML node form to be used for describing the computerese description object of engineering.
As further preferred version, described computerese description object comprises global variable, overall situation function and/or class declaration and member variable and member function.
As preferred version further, if the computerese description object is global variable:
If global variable is newly-increased global variable, change information is file in the redaction engineering at this global variable place and the position of file of living in;
If global variable is deleted, change information is file in the legacy version engineering at this global variable place and the position of file of living in;
If the type of global variable changes, then change information is file in the engineering of new and old two versions at this global variable place and the position of file of living in.
As preferred version further, if the computerese description object is overall situation function:
If overall situation function is newly-increased overall situation function, change information be file in the statement of this overall situation function and the new edition engineering that defines the place and the position of file of living in;
If overall situation function is deleted, change information be this overall situation function statement and the definition place the legacy version engineering in file and the position of file of living in;
If change has occured for the statement of overall situation function or definition, change information is file in the engineering of new and old two versions at the statement of this overall situation function or definition place and the position of file of living in.
As preferred version further, if the computerese description object is class declaration and member variable and member function, change information is the combination of a series of member variables and member function change information:
If member variable is newly-increased member variable, change information is file in the redaction engineering at this member variable place and the position of file of living in;
If member variable is deleted, change information is file in the legacy version engineering at this member variable place and the position of file of living in;
If the type of member variable changes, then change information is file in the engineering of new and old two versions at this member variable place and the position of file of living in;
If member function is newly-increased member function, change information be file in the statement of this member function and the new edition engineering that defines the place and the position of file of living in;
If member function is deleted, change information be this member function statement and the definition place the legacy version engineering in file and the position of file of living in;
If change has occured for the statement of member function or definition, change information is file in the engineering of new and old two versions at the statement of this member function or definition place and the position of file of living in.
As further preferred version, by resolving the change information log file, the computerese description object that changes set in two versions of formation take the redaction engineering as benchmark, when choosing some computerese description objects that changes or computerese descriptor object, carry out document alignment according to the change information that records in the change information log file, namely navigate to the position of corresponding file and file of living in.
The described position that navigates to corresponding file and file of living in refers to navigate to the file in the redaction engineering, for deleted computerese description object or computerese descriptor object, to award prompting with horizontal line at the redaction project file, represent deleted.
Second goal of the invention of the present invention is to provide, a kind of based on OO file difference comparison system, with the comparative approach of realizing that first goal of the invention of the present invention is provided.
Second goal of the invention of the present invention adopts following technical scheme to realize:
A kind of based on OO file difference comparison system, be used for carrying out diversity ratio based on OO computer programming projects, described system comprises:
By utilizing key word to carry out the analysis of object module that syntax parsing is found out respectively the computerese description object in the engineering of new and old two versions that will compare;
Identical computerese description object is analyzed the object comparison module of finding out the change information in two versions;
Be used for preserving the change information log file generation module of change information;
Analysis of object module, object comparison module are connected with change information log file generation module and are connected.
As a kind of preferred version, described change information log file adopts XML to generate, and described system also comprises XML document load-on module and the XML document parsing module that connects successively:
The XML document load-on module is connected with change information log file generation module, loads the change information log file;
The XML document parsing module is described the change information log file by resolving, the computerese description object that changes set in two versions of formation take the redaction engineering as benchmark, when choosing some computerese description objects that changes or computerese descriptor object, carry out document alignment according to the change information that records in the change information log file, namely navigate to the position of corresponding file and file of living in.
The present invention proposes a kind of based on OO file difference comparison, the method has at first defined a cover for the global variable of describing engineering, overall situation function, the XML node form of the essential information of class declaration and member variable thereof and member function and change information, then find out respectively global variable in the engineering of two versions that will compare by utilizing key word to carry out syntax parsing, overall situation function, class declaration and member variable thereof and member function, and take the redaction engineering as benchmark, global variable with the engineering of above-mentioned two versions that parse, overall situation function, class declaration and member variable thereof and member function compare respectively and find out its difference successively, with the global object that changes, the overall situation function that statement or definition change and essential information and the change information of class write the XML file according to above-mentioned defined XML node form.
The present invention has realized whole engineering is compared and owing to being that each computerese description object is compared respectively, therefore can reduce the technical matters that the null statement in the file and comment statement are also compared, thereby improve file difference comparing function efficient in actual use.
Description of drawings
Accompanying drawing 1 is the schematic flow sheet of the present embodiment.
Accompanying drawing 2 is the system architecture schematic diagram of the present embodiment.
Remarks: the object in accompanying drawing 1 and the accompanying drawing 2 refers to global variable, overall situation function, the class in the engineering.
Embodiment
The present invention will be further described in detail below in conjunction with the drawings and specific embodiments.
As shown in Figure 1, the present invention proposes a kind of based on OO file difference relatively, the method is done as a whole comparing with projects.In the method, find out in the engineering used class name and member function thereof and member variable, global variable, overall situation function by the All Files in the search item engineering, then compare one by one by the above-mentioned object that two different editions of projects are searched for out, find out the difference of two different editions of projects.The realization technical scheme of this method is as follows:
S1: find out object in the engineering of two versions that will compare by utilizing key word to carry out syntax parsing;
S2: take the redaction engineering as benchmark, the object of the engineering of two versions parsing is compared respectively and find out its difference successively;
S3: essential information and the change information of the object that changes are write the XML file;
S4: the analyzing XML file generates the computerese description object that the changes set in two versions take the redaction engineering as benchmark.
The object that defines among the step S1 comprises: global variable, overall situation function and/or class declaration and member variable thereof and member function.
For global variable, whether its variable name of XML nodes records and type and this variable change has occured; For overall situation function, whether the file at the file at its statement place of XML nodes records and the position in this document thereof and its definition place and statement and the definition of the reference position in this document and this function thereof change has occured; For statement and the definition of class, its member variable of XML nodes records is tabulated and member function is tabulated and whether such change has occured, the same global variable of the description of member variable, the same overall situation function of the description of member function.With the above-mentioned analysis of object in two versions respectively out after, take the engineering of redaction as benchmark, successively the above-mentioned list object that parses is compared, and then finds out the difference of two different editions of projects.For the comparison of global variable, its standard is whether the global variable in the redaction is deleted with respect to legacy version, perhaps whether belongs to newly-increased variable, and perhaps whether type of variables is modified; For the comparison of overall situation function, its standard is the relative legacy version of the overall situation function in the redaction, and whether its statement changes, and perhaps whether its definition changes, and perhaps whether this function belongs to new increasing function, and perhaps whether this function is deleted.Whether change for function definition, adopt the mode that function body is compared line by line to judge; For the comparison of class, comprise that the former is that the latter is the comparison to the member function definition to the comparison of class members's variable and member function statement to the comparison of the statement of class with to the comparison of the definition of class.The more same global variable of class members's variable, and class members's function relatively with the comparison of overall situation function.
Accompanying drawing 2 is the system architecture schematic diagram of the present embodiment.
The present embodiment is a kind of based on OO file difference comparison system, be used for carrying out diversity ratio based on OO computer programming projects, described system comprises analysis of object module 21, object comparison module 22, XML document generation module 23, XML document load-on module 24 and the XML document parsing module 25 that connects successively:
Analysis of object module 21 is found out respectively computerese description object in the engineering of new and old two versions that will compare by utilizing key word to carry out syntax parsing;
22 pairs of identical computerese description objects of object comparison module are analyzed the change information of finding out in two versions;
XML document generation module 23 is used for adopting XML to preserve change information and generate the change information log file;
XML document load-on module 24 loads the change information log file;
XML document parsing module 25 is described the change information log file by resolving, the computerese description object that changes set in two versions of formation take the redaction engineering as benchmark, when choosing some computerese description objects that changes or computerese descriptor object, carry out document alignment according to the change information that records in the change information log file, namely navigate to the position of corresponding file and file of living in.

Claims (5)

1. one kind based on OO file difference comparative approach, to carrying out diversity ratio based on OO computer programming projects, it is characterized in that, described method comprises:
Find out respectively computerese description object in the engineering of new and old two versions that will compare by utilizing key word to carry out syntax parsing;
Identical computerese description object analyzed find out the change information in two versions and save as the change information log file;
Described computerese description object comprises global variable, overall situation function and/or class declaration and member variable and member function;
If the computerese description object is global variable:
If global variable is newly-increased global variable, change information is file in the redaction engineering at this global variable place and the position of file of living in;
If global variable is deleted, change information is file in the legacy version engineering at this global variable place and the position of file of living in;
If the type of global variable changes, then change information is file in the engineering of new and old two versions at this global variable place and the position of file of living in;
If the computerese description object is overall situation function:
If overall situation function is newly-increased overall situation function, change information be file in the statement of this overall situation function and the new edition engineering that defines the place and the position of file of living in;
If overall situation function is deleted, change information be this overall situation function statement and the definition place the legacy version engineering in file and the position of file of living in;
If change has occured for the statement of overall situation function or definition, change information is file in the engineering of new and old two versions at the statement of this overall situation function or definition place and the position of file of living in;
If the computerese description object is class declaration and member variable and member function, change information is the combination of a series of member variables and member function change information:
If member variable is newly-increased member variable, change information is file in the redaction engineering at this member variable place and the position of file of living in;
If member variable is deleted, change information is file in the legacy version engineering at this member variable place and the position of file of living in;
If the type of member variable changes, then change information is file in the engineering of new and old two versions at this member variable place and the position of file of living in;
If member function is newly-increased member function, change information be file in the statement of this member function and the new edition engineering that defines the place and the position of file of living in;
If member function is deleted, change information be this member function statement and the definition place the legacy version engineering in file and the position of file of living in;
If change has occured for the statement of member function or definition, change information is file in the engineering of new and old two versions at the statement of this member function or definition place and the position of file of living in.
2. comparative approach according to claim 1 is characterized in that, described method adopts XML node form to be used for describing the computerese description object of engineering.
3. comparative approach according to claim 1 and 2, it is characterized in that, by resolving the change information log file, the computerese description object that changes set in two versions of formation take the redaction engineering as benchmark, when choosing some computerese description objects that changes or computerese descriptor object, carry out document alignment according to the change information that records in the change information log file, namely navigate to the position of corresponding file and file of living in.
4. one kind based on OO file difference comparison system, is used for carrying out diversity ratio based on OO computer programming projects, it is characterized in that, described system comprises:
By utilizing key word to carry out the analysis of object module that syntax parsing is found out respectively the computerese description object in the engineering of new and old two versions that will compare;
Identical computerese description object is analyzed the object comparison module of finding out the change information in two versions;
Be used for preserving the change information log file generation module of change information;
Analysis of object module, object comparison module are connected with change information log file generation module and are connected;
Wherein, described computerese description object comprises global variable, overall situation function and/or class declaration and member variable and member function;
If the computerese description object is global variable:
If global variable is newly-increased global variable, change information is file in the redaction engineering at this global variable place and the position of file of living in;
If global variable is deleted, change information is file in the legacy version engineering at this global variable place and the position of file of living in;
If the type of global variable changes, then change information is file in the engineering of new and old two versions at this global variable place and the position of file of living in;
If the computerese description object is overall situation function:
If overall situation function is newly-increased overall situation function, change information be file in the statement of this overall situation function and the new edition engineering that defines the place and the position of file of living in;
If overall situation function is deleted, change information be this overall situation function statement and the definition place the legacy version engineering in file and the position of file of living in;
If change has occured for the statement of overall situation function or definition, change information is file in the engineering of new and old two versions at the statement of this overall situation function or definition place and the position of file of living in;
If the computerese description object is class declaration and member variable and member function, change information is the combination of a series of member variables and member function change information:
If member variable is newly-increased member variable, change information is file in the redaction engineering at this member variable place and the position of file of living in;
If member variable is deleted, change information is file in the legacy version engineering at this member variable place and the position of file of living in;
If the type of member variable changes, then change information is file in the engineering of new and old two versions at this member variable place and the position of file of living in;
If member function is newly-increased member function, change information be file in the statement of this member function and the new edition engineering that defines the place and the position of file of living in;
If member function is deleted, change information be this member function statement and the definition place the legacy version engineering in file and the position of file of living in;
If change has occured for the statement of member function or definition, change information is file in the engineering of new and old two versions at the statement of this member function or definition place and the position of file of living in.
5. comparison system according to claim 4 is characterized in that, described change information log file adopts XML to generate, and described system also comprises XML document load-on module and the XML document parsing module that connects successively:
The XML document load-on module is connected with change information log file generation module, loads the change information log file;
The XML document parsing module is described the change information log file by resolving, the computerese description object that changes set in two versions of formation take the redaction engineering as benchmark, when choosing some computerese description objects that changes or computerese descriptor object, carry out document alignment according to the change information that records in the change information log file, namely navigate to the position of corresponding file and file of living in.
CN 201110188141 2011-07-06 2011-07-06 Object-orientation based file difference comparing method and system Expired - Fee Related CN102253992B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110188141 CN102253992B (en) 2011-07-06 2011-07-06 Object-orientation based file difference comparing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110188141 CN102253992B (en) 2011-07-06 2011-07-06 Object-orientation based file difference comparing method and system

Publications (2)

Publication Number Publication Date
CN102253992A CN102253992A (en) 2011-11-23
CN102253992B true CN102253992B (en) 2013-01-23

Family

ID=44981256

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110188141 Expired - Fee Related CN102253992B (en) 2011-07-06 2011-07-06 Object-orientation based file difference comparing method and system

Country Status (1)

Country Link
CN (1) CN102253992B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102682127B (en) * 2012-05-16 2014-12-03 北京像素软件科技股份有限公司 Data version control method
CN103942131B (en) * 2013-01-23 2018-07-06 腾讯科技(深圳)有限公司 The method and device whether monitoring physical layer interface changes
CN103984578B (en) * 2014-05-29 2017-08-25 中国银行股份有限公司 The update method and device of a kind of cobol program version
CN104035772B (en) * 2014-06-09 2017-11-14 中国科学院软件研究所 Source code multi version function calling relationship otherness identification method based on static analysis
CN106502903B (en) * 2016-10-26 2019-08-30 腾讯科技(深圳)有限公司 A kind of change function of program determines method, apparatus and processing equipment
CN109117376A (en) * 2018-08-31 2019-01-01 北京龙创悦动网络科技有限公司 A kind of detection method and device of ccb file
CN109408102B (en) * 2018-09-04 2021-03-23 珠海格力电器股份有限公司 Version comparison method and device, household electrical appliance and network equipment
CN112965738B (en) * 2021-02-02 2022-07-08 烽火通信科技股份有限公司 Information model version difference comparison method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1790335A (en) * 2005-12-19 2006-06-21 无锡永中科技有限公司 XML file data access method
CN101789042A (en) * 2010-01-29 2010-07-28 华东电网有限公司 Model increment comparing tool of common information model (CIM) of electric network enterprise

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8868524B2 (en) * 2005-08-25 2014-10-21 International Business Machines Corporation Floating merge selection viewer

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1790335A (en) * 2005-12-19 2006-06-21 无锡永中科技有限公司 XML file data access method
CN101789042A (en) * 2010-01-29 2010-07-28 华东电网有限公司 Model increment comparing tool of common information model (CIM) of electric network enterprise

Also Published As

Publication number Publication date
CN102253992A (en) 2011-11-23

Similar Documents

Publication Publication Date Title
CN102253992B (en) Object-orientation based file difference comparing method and system
CN110555025B (en) Method and system for realizing WEB form custom field
Capriolo et al. Programming hive
US10360231B2 (en) Dynamically switching between data sources
Ferrández et al. The QALL-ME framework: A specifiable-domain multilingual question answering architecture
EP2126734B1 (en) Xml-based translation
US7937410B2 (en) Generic archiving of enterprise service oriented architecture data
CN103279358B (en) A kind of explanation type Service Component dynamic fixing method of Industry-oriented application
Hahn et al. An overview of JCoRe, the JULIE lab UIMA component repository
CN103262047A (en) Intelligent code differencing using code clone detection
CN101887365A (en) Be used to construct method and system based on the executable code of the application of assembly
US10614062B2 (en) Data model extension generation
CN103793432A (en) Method and device for splitting database reading and writing
Hahn et al. UIMA-based JCoRe 2.0 goes GitHub and Maven central―state-of-the-art software resource engineering and distribution of NLP pipelines
Barmpis et al. Towards scalable querying of large-scale models
CN103020075B (en) The method of the dependence of evaluating objects object
Vrgoč et al. MillenniumDB: An open-source graph database system
Basciani et al. Exploring model repositories by means of megamodel-aware search operators.
Jeter et al. Semantic links across distributed heterogeneous data
Lange et al. Reimplementing the mathematics subject classification (msc) as a linked open dataset
CN103810259A (en) Urinalysis prototype constructing and data storage method based on OpenEHR
Morara et al. Solving XCSP problems by using Gecode
CN101639827A (en) Book metadata generating method
Thost et al. QED: out-of-the-box datasets for SPARQL query evaluation
Keivanloo et al. Semantic Web-The missing link in global source code analysis?

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP03 Change of name, title or address

Address after: Kezhu road high tech Industrial Development Zone, Guangzhou city of Guangdong Province, No. 233 510670

Patentee after: VTRON GROUP Co.,Ltd.

Address before: 510663 No. 6, color road, hi tech Industrial Development Zone, Guangdong, Guangzhou, China

Patentee before: VTRON TECHNOLOGIES Ltd.

CP03 Change of name, title or address
TR01 Transfer of patent right

Effective date of registration: 20201126

Address after: 510000 unit 2414-2416, building, No. five, No. 371, Tianhe District, Guangdong, China

Patentee after: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

Address before: Kezhu road high tech Industrial Development Zone, Guangzhou city of Guangdong Province, No. 233 510670

Patentee before: VTRON GROUP Co.,Ltd.

Effective date of registration: 20201126

Address after: 226600 Building 2, No.288, Changjiang West Road, Haian Town, Haian City, Nantong City, Jiangsu Province

Patentee after: Nantong guangshuo communication equipment Co.,Ltd.

Address before: 510000 unit 2414-2416, building, No. five, No. 371, Tianhe District, Guangdong, China

Patentee before: GUANGDONG GAOHANG INTELLECTUAL PROPERTY OPERATION Co.,Ltd.

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20130123