9 local gdr=${DGIT_GITDEBREBASE_TEST-git-debrebase}
11 {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{'
12 $gdr "--dgit=${DGIT_TEST-dgit}" $GDR_TEST_OPTS \
13 $GDR_TEST_DEBUG $t_gdr_xopts "$@"
14 : '}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
20 local beforetag=$2 # say HEAD to skip this check
21 # state should be one of
32 git diff --quiet ${beforetag-t.before} -- ':.' ':!debian/patches'
34 LC_MESSAGES=C t-git-debrebase status >../status.check
37 egrep '^ *branch is laundered' ../status.check
41 '^ *branch contains furniture|^ *branch is unlaundered|^ *branch needs laundering' ../status.check
42 egrep '^ stitched$' ../status.check
46 t-gdr-good-analyse HEAD $state
49 t-gdr-good-analyse () {
55 # etypes is either a type,
56 # or PseudoMerge-<more etypes>
57 # or AddPatches-<more etypes>
62 bwtip=Y:`t-git-debrebase breakwater`
64 stitched) etypes=Pseudomerge-Upstream ;;
65 pushed) etypes=AddPatches-Pseudomerge-Upstream ;;
66 pushed-interop) etypes=Pseudomerge-AddPatchesInterop-Upstream ;;
67 breakwater) etypes=Packaging ;;
68 *) fail-unknown-state-$state ;;
72 t-git-debrebase analyse $head >$anal.check
73 expect=`git rev-parse $head`
75 local cid ctype info nparents
76 while read cid ctype info; do
77 : ===== $cid $ctype $info =====
79 local cetype=${etypes%%-*}
80 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
81 local parents="`git log -n1 --pretty=format:%P $cid`"
84 : "$ctype/$cetype" "$parents"
86 case "$ctype/$cetype" in
89 Packaging/Upstream) ;;
90 MergedBreakwaters/Packaging) ;;
91 MergedBreakwaters/Upstream) ;;
93 AddPatches/AddPatchesInterop) ;;
94 Changelog/Packaging) ;;
95 Changelog/Upstream) ;;
100 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
104 case "$ctype/$etypes" in
107 if [ "x$bwtip" != x ]; then
108 test "$bwtip" = "Y:$cid"
115 git log -n1 --pretty=format:%B \
116 | grep '^\[git-debrebase[ :]'
122 expect=${info#Contributor=}
125 git diff --quiet $expect..$cid
128 : 'reject pointless pseudomerges'
129 local overwritten=${parents/$expect/}
130 overwritten=${overwritten// /}
131 t-git-debrebase analyse $overwritten >$anal.overwr
132 local ocid otype oinfo
133 read <$anal.overwr ocid otype oinfo
135 Pseudomerge) test "x$info" != "x$oinfo" ;;
139 git diff --quiet $expect..$cid -- ':.' ':!debian'
140 git diff --quiet $expect..$cid -- ':debian/patches'
144 git diff --quiet $expect..$cid -- \
145 ':.' ':!debian/patches'
149 git diff --quiet $expect..$cid -- \
150 ':.' ':!debian/changelog'
154 git diff --quiet $expect..$cid -- ':debian'
164 local cnparents=`printf "%s" "$parents" | wc -w`
165 test $cnparents = $enparents
168 for f in $parents; do echo $f; done | t-sort -u | wc -w
170 test $cndparents = $cnparents
174 *) fail 'unexpected parent' ;;
181 for f in $parents; do
182 t-gdr-good-analyse $f breakwater \
184 parent_ix=$(( $parent_ix + 1 ))
195 local which=${2:-dum}
202 echo >>debian/zorkmid$fsuffix "// debian $token"
203 git add debian/zorkmid$fsuffix
204 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
210 echo >>src$fsuffix.c "// upstream $token"
211 git add src$fsuffix.c
212 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
218 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
219 echo "// both! $token" >>$f
222 git commit -m "MIXED add both($fsuffix) ($token)"
229 t-make-new-upstream-tarball () {
231 git checkout make-upstream
232 echo "upstream $uv" >>docs/README
233 git commit -a -m "upstream $uv tarball"
234 t-make-orig example $uv 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)"
356 t-gdr-gbp-import-core-with-queue () {
357 t-gdr-gbp-import-core
359 : 'fake up that our quilt-tip was descended from upstream'
360 git checkout quilt-tip
361 git merge --no-edit -s ours upstream
363 : 'fake up that our quilt-tip had the patch queue in it'
364 git checkout patch-queue/quilt-tip
366 git add debian/patches
367 git commit -m "patch queue update ($0)"
369 : 'make branch names more conventional'
371 git branch -m quilt-tip master
374 t-gdr-made-patches () {
375 git log -n1 --'pretty=format:%B' \
376 | egrep '^\[git-debrebase'