Table of Contents

Module: ndiff Zope-2.2.1-src/lib/python/OFS/ndiff.py

ndiff [-q] file1 file2 or ndiff (-r1 | -r2) < ndiff_output > file1_or_file2

Print a human-friendly file difference report to stdout. Both inter- and intra-line differences are noted. In the second form, recreate file1 (-r1) or file2 (-r2) on stdout, from an ndiff report on stdin.

In the first form, if -q ("quiet") is not specified, the first two lines of output are

-: file1 +: file2

Each remaining line begins with a two-letter code:

"- " line unique to file1 "+ " line unique to file2 " " line common to both files "? " line not present in either input file

Lines beginning with "? " attempt to guide the eye to intraline differences, and were not present in either input file. These lines can be confusing if the source files contain tab characters.

The first file can be recovered by retaining only lines that begin with " " or "- ", and deleting those 2-character prefixes; use ndiff with -r1.

The second file can be recovered similarly, but by retaining only " " and "+ " lines; use ndiff with -r2; or, on Unix, the second file can be recovered by piping the output through

sed -n /^[+ ] /s/^..//p

See module comments for details and programmatic interface.

Imported modules   
import re
import string
Functions   
IS_CHARACTER_JUNK
IS_LINE_JUNK
dump
fail
fancy_helper
fancy_replace
fcompare
fopen
main
plain_replace
restore
  IS_CHARACTER_JUNK 
IS_CHARACTER_JUNK ( ch,  ws=' \\t' )

  IS_LINE_JUNK 
IS_LINE_JUNK ( line,  pat=re.compile( r"\s*#?\s*$" ) )

  dump 
dump (
        tag,
        x,
        lo,
        hi,
        )

meant for dumping lines

  fail 
fail ( msg )

  fancy_helper 
fancy_helper (
        a,
        alo,
        ahi,
        b,
        blo,
        bhi,
        )

  fancy_replace 
fancy_replace (
        a,
        alo,
        ahi,
        b,
        blo,
        bhi,
        )

Exceptions   
ValueError
  fcompare 
fcompare ( f1name,  f2name )

open two files & spray the diff to stdout; return false iff a problem

Exceptions   
ValueError
  fopen 
fopen ( fname )

open a file & return the file object; gripe and return 0 if it couldn't be opened

  main 
main ( args )

  plain_replace 
plain_replace (
        a,
        alo,
        ahi,
        b,
        blo,
        bhi,
        )

  restore 
restore ( which )

Classes   
SequenceMatcher

Table of Contents

This document was automatically generated on Mon Sep 4 07:33:06 2000 by HappyDoc version r0_6