File Comparison

From DataFlex Wiki
(Redirected from Comparing sources)
Jump to navigationJump to search

File Comparison is the process of compare the difference between files. Commonly this is used when merging source code with a Version Control file repository.

Why use File Comparison Software?

When comparing source between different Visual DataFlex versions it is a HUGE time saver to do this using source code compare tools. Below is a few rules one can use to compare sources between VDF11.1 and VDF12.1

The tips below are for a product called Beyond Compare, but i'm sure your product will do fine too. If you are not using a product for this then GO BUY ONE! it is the best investment you can make EVER.

File Comparison software

There are many different file comparison tools out there, the most commonly used being Beyond Compare. Other alternatives for Windows include Araxis merge, WinDiff and Winmerge.

For Linux users there is Meld.

For a comparison of file comparison tools visit Wikipedia.

Beyond Compare

Beyond Compare is a commonly used File Comparison tool developed by Scooter Software.

How-to set up Beyond Compare

Configure File Formats

In order to have Beyond Compare recognize DataFlex based on File Type, you can add the following after starting the main program. Main menu -> Tools -> File Formats -> Press the "+" button to add a new file format --> Text Format

General tab

Mask: *.src;*.pkg;*.dg;*.vw;*.dd;*.sl;*.ddo;*.rv;*.tt?;*.wo;*.utl;*.nui
Description: - Compares DataFlex source.

Save As: DataFlex Source

Configure per session

In order to change the rules on how BC compares, you should go into compare source mode --> compare two source files --> and then click on the "guy with the cap" in the toolbar

General Tab Page

Name : DataFlex
Associated with: *.src;*.pkg;*.dg;*.vw;*.dd;*.sl;*.ddo;*.rv;*.tt?;*.wo;*.utl;*.nui
x Whitespace includes TABS and spaces

Importance Tab Page

Unimportant text group >> put a check in all of the checkboxes
This is also the place where you can add custom rules/filters

Custom filters

1. Ignore differences in comments.

Click on New, Category Delimited
Beginning with: //
Check "stopping at end of line"

2. Ignore new metadata markup

Click on New, Category Delimited
Beginning with: {
and ending with: }

3. Ignore "current_object" vs "self" syntax

Click on Regular expressions
 (?i).*current_object.*|.*self.*

4. Ignore difference between writing "Use foo" and "Use foo.pkg"

Click on Regular expressions
(?i)^\s*use\s+.*|^\s*use.*\.pkg

5. Ignore changed writing style for constants: C$_FOO vs C_$FOO

Click on Regular expressions
(?i)\s+C\$_.*|\s+C_\$.*

6. Ignore "string" vs. "local string"

Click on Regular expressions
 (?i)^\s*local\s+string.*|^\s*string.*
Replace string with date / integer / number to filter other similar code.

7. Ignore meta tag documentation changes between 12.1 and 2008

Click on Regular expressions
 (?i)\s*\/\/Doc\/.*|\s*\{.*

8. Ignore the public keyword in property declarations

Click on Regular expressions
 (?i)^\s*property\s+integer.*public.*|^\s*property\s+integer.*
Repeat the same for the other datatypes

9. Comment vs. No comments

Click On Regex
 (?i)^\s*\/\/.*|^\s*

10. Use statement vs missing Use statement

As before a regular expression
 (?i)^\s*Use.*\.pkg|^\s*

11. Ignore removed comments after End_Object,End_Class,End_Function,End_Procedure

Using a regular expressions
 (?i)\s*end.*\/\/.*|\s*end.*


PS: Begin this year I was promised by Scootersoftware Support that they would implement a way to enable/disable filters on a per filter bases in the next revision of the tool. <--- I wrote that in 2008! This was implemented by using sessions. You can create different sessions with different filters.

Winmerge

Winmerge is an Open Source file comparison tool.

External Links