
In light of the fact that it seems possible to fit the plastic caps of
a
Debian branded Swiss Army Knife (Last orders
today!) on an existing Swiss Army Knife (
German written
howto as PDF), I started to think about which Victorinox Cybertool
would be the best fitting for me.
And because the
Victorinox comparison page doesn t really show diffs, just
columns with floating text which are not very helpful for generating
diffs in your head, I used command line tools for that purpose:
wdiff
Because the floating texts are not line- but just whitespace-based,
the tool of choice is not
diff but
wdiff, a word-based diff. It encloses additions and removals
in
+ + and
[- -] blocks.
(No, those aren t Japanese smileys although they look a lot like some.
^^).
The easiest and clearest way is to copy and paste the texts from
Victorinox comparison page into some text files and
compare them with
wdiff:
$ wdiff cybertool34.txt cybertool41.txt
+Schraubendreher 2.5mm,+ Pinzette, N hahle mit Nadel hr,
+Holzs ge,+ Bit-Schl ssel( 5 mm Innensechskant f r
die D-SUB Steckverbinder, 4 mm Innensechskant f r Bits, Bit
Phillips 0, Bit Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2,
Bit Hex 4 mm, Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange(
H lsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber(
auch zum DIP-Switch verstellen ), Mehrzweckhaken (Pakettr ger),
+Metalls ge( Metallfeile, Nagelfeile, Nagelreiniger ),+
Dosen ffner( kleiner Schraubendreher ), Kleine Klinge, Grosse
Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber(
Schraubendreher, Drahtabisolierer ), +Holzmeissel / Schaber,+
Bit-Halter, Stecknadel, inox, Schere, Korkenzieher, Zahnstocher
So this already extracted the information which are the seven tools
which are in the Cybertool 41, but not in the Cybertool 34.
Nevertheless the diff is still not easily recognizable on the first
glance. There are several ways to help here.
First
wdiff has an option
--no-common (the
according short option is
-3) which just shows added and
removed words:
$ wdiff -3 cybertool34.txt cybertool41.txt
======================================================================
+Schraubendreher 2.5mm,+
======================================================================
+Holzs ge,+
======================================================================
+Metalls ge( Metallfeile, Nagelfeile, Nagelreiniger ),+
======================================================================
+Holzmeissel / Schaber,+
======================================================================
This is already way better to quickly recognize the actual
differences.
But if you still also want to see the common tools of the two knifes
you need some visual help:
One option is to use
wdiff s
--terminal (or
short
-t) option. Added words are then displayed inverse
and removed words are shown underlined (background and foreground
colors hardcoded as there is no invert colors style in
CSS or
HTML):
$ wdiff -t cybertool34.txt cybertool41.txt
Schraubendreher
2.5mm, Pinzette, N hahle mit Nadel hr, Holzs ge,
Bit-Schl ssel( 5 mm Innensechskant f r die D-SUB
Steckverbinder, 4 mm Innensechskant f r Bits, Bit Phillips 0, Bit
Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm,
Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange(
H lsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber( auch zum
DIP-Switch verstellen ), Mehrzweckhaken (Pakettr ger),
Metalls ge( Metallfeile, Nagelfeile, Nagelreiniger ),
Dosen ffner( kleiner Schraubendreher ), Kleine Klinge,
Druckkugelschreiber, Grosse Klinge, Ring, inox,
Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer
), Holzmeissel /
Schaber, Bit-Halter, Stecknadel, inox, Schere,
Korkenzieher, Zahnstocher
But some still like to to use color instead of the contrast-rich
inverse and the easily to oversee underlining. This is where colordiff
comes into play:
colordiff
colordiff is like syntax highlighting for diffs on the
command line. I works with classic and unified diffs as well as with
wdiffs and debdiffs (the
debdiff command is part of the
devscripts package).
$ wdiff cybertool34.txt cybertool41.txt colordiff
+Schraubendreher
2.5mm,+ Pinzette, N hahle mit Nadel hr, +Holzs ge,+
Bit-Schl ssel( 5 mm Innensechskant f r die D-SUB
Steckverbinder, 4 mm Innensechskant f r Bits, Bit Phillips 0, Bit
Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm,
Bit Torx 8, Bit Torx 10, Bit Torx 15 ), Kombizange(
H lsenpresser, Drahtschneider ), Stech-Bohrahle, Kugelschreiber(
auch zum DIP-Switch verstellen ), Mehrzweckhaken (Pakettr ger),
+Metalls ge(
Metallfeile, Nagelfeile, Nagelreiniger ),+ Dosen ffner(
kleiner Schraubendreher ), Kleine Klinge, Grosse Klinge, Ring, inox,
Mini-Schraubendreher, Kapselheber( Schraubendreher, Drahtabisolierer
), +Holzmeissel /
Schaber,+ Bit-Halter, Stecknadel, inox, Schere, Korkenzieher,
Zahnstocher
$ wdiff cybertool29.txt cybertool41.txt colordiff
+Schraubendreher
2.5mm,+ Pinzette, N hahle mit Nadel hr, +Holzs ge,+
Bit-Schl ssel( 5 mm Innensechskant f r die D-SUB
Steckverbinder, 4 mm Innensechskant f r Bits, Bit Phillips 0, Bit
Phillips 1, Bit-Schlitzschrauben 4 mm, Bit Phillips 2, Bit Hex 4 mm,
Bit Torx 8, Bit Torx 10, Bit Torx 15 ), +Kombizange( H lsenpresser,
Drahtschneider ),+ Stech-Bohrahle, +Kugelschreiber( auch zum
DIP-Switch verstellen ), Mehrzweckhaken (Pakettr ger),
Metalls ge( Metallfeile, Nagelfeile, Nagelreiniger ),+
Dosen ffner( kleiner Schraubendreher ), Kleine Klinge, [-Druckkugelschreiber,-]
Grosse Klinge, Ring, inox, Mini-Schraubendreher, Kapselheber(
Schraubendreher, Drahtabisolierer ), +Holzmeissel / Schaber,+
Bit-Halter, Stecknadel, inox, +Schere,+ Korkenzieher,
Zahnstocher
(Coloured Screenshots done with ANSI HTML
Adapter from the package aha.)
Some, especially those who are used to
git, are probably
confused by the default choice of diff colors. This is easily fixable
by writing the following into you
~/.colordiffrc:
newtext=green
oldtext=red
diffstuff=darkblue
cvsstuff=darkyellow
(See also
/etc/colordiff for the defaults and hints.)
colordiff has by the way two operating modes:
- Without parameter it reads diffs from standard input as seen above.
- With parameters it works as drop-in diff replacement including all
diff options as shown below.
So now let us compare the Cybertool 29 with Cybertool 34 in a normal
diff (by using the texts from above and replacing all commata with
newline characters) with
git-like colors:
$ colordiff cybertool29-lines.txt cybertool34-lines.txt
12a13,14
> Kombizange( H lsenpresser
> Drahtschneider )
13a16,17
> Kugelschreiber( auch zum DIP-Switch verstellen )
> Mehrzweckhaken (Pakettr ger)
16d19
< Druckkugelschreiber
25a29
> Schere
Or as unifed diff with some context:
$ colordiff -u cybertool29-lines.txt cybertool34-lines.txt
--- cybertool29-lines.txt 2011-08-31 20:55:37.195546238 +0200
+++ cybertool34-lines.txt 2011-08-31 20:55:11.667710504 +0200
@@ -10,10 +10,13 @@
Bit Torx 8
Bit Torx 10
Bit Torx 15 )
+Kombizange( H lsenpresser
+Drahtschneider )
Stech-Bohrahle
+Kugelschreiber( auch zum DIP-Switch verstellen )
+Mehrzweckhaken (Pakettr ger)
Dosen ffner( kleiner Schraubendreher )
Kleine Klinge
-Druckkugelschreiber
Grosse Klinge
Ring
inox
@@ -23,5 +26,6 @@
Bit-Halter
Stecknadel
inox
+Schere
Korkenzieher
Zahnstocher
So if you want nicely colored diffs with
Subversion like you re used
to with git, you can use
svn diff colordiff.