view tests/test-diff-upgrade @ 11715:4f9dfb54c8b5 stable

qpush --move: move the right patch even with comment lines 88fc876a4833 caused that we find the index of the moving patch in self.series but look it up in self.full_series. The difference between these is that full_series also contains comment lines, and we thus moved the wrong patch. Use back self.full_series to find the moving patch, but take care of striping the patch guard markers before comparing the patch name. Test cases have been added for comments and empty lines in self.full_series, and for the case of guarded patches. Original patch contributed by Mads Kiilerich <mads@kiilerich.com>
author Gilles Moris <gilles.moris@free.fr>
date Sat, 10 Jul 2010 21:23:00 +0200
parents e451e599fbcf
children 4484a7b661f2 9b3913baba0c
line wrap: on
line source

#!/bin/sh

echo "[extensions]" >> $HGRCPATH
echo "autodiff=$TESTDIR/autodiff.py" >> $HGRCPATH
echo "[diff]" >> $HGRCPATH
echo "nodates=1" >> $HGRCPATH

hg init repo
cd repo
echo '% make a combination of new, changed and deleted file'
echo regular > regular
echo rmregular > rmregular
touch rmempty
echo exec > exec
chmod +x exec
echo rmexec > rmexec
chmod +x rmexec
echo setexec > setexec
echo unsetexec > unsetexec
chmod +x unsetexec
echo binary > binary
python -c "file('rmbinary', 'wb').write('\0')"
hg ci -Am addfiles
echo regular >> regular
echo newregular >> newregular
rm rmempty
touch newempty
rm rmregular
echo exec >> exec
echo newexec > newexec
chmod +x newexec
rm rmexec
chmod +x setexec
chmod -x unsetexec
python -c "file('binary', 'wb').write('\0\0')"
python -c "file('newbinary', 'wb').write('\0')"
rm rmbinary
hg addremove

echo '% git=no: regular diff for all files'
hg autodiff --git=no

echo '% git=no: git diff for single regular file'
hg autodiff --git=yes regular

echo '% git=auto: regular diff for regular files and removals'
hg autodiff --git=auto regular newregular rmregular rmbinary rmexec

for f in exec newexec setexec unsetexec binary newbinary newempty rmempty; do
    echo '% git=auto: git diff for' $f
    hg autodiff --git=auto $f
done

echo '% git=warn: regular diff with data loss warnings'
hg autodiff --git=warn

echo '% git=abort: fail on execute bit change'
hg autodiff --git=abort regular setexec

echo '% git=abort: succeed on regular file'
hg autodiff --git=abort regular

cd ..