Giter VIP home page Giter VIP logo

wbdiff's Introduction

wbdiff - Advanced diff utility

Diffing tool with few sophisticated features, hopefully makeing developer's life easier.

Example output:

$ ./wbdiff tests/9/left tests/9/right
Removals from left file, moves and additions to right file:
--- tests/9/left
+++ tests/9/right
---------\ l0017-l0022 -> r0001-r0006  (5 lines)
 17->  1 | q
 18->  2 | r
 19->  3 | s
 20->  4 | t
 21->  5 | v
---------/
---------\ l0009-l0014 -> r0006-r0011  (5 lines)
  9->  6 | i
 10->  7 | j
 11->  8 | k
 12->  9 | l
 13-> 10 | m
---------/
   -> 11 + A
   -> 12 + E
---------\ l0001-l0009 -> r0013-r0021  (8 lines)
  1-> 13 | a
  2-> 14 | b
  3-> 15 | c
  4-> 16 | d
  5-> 17 | e
  6-> 18 | f
  7-> 19 | g
  8-> 20 | h
---------/
---------\ l0014-l0017 -> r0021-r0024  (3 lines)
 14-> 21 | n
 15-> 22 | o
 16-> 23 | p
---------/

Diff statistics:
	Initial context length used: 3
	Number of matching (extended) blocks: 4
	Number of lines in matching (extended) blocks: 21
	Number of lines removed from left file: 0
	Number of new lines added to right file: 2
	Weighted cost (blocks + removed + added): 5

Or in colors:

Please notice, the line number in the left most column, and how wbdiff maps them to the right column, detecting block moves, additions, removals, while some blocks have minor edits in them.

Features:

  • Detection of moved code blocks
  • Fuzzy matching on both block and line level
  • Adaptative moved blocks and fuzzy matching
  • Shortening of long blocks
  • Color output
  • Statistics at the end of diff output
  • Support for reading compressed files transparently (.gz, .bz2)
  • Ability to ignore certain types of changes
  • Normalization of lines
  • Diff algorithm and output tunable using command line options
  • git integration support
  • Tested by more than dozen of unittests
  • Slowness

TODO:

  • Splited/merged lines detection
  • Recursive diffing of multiple files/directories
  • Speed optimizations

History

This tool was created on one evening, when I was utterly annoyed by lack of good diff tools. I checked about 15 of them, and actually Microsoft's free version WinDiff was best (running in WINE)! However, I wanted simple tool, with ability to work from command line natively on Linux, and more possible customizations. Then in few hours I created wbdiff.py :) Works perfectly for me, producing optimal diffs.

Copyright: Witold Baryluk, 2013, 2021

wbdiff's People

Contributors

baryluk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

shatle03

wbdiff's Issues

git-wbdiff.sh aborts with weird error

I'm in a git repo directory:

$ git-wbdiff.sh
Traceback (most recent call last):
File "/home/tpo/bin/wbdiff.py", line 197, in
left = file_reader1(leftfilename).readlines()
IOError: [Errno 2] No such file or directory: ''

PS: and, as noted on g+ your old university email is bouncing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.