forked from lix-project/lix
* Commit old changed to bdiff.sh - but bdiff.sh is obsolete.
This commit is contained in:
parent
77970f8daf
commit
f4041cc175
|
@ -1,7 +1,7 @@
|
||||||
#! /bin/sh -e
|
#! /bin/sh -e
|
||||||
|
|
||||||
#DIFF=/home/eelco/Dev/nix/zdelta-2.1/zdc
|
#DIFF=zdc
|
||||||
DIFF=/home/eelco/Dev/nix/bsdiff-4.2/bsdiff
|
DIFF=bsdiff
|
||||||
|
|
||||||
srcA=$1
|
srcA=$1
|
||||||
srcB=$2
|
srcB=$2
|
||||||
|
@ -15,26 +15,38 @@ fi
|
||||||
|
|
||||||
if test -f "$srcA/$fn"; then
|
if test -f "$srcA/$fn"; then
|
||||||
|
|
||||||
echo "FILE DELTA FOR $fn"
|
if ! test -f "$srcB/$fn"; then
|
||||||
|
echo "DELETE $fn"
|
||||||
|
else
|
||||||
|
|
||||||
TMPFILE=/tmp/__bsdiff
|
if ! cmp "$srcA/$fn" "$srcB/$fn" > /dev/null; then
|
||||||
$DIFF "$srcA/$fn" "$srcB/$fn" $TMPFILE
|
|
||||||
cat $TMPFILE
|
|
||||||
|
|
||||||
diffSize=$(stat -c '%s' $TMPFILE)
|
echo "FILE DELTA FOR $fn"
|
||||||
|
|
||||||
# For comparison.
|
TMPFILE=/tmp/__bsdiff
|
||||||
bzipSize=$(bzip2 < "$srcB/$fn" | wc -m)
|
$DIFF "$srcA/$fn" "$srcB/$fn" $TMPFILE
|
||||||
|
cat $TMPFILE
|
||||||
|
|
||||||
gain=$(echo "scale=2; ($diffSize - $bzipSize) / $bzipSize * 100" | bc)
|
diffSize=$(stat -c '%s' $TMPFILE)
|
||||||
|
|
||||||
ouch=$(if test "${gain:0:1}" != "-"; then echo "!"; fi)
|
# For comparison.
|
||||||
|
bzipSize=$(bzip2 < "$srcB/$fn" | wc -m)
|
||||||
|
|
||||||
printf "%7.2f %1s %10d %10d %s\n" \
|
gain=$(echo "scale=2; ($diffSize - $bzipSize) / $bzipSize * 100" | bc)
|
||||||
"$gain" "$ouch" "$diffSize" "$bzipSize" "$fn" >&2
|
|
||||||
|
ouch=$(if test "${gain:0:1}" != "-"; then echo "!"; fi)
|
||||||
|
|
||||||
|
printf "%7.2f %1s %10d %10d %s\n" \
|
||||||
|
"$gain" "$ouch" "$diffSize" "$bzipSize" "$fn" >&2
|
||||||
# echo "$fn -> $diffSize $bzipSize ==> $gain $ouch" >&2
|
# echo "$fn -> $diffSize $bzipSize ==> $gain $ouch" >&2
|
||||||
|
|
||||||
rm $TMPFILE
|
rm $TMPFILE
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Note: be silent about unchanged files.
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue