Skip to content

multidiff

Module which allows the diffing of multiple files

Authors:

  • Toon Willems (Ghent University)
  • Kenneth Hoste (Ghent University)

MultiDiff

Bases: object

Class representing a multi-diff.

__init__(base_fn, base_lines, files, colored=True)

MultiDiff constructor

PARAMETER DESCRIPTION
base_fn

base function to compare with

base_lines

base lines to compare to

files

list of files to compare with base

colored

boolean indicating whether a colored multi-diff should be generated

DEFAULT: True

__str__()

Create a string representation of this multi-diff

color_line(line, color)

Create colored version of given line, with given color, if color mode is enabled.

colorize(line, squigly)

Add colors to the diff line based on the squigly line.

get_line(line_no)

Return the line information for a specific line

PARAMETER DESCRIPTION
line_no

line number to obtain information for

RETURNS DESCRIPTION

list with text lines providing line information

merge_squigly(squigly1, squigly2)

Combine two squigly lines into a single squigly line.

parse_line(line_no, diff_line, meta, squigly_line)

Register a diff line

PARAMETER DESCRIPTION
line_no

line number

diff_line

diff line generated by difflib

meta

meta information (e.g., filename)

squigly_line

squigly line indicating which characters changed

multidiff(base, files, colored=True)

Generate a diff for multiple files, all compared to base.

PARAMETER DESCRIPTION
base

base to compare with

files

list of files to compare with base

colored

boolean indicating whether a colored multi-diff should be generated

DEFAULT: True

RETURNS DESCRIPTION

text with multidiff overview