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 ;;
59 breakwater) etypes=Packaging ;;
60 *) fail-unknown-state-$state ;;
64 t-git-debrebase analyse $head >$anal.check
65 expect=`git rev-parse $head`
67 local cid ctype info nparents
68 while read cid ctype info; do
69 : ===== $cid $ctype $info =====
71 local cetype=${etypes%%-*}
72 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
73 local parents="`git log -n1 --pretty=format:%P $cid`"
76 : "$ctype/$cetype" "$parents"
78 case "$ctype/$cetype" in
81 Packaging/Upstream) ;;
82 MergedBreakwaters/Packaging) ;;
83 MergedBreakwaters/Upstream) ;;
85 AddPatches/AddPatchesInterop) ;;
86 Changelog/Packaging) ;;
87 Changelog/Upstream) ;;
92 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
96 case "$ctype/$etypes" in
99 if [ "x$bwtip" != x ]; then
100 test "$bwtip" = "Y:$cid"
107 git log -n1 --pretty=format:%B \
108 | grep '^\[git-debrebase[ :]'
114 expect=${info#Contributor=}
117 git diff --quiet $expect..$cid
120 : 'reject pointless pseudomerges'
121 local overwritten=${parents/$expect/}
122 overwritten=${overwritten// /}
123 t-git-debrebase analyse $overwritten >$anal.overwr
124 local ocid otype oinfo
125 read <$anal.overwr ocid otype oinfo
127 Pseudomerge) test "x$info" != "x$oinfo" ;;
131 git diff --quiet $expect..$cid -- ':.' ':!debian'
132 git diff --quiet $expect..$cid -- ':debian/patches'
136 git diff --quiet $expect..$cid -- \
137 ':.' ':!debian/patches'
141 git diff --quiet $expect..$cid -- \
142 ':.' ':!debian/changelog'
146 git diff --quiet $expect..$cid -- ':debian'
156 local cnparents=`printf "%s" "$parents" | wc -w`
157 test $cnparents = $enparents
160 for f in $parents; do echo $f; done | t-sort -u | wc -w
162 test $cndparents = $cnparents
166 *) fail 'unexpected parent' ;;
173 for f in $parents; do
174 t-gdr-good-analyse $f breakwater \
176 parent_ix=$(( $parent_ix + 1 ))
187 local which=${2:-dum}
194 echo >>debian/zorkmid$fsuffix "// debian $token"
195 git add debian/zorkmid$fsuffix
196 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
202 echo >>src$fsuffix.c "// upstream $token"
203 git add src$fsuffix.c
204 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
210 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
211 echo "// both! $token" >>$f
214 git commit -m "MIXED add both($fsuffix) ($token)"
221 t-make-new-upstream-tarball () {
223 git checkout make-upstream
224 # leaves ust set to filename of orig tarball
225 echo "upstream $uv" >>docs/README
226 git commit -a -m "upstream $uv tarball"
227 ust=example_$uv.orig.tar.gz
228 git archive -o ../$ust --prefix=example-2.0/ make-upstream
234 # nmu-upload-1 <nmubranch>
235 # gbp pq import or perhaps other similar things
237 # maybe make some dgit-covertible commits
242 git checkout -f -b $nmubranch
244 t-git-debrebase convert-to-gbp
246 # now we are on a gbp patched-unapplied branch
252 t-dch-commit -v $v -m "nmu $nmubranch $v"
258 t-dgit -wgf build-source
261 c=${p}_${v}_source.changes
262 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
263 dput -c $tmp/dput.cf test-dummy $c
265 t-archive-process-incoming sid
271 t-nmu-commit-an-upstream-change () {
272 echo >>newsrc.c "// more upstream"
274 git commit -m 'UPSTREAM NMU'
277 t-maintainer-commit-some-changes () {
278 t-dch-commit -v$v -m "start $v"
280 t-some-changes "maintainer $v"
282 t-git-debrebase stitch
284 git branch did.maintainer
289 t-nmu-causes-ff-fail () {
292 t-expect-fail E:'Not.*fast-forward' \
293 git merge --ff-only dgit/dgit/sid
295 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
299 t-nmu-reconciled-good () {
302 : 'check that what we have is what is expected'
304 git checkout -b compare.nmu origin/master~0
305 git checkout $nmutree .
306 git rm -rf debian/patches
307 git commit -m 'rm patches nmu'
309 git checkout -b compare.maintainer origin/master~0
310 git checkout did.maintainer .
311 git rm -rf --ignore-unmatch debian/patches
312 git commit --allow-empty -m 'rm patches maintainer'
314 git merge compare.nmu
315 git diff --quiet master
317 : 'check that dgit still likes it'
320 t-dgit -wgf quilt-fixup
323 t-gdr-prep-new-upstream () {
326 git checkout make-upstream
327 git reset --hard upstream
328 t-make-new-upstream-tarball $uv
329 git push . make-upstream:upstream
334 t-gdr-gbp-import-core () {
340 : 'fake up some kind of upstream'
341 git checkout -b upstream quilt-tip
344 echo junk >debian/rules
346 git commit -m "an upstream retcon ($0)"
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