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"
267 t-nmu-commit-an-upstream-change () {
268 echo >>newsrc.c "// more upstream"
270 git commit -m 'UPSTREAM NMU'
273 t-maintainer-commit-some-changes () {
274 t-dch-commit -v$v -m "start $v"
276 t-some-changes "maintainer $v"
278 t-git-debrebase stitch
280 git branch did.maintainer
285 t-nmu-causes-ff-fail () {
288 t-expect-fail E:'Not.*fast-forward' \
289 git merge --ff-only dgit/dgit/sid
291 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
295 t-nmu-reconciled-good () {
298 : 'check that what we have is what is expected'
300 git checkout -b compare.nmu origin/master~0
301 git checkout $nmutree .
302 git rm -rf debian/patches
303 git commit -m 'rm patches nmu'
305 git checkout -b compare.maintainer origin/master~0
306 git checkout did.maintainer .
307 git rm -rf --ignore-unmatch debian/patches
308 git commit --allow-empty -m 'rm patches maintainer'
310 git merge compare.nmu
311 git diff --quiet master
313 : 'check that dgit still likes it'
316 t-dgit -wgf quilt-fixup
319 t-gdr-prep-new-upstream () {
322 git checkout make-upstream
323 git reset --hard upstream
324 t-make-new-upstream-tarball $uv
325 git push . make-upstream:upstream
330 t-gdr-gbp-import-core () {
336 : 'fake up some kind of upstream'
337 git checkout -b upstream quilt-tip
340 echo junk >debian/rules
342 git commit -m "an upstream retcon ($0)"
346 t-gdr-gbp-import-core-with-queue () {
347 t-gdr-gbp-import-core
349 : 'fake up that our quilt-tip was descended from upstream'
350 git checkout quilt-tip
351 git merge --no-edit -s ours upstream
353 : 'fake up that our quilt-tip had the patch queue in it'
354 git checkout patch-queue/quilt-tip
356 git add debian/patches
357 git commit -m "patch queue update ($0)"
359 : 'make branch names more conventional'
361 git branch -m quilt-tip master
364 t-gdr-made-patches () {
365 git log -n1 --'pretty=format:%B' \
366 | egrep '^\[git-debrebase'