diff options
Diffstat (limited to 'tests/tests/import-r1clog')
-rwxr-xr-x | tests/tests/import-r1clog | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/tests/import-r1clog b/tests/tests/import-r1clog new file mode 100755 index 0000000..ae24d17 --- /dev/null +++ b/tests/tests/import-r1clog @@ -0,0 +1,68 @@ +#!/bin/bash +set -e +. tests/lib + +p=sunxi-tools +v_upstr=1.2 +v_base=$v_upstr-2 +v_input=$v_base.~~dgittest + +dpkg-source -x $troot/pkg-srcs/${p}_${v_input}.dsc unmang + +mkdir $p +cd $p +git init +cd .. + +perl-i-clog () { + perl -i "$@" debian/changelog +} + +mangle-start () { + mang=$1 + v="$v_base.$mang" + cp -al unmang $mang + cd $mang + perl-i-clog -pe 's{\~\~dgittest}{'$mang'} if $.==1' + cat >>debian/changelog <<'END' + +sunxi-tools (1.0-1) unstable; urgency=medium + + * Lies for dgit testing + + -- Example <example@example.org> Sat, 12 Jul 2011 20:51:56 +0100 +END +} +mangle-import () { + rm -f debian/*~ + dpkg-source -b . + cd ../$p + t-dgit import-dsc ../${p}_${v}.dsc $mang + git checkout $mang +} +mangle-done () { + cd .. +} + +mangle-start good +mangle-import + +: ---------- 'check that if all is well we make right author line' ---------- + +perl -ne <debian/changelog ' + next unless m{^'$p' \('$v_upstr'-1\) }...m{^\S}; + next unless m{^ -- (.*) (.*) ([-+]\d+)}; + $time_t = `date -d "$2 $3" +%s`; + chomp $time_t; + $authline = "$1 $time_t $3"; + print "author $authline\n"; + print "committer $authline\n"; + exit 0; +' >../headlines-exp +ch=$(git log -P --grep '^\[dgit import orig ' --pretty='format:%H') +git cat-file commit $ch | +perl -ne 'next if m/^$/..0; print if m/^(?:author|committer) /' \ + >../headlines-got-orig +diff ../headlines-exp ../headlines-got-orig + +mangle-done |