File comparison

This article is about data object, text, and file comparisons in computing. For other uses, see Comparison.

The KDE diff tool Kompare

Editing documents, program code, or any data always risks introducing errors. Displaying the differences between two or more sets of data, file comparison tools can make computing simpler, and more efficient by focusing on new data and ignoring what did not change. Generically known as a diff[1] after the Unix `diff` utility, there are a range of ways to compare data sources and display the results.

Some widely used file comparison programs are diff, cmp, FileMerge, WinMerge, Beyond Compare, and File Compare.

Because understanding changes is important to writers of code or documents, many text editors and word processors include the functionality necessary to see the changes between different versions of a file or document.

## Contents

* 1 Method types
* 2 Display
* 3 Reasoning
* 4 Historical uses
* 5 See also
* 6 References
* 7 External links

## Method types

The most efficient method of finding differences depends on the source data, and the nature of the changes. One approach is to find the longest common subsequence between two files, then regard the non-common data as an insertion, or a deletion.

In 1978, Paul Heckel published an algorithm that identifies most moved blocks of text.[2] This is used in the IBM History Flow tool.[3] Other file comparison programs find block moves.[clarification needed]

Some specialized file comparison tools find the longest increasing subsequence between two files.[4] The rsync protocol uses a rolling hash function to compare two files on two distant computers with low communication overhead.

File comparison in word processors is typically at the word level, while comparison in most programming tools is at the line level. Byte or character-level comparison is useful in some specialized applications.

## Display

The optimal way to display the results of a file comparison depends on many factors, including the type of source data. The fixed lines of programming code provide a clear unit of comparison. This does not work with documents, where adding a single word may cause the following lines to wrap differently, but still not change the content.

The most popular ways to display changes are either side-by-side, or a consolidating view that highlights data inserts, and deletes. In either side-by-side viewing, code folding or text folding, for the sake of efficiency, the interface may hide portions of the file that did not change and show only the changes.[clarification needed]

## Reasoning

There are various reasons to use comparison tools, and tools themselves use different approaches. To compare binary files, a tool may use byte-level comparison. Comparing text files or computer programs, many tools use a side-by-side visual comparison.[5] This gives the user the chance to choose which changes to keep or reject before merging the files into a new version.[6] Or perhaps to keep them both as-is for later reference, through some form of "versioning" control.

File comparison is an important, and integral process of file synchronization and backup. In backup methodologies, the issue of data corruption is important. Rarely is there a warning before corruption occurs, this can make recovery difficult or impossible. Often, the problem is only apparent the next time someone tries to open a file. In this circumstance, a comparison tool can help to isolate the introduction of the problem.[7]

## Historical uses

Prior to file comparison, machines existed to compare magnetic tapes or punch cards. The IBM 519 Card Reproducer could determine whether a deck of punched cards were equivalent. In 1957, John Van Gardner developed a system to compare the check sums of loaded sections of Fortran programs to debug compilation problems on the IBM 704.[8]

## See also

* Comparison of file comparison tools
* Computer-assisted reviewing - Text-comparison software
* Data differencing - Method for compressing changes over time
* Delta encoding - Type of data transmission method
* Document comparison
* Edit distance - Computer science metric of string similarity

## References

1. ↑ "diff", The Jargon File
2. ↑ Heckel, Paul (1978), "A Technique for Isolating Differences Between Files", Communications of the ACM 21 (4): 264–268, doi:10.1145/359460.359467, http://documents.scribd.com/docs/10ro9oowpo1h81pgh1as.pdf, retrieved 2011-12-04
3. ↑ Viégas, Fernanda B.; Wattenberg, Martin; Kushal, Kushal Dave (2004), Studying Cooperation and Conflict between Authors with history flow Visualizations, 6, Vienna: CHI, pp. 575–582, http://domino.watson.ibm.com/cambridge/research.nsf/58bac2a2a6b05a1285256b30005b3953/53240210b04ea0eb85256f7300567f7e/$FILE/TR2004-19.pdf, retrieved 2011-12-01
4. ↑ "Algorithms for block-level code alignment of software binary files". USPTO. 18 April 2006. https://patents.google.com/patent/US7031972.
5. ↑ MacKenzie, David; Eggert, Paul; Stallman, Richard (2003) (in en). Comparing and Merging Files with Gnu Diff and Patch. Network Theory. ISBN 978-0-9541617-5-0. https://books.google.com/books?id=oIINAAAACAAJ.
6. ↑ "File comparison software: vc-dwim and vc-chlog". http://www.gnu.org/software/vc-dwim/vc-dwim.html.
7. ↑ "SystemRescue - System Rescue Homepage". https://www.system-rescue.org/.
8. ↑ John Van Gardner. "Fortran And The Genesis Of Project Intercept". http://www.softwarepreservation.org/projects/FORTRAN/paper/John Van Gardner - Fortran And The Genesis Of Project Intercept.pdf.

## External links

* v
* t
* e

Computer files

Types|

* Binary file / text file
* File format
* List of file formats
* File signatures
* Magic number
* Metafile
* Sidecar file
* Sparse file
* Swap file
* System file
* Temporary file
* Zero-byte file

Properties|

* Filename
* 8.3 filename
* Long filename
* Filename mangling
* Filename extension
* List of filename extensions
* File attribute
* Extended file attributes
* File size
* Hidden file / Hidden directory

Organisation|

* Directory/folder
* NTFS junction point
* Temporary folder
* Directory structure
* File sequence
* File system
* Filesystem Hierarchy Standard
* Path

Operations|

* Open
* Close
* Read
* Write

Linking|

* Alias
* File descriptor
* Hard link
* Shadow
* Shortcut
* Symbolic link

Management|

* File comparison
* File compression
* File manager
* Comparison of file managers
* File system permissions
* File transfer
* File sharing
* File verification

* v
* t
* e

Version control software

Years, where available, indicate the date of first stable release. Systems with names in italics are no longer maintained or have planned end-of-life dates.

Local only|

| Free/open-source|

* RCS (1982)
* SCCS (1972)

|

Proprietary|

* PVCS (1985)
* QVCS (1991)

Client–server|

| Free/open-source|

* CVS (1986, 1990 in C)
* CVSNT (1998)
* QVCS Enterprise (1998)
* Subversion (2000)

|

Proprietary|

* AccuRev SCM (2002)
* Azure DevOps
* Server (via TFVC) (2005)
* Services (via TFVC) (2014)
* ClearCase (1992)
* CMVC (1994)
* Dimensions CM (1980s)
* DSEE (1984)
* Endevor (1980s)
* Integrity (2001)
* Panvalet (1970s)
* Perforce Helix (1995)
* SCLM (1980s?)
* Software Change Manager (1970s)
* StarTeam (1995)
* Surround SCM (2002)
* Synergy (1990)
* Team Concert (2008)
* Vault (2003)
* Visual SourceSafe (1994)

Distributed|

| Free/open-source|

* ArX (2003)
* BitKeeper (2000)
* Codeville (2005)
* Darcs (2002)
* DCVS (2002)
* Fossil (2007)
* Git (2005)
* GNU arch (2001)
* GNU Bazaar (2005)
* Mercurial (2005)
* Monotone (2003)
* Veracity (2010)

|

Proprietary|

* Azure DevOps
* Server (via Git) (2013)
* Services (via Git) (2014)
* TeamWare (1992)
* Code Co-op (1997)
* Plastic SCM (2006)

Concepts|

* Baseline
* Branch
* Changeset
* Commit
* Data comparison
* Delta compression
* Fork
* Gated commit
* Interleaved deltas
* Merge
* Monorepo
* Repository
* Tag
* Trunk

* Category
* Comparison
* List

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/File comparison. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=File_comparison&oldid=4142047"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template