7 local gdr=${DGIT_GITDEBREBASE_TEST-git-debrebase}
9 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
10 $gdr "--dgit=${DGIT_TEST-dgit}" $GDR_TEST_OPTS \
11 $GDR_TEST_DEBUG $t_gdr_xopts "$@"
12 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
18 local beforetag=$2 # say HEAD to skip this check
19 # state should be one of
24 git diff --quiet ${beforetag-t.before} -- ':.' ':!debian/patches'
26 LC_MESSAGES=C t-git-debrebase status >../status.check
29 egrep '^ *branch is laundered' ../status.check
33 '^ *branch contains furniture|^ *branch is unlaundered|^ *branch needs laundering' ../status.check
34 egrep '^ stitched$' ../status.check
38 t-gdr-good-analyse HEAD $state
41 t-gdr-good-analyse () {
47 # etypes is either a type,
48 # or PseudoMerge-<more etypes>
49 # or AddPatches-<more etypes>
54 bwtip=Y:`t-git-debrebase breakwater`
56 stitched) etypes=Pseudomerge-Upstream ;;
57 pushed) etypes=AddPatches-Pseudomerge-Upstream ;;
58 pushed-interop) etypes=Pseudomerge-AddPatchesInterop-Upstream ;;
62 t-git-debrebase analyse $head >$anal.check
63 expect=`git rev-parse $head`
65 local cid ctype info nparents
66 while read cid ctype info; do
67 : ===== $cid $ctype $info =====
69 local cetype=${etypes%%-*}
70 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
71 local parents="`git log -n1 --pretty=format:%P $cid`"
74 : "$ctype/$cetype" "$parents"
76 case "$ctype/$cetype" in
79 Packaging/Upstream) ;;
81 AddPatches/AddPatchesInterop) ;;
82 Changelog/Packaging) ;;
83 Changelog/Upstream) ;;
88 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
92 case "$ctype/$etypes" in
95 if [ "x$bwtip" != x ]; then
96 test "$bwtip" = "Y:$cid"
103 git log -n1 --pretty=format:%B \
104 | grep '^\[git-debrebase[ :]'
110 expect=${info#Contributor=}
113 git diff --quiet $expect..$cid
116 : 'reject pointless pseudomerges'
117 local overwritten=${parents/$expect/}
118 overwritten=${overwritten// /}
119 t-git-debrebase analyse $overwritten >$anal.overwr
120 local ocid otype oinfo
121 read <$anal.overwr ocid otype oinfo
123 Pseudomerge) test "x$info" != "x$oinfo" ;;
127 git diff --quiet $expect..$cid -- ':.' ':!debian'
128 git diff --quiet $expect..$cid -- ':debian/patches'
132 git diff --quiet $expect..$cid -- \
133 ':.' ':!debian/patches'
137 git diff --quiet $expect..$cid -- \
138 ':.' ':!debian/changelog'
142 git diff --quiet $expect..$cid -- ':debian'
149 local cnparents=`printf "%s" "$parents" | wc -w`
150 test $cnparents = $enparents
153 for f in $parents; do echo $f; done | t-sort -u | wc -w
155 test $cndparents = $cnparents
159 *) fail 'unexpected parent' ;;
167 local which=${2:-dum}
174 echo >>debian/zorkmid$fsuffix "// debian $token"
175 git add debian/zorkmid$fsuffix
176 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
182 echo >>src$fsuffix.c "// upstream $token"
183 git add src$fsuffix.c
184 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
190 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
191 echo "// both! $token" >>$f
194 git commit -m "MIXED add both($fsuffix) ($token)"
201 t-make-new-upstream-tarball () {
203 git checkout make-upstream
204 # leaves ust set to filename of orig tarball
205 echo "upstream $uv" >>docs/README
206 git commit -a -m "upstream $uv tarball"
207 ust=example_$uv.orig.tar.gz
208 git archive -o ../$ust --prefix=example-2.0/ make-upstream
214 # nmu-upload-1 <nmubranch>
215 # gbp pq import or perhaps other similar things
217 # maybe make some dgit-covertible commits
222 git checkout -f -b $nmubranch
224 t-git-debrebase convert-to-gbp
226 # now we are on a gbp patched-unapplied branch
232 t-dch-commit -v $v -m "nmu $nmubranch $v"
238 t-dgit -wgf build-source
241 c=${p}_${v}_source.changes
242 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
243 dput -c $tmp/dput.cf test-dummy $c
245 t-archive-process-incoming sid
251 t-nmu-commit-an-upstream-change () {
252 echo >>newsrc.c "// more upstream"
254 git commit -m 'UPSTREAM NMU'
257 t-maintainer-commit-some-changes () {
258 t-dch-commit -v$v -m "start $v"
260 t-some-changes "maintainer $v"
262 t-git-debrebase stitch
264 git branch did.maintainer
269 t-nmu-causes-ff-fail () {
272 t-expect-fail E:'Not.*fast-forward' \
273 git merge --ff-only dgit/dgit/sid
275 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
279 t-nmu-reconciled-good () {
282 : 'check that what we have is what is expected'
284 git checkout -b compare.nmu origin/master~0
285 git checkout $nmutree .
286 git rm -rf debian/patches
287 git commit -m 'rm patches nmu'
289 git checkout -b compare.maintainer origin/master~0
290 git checkout did.maintainer .
291 git rm -rf --ignore-unmatch debian/patches
292 git commit --allow-empty -m 'rm patches maintainer'
294 git merge compare.nmu
295 git diff --quiet master
297 : 'check that dgit still likes it'
300 t-dgit -wgf quilt-fixup
303 t-gdr-prep-new-upstream () {
306 git checkout make-upstream
307 git reset --hard upstream
308 t-make-new-upstream-tarball $uv
309 git push . make-upstream:upstream