view tests/test-mq-qdiff @ 9827:4fe9ca519637

mdiff: fix diff -b/B/w on mixed whitespace hunks (issue127) Previous code was computing hunks then checking if these hunks could be ignored when taking whitespace/blank-lines options in accounts. This approach is simple but fails with hunks containing both whitespace and non-whitespace changes, the whole hunk is emitted while it can be mostly made of whitespace. The new version normalize the whitespaces before hunk generation, and test for blank-lines afterwards.
author Patrick Mezard <pmezard@gmail.com>
date Wed, 11 Nov 2009 18:31:42 +0100
parents 3f522d2fa633
children 24bc6e414610
line wrap: on
line source

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH

echo % init
hg init a
cd a

echo % commit
echo 'base' > base
hg ci -Ambase -d '1 0'

echo % qnew mqbase
hg qnew -mmqbase mqbase

echo % qrefresh
echo 'patched' > base
hg qrefresh

echo % qdiff
hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"

echo % qdiff dirname
hg qdiff . | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
                 -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"

echo % qdiff filename
hg qdiff --nodates base

echo % revert
hg revert -a

echo % qpop
hg qpop

echo % qdelete mqbase
hg qdelete mqbase

echo % commit 2
printf '1\n2\n3\n4\nhello world\ngoodbye world\n7\n8\n9\n' > lines
hg ci -Amlines -d '2 0'

echo % qnew 2
hg qnew -mmqbase2 mqbase2
printf '\n\n1\n2\n3\n4\nhello  world\n     goodbye world\n7\n8\n9\n' > lines

echo % qdiff -U 1
hg qdiff --nodates -U 1

echo % qdiff -b
hg qdiff --nodates -b

echo % qdiff -U 1 -B
hg qdiff --nodates -U 1 -B

echo % qdiff -w
hg qdiff --nodates -w

echo % qdiff --inverse
hg qdiff --nodates --inverse