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
30 git diff --quiet ${beforetag-t.before} -- ':.' ':!debian/patches'
32 LC_MESSAGES=C t-git-debrebase status >../status.check
35 egrep '^ *branch is laundered' ../status.check
39 '^ *branch contains furniture|^ *branch is unlaundered|^ *branch needs laundering' ../status.check
40 egrep '^ stitched$' ../status.check
44 t-gdr-good-analyse HEAD $state
47 t-gdr-good-analyse () {
53 # etypes is either a type,
54 # or PseudoMerge-<more etypes>
55 # or AddPatches-<more etypes>
60 bwtip=Y:`t-git-debrebase breakwater`
62 stitched) etypes=Pseudomerge-Upstream ;;
63 pushed) etypes=AddPatches-Pseudomerge-Upstream ;;
64 pushed-interop) etypes=Pseudomerge-AddPatchesInterop-Upstream ;;
65 breakwater) etypes=Packaging ;;
66 *) fail-unknown-state-$state ;;
70 t-git-debrebase analyse $head >$anal.check
71 expect=`git rev-parse $head`
73 local cid ctype info nparents
74 while read cid ctype info; do
75 : ===== $cid $ctype $info =====
77 local cetype=${etypes%%-*}
78 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
79 local parents="`git log -n1 --pretty=format:%P $cid`"
82 : "$ctype/$cetype" "$parents"
84 case "$ctype/$cetype" in
87 Packaging/Upstream) ;;
88 MergedBreakwaters/Packaging) ;;
89 MergedBreakwaters/Upstream) ;;
91 AddPatches/AddPatchesInterop) ;;
92 Changelog/Packaging) ;;
93 Changelog/Upstream) ;;
98 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
102 case "$ctype/$etypes" in
105 if [ "x$bwtip" != x ]; then
106 test "$bwtip" = "Y:$cid"
113 git log -n1 --pretty=format:%B \
114 | grep '^\[git-debrebase[ :]'
120 expect=${info#Contributor=}
123 git diff --quiet $expect..$cid
126 : 'reject pointless pseudomerges'
127 local overwritten=${parents/$expect/}
128 overwritten=${overwritten// /}
129 t-git-debrebase analyse $overwritten >$anal.overwr
130 local ocid otype oinfo
131 read <$anal.overwr ocid otype oinfo
133 Pseudomerge) test "x$info" != "x$oinfo" ;;
137 git diff --quiet $expect..$cid -- ':.' ':!debian'
138 git diff --quiet $expect..$cid -- ':debian/patches'
142 git diff --quiet $expect..$cid -- \
143 ':.' ':!debian/patches'
147 git diff --quiet $expect..$cid -- \
148 ':.' ':!debian/changelog'
152 git diff --quiet $expect..$cid -- ':debian'
162 local cnparents=`printf "%s" "$parents" | wc -w`
163 test $cnparents = $enparents
166 for f in $parents; do echo $f; done | t-sort -u | wc -w
168 test $cndparents = $cnparents
172 *) fail 'unexpected parent' ;;
179 for f in $parents; do
180 t-gdr-good-analyse $f breakwater \
182 parent_ix=$(( $parent_ix + 1 ))
193 local which=${2:-dum}
200 echo >>debian/zorkmid$fsuffix "// debian $token"
201 git add debian/zorkmid$fsuffix
202 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
208 echo >>src$fsuffix.c "// upstream $token"
209 git add src$fsuffix.c
210 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
216 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
217 echo "// both! $token" >>$f
220 git commit -m "MIXED add both($fsuffix) ($token)"
227 t-make-new-upstream-tarball () {
229 git checkout make-upstream
230 # leaves ust set to filename of orig tarball
231 echo "upstream $uv" >>docs/README
232 git commit -a -m "upstream $uv tarball"
233 ust=example_$uv.orig.tar.gz
234 git archive -o ../$ust --prefix=example-2.0/ make-upstream
240 # nmu-upload-1 <nmubranch>
241 # gbp pq import or perhaps other similar things
243 # maybe make some dgit-covertible commits
248 git checkout -f -b $nmubranch
250 t-git-debrebase convert-to-gbp
252 # now we are on a gbp patched-unapplied branch
258 t-dch-commit -v $v -m "nmu $nmubranch $v"
264 t-dgit -wgf build-source
267 c=${p}_${v}_source.changes
268 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
269 dput -c $tmp/dput.cf test-dummy $c
271 t-archive-process-incoming sid
277 t-nmu-commit-an-upstream-change () {
278 echo >>newsrc.c "// more upstream"
280 git commit -m 'UPSTREAM NMU'
283 t-maintainer-commit-some-changes () {
284 t-dch-commit -v$v -m "start $v"
286 t-some-changes "maintainer $v"
288 t-git-debrebase stitch
290 git branch did.maintainer
295 t-nmu-causes-ff-fail () {
298 t-expect-fail E:'Not.*fast-forward' \
299 git merge --ff-only dgit/dgit/sid
301 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
305 t-nmu-reconciled-good () {
308 : 'check that what we have is what is expected'
310 git checkout -b compare.nmu origin/master~0
311 git checkout $nmutree .
312 git rm -rf debian/patches
313 git commit -m 'rm patches nmu'
315 git checkout -b compare.maintainer origin/master~0
316 git checkout did.maintainer .
317 git rm -rf --ignore-unmatch debian/patches
318 git commit --allow-empty -m 'rm patches maintainer'
320 git merge compare.nmu
321 git diff --quiet master
323 : 'check that dgit still likes it'
326 t-dgit -wgf quilt-fixup
329 t-gdr-prep-new-upstream () {
332 git checkout make-upstream
333 git reset --hard upstream
334 t-make-new-upstream-tarball $uv
335 git push . make-upstream:upstream
340 t-gdr-gbp-import-core () {
346 : 'fake up some kind of upstream'
347 git checkout -b upstream quilt-tip
350 echo junk >debian/rules
352 git commit -m "an upstream retcon ($0)"
355 : 'fake up that our quilt-tip was descended from upstream'
356 git checkout quilt-tip
357 git merge --no-edit -s ours upstream
359 : 'fake up that our quilt-tip had the patch queue in it'
360 git checkout patch-queue/quilt-tip
362 git add debian/patches
363 git commit -m "patch queue update ($0)"
365 : 'make branch names more conventional'
367 git branch -m quilt-tip master
370 t-gdr-made-patches () {
371 git log -n1 --'pretty=format:%B' \
372 | egrep '^\[git-debrebase'