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 ;;
63 t-git-debrebase analyse $head >$anal.check
64 expect=`git rev-parse $head`
66 local cid ctype info nparents
67 while read cid ctype info; do
68 : ===== $cid $ctype $info =====
70 local cetype=${etypes%%-*}
71 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
72 local parents="`git log -n1 --pretty=format:%P $cid`"
75 : "$ctype/$cetype" "$parents"
77 case "$ctype/$cetype" in
80 Packaging/Upstream) ;;
81 MergedBreakwaters/Packaging) ;;
82 MergedBreakwaters/Upstream) ;;
84 AddPatches/AddPatchesInterop) ;;
85 Changelog/Packaging) ;;
86 Changelog/Upstream) ;;
91 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
95 case "$ctype/$etypes" in
98 if [ "x$bwtip" != x ]; then
99 test "$bwtip" = "Y:$cid"
106 git log -n1 --pretty=format:%B \
107 | grep '^\[git-debrebase[ :]'
113 expect=${info#Contributor=}
116 git diff --quiet $expect..$cid
119 : 'reject pointless pseudomerges'
120 local overwritten=${parents/$expect/}
121 overwritten=${overwritten// /}
122 t-git-debrebase analyse $overwritten >$anal.overwr
123 local ocid otype oinfo
124 read <$anal.overwr ocid otype oinfo
126 Pseudomerge) test "x$info" != "x$oinfo" ;;
130 git diff --quiet $expect..$cid -- ':.' ':!debian'
131 git diff --quiet $expect..$cid -- ':debian/patches'
135 git diff --quiet $expect..$cid -- \
136 ':.' ':!debian/patches'
140 git diff --quiet $expect..$cid -- \
141 ':.' ':!debian/changelog'
145 git diff --quiet $expect..$cid -- ':debian'
155 local cnparents=`printf "%s" "$parents" | wc -w`
156 test $cnparents = $enparents
159 for f in $parents; do echo $f; done | t-sort -u | wc -w
161 test $cndparents = $cnparents
165 *) fail 'unexpected parent' ;;
172 for f in $parents; do
173 t-gdr-good-analyse $f breakwater \
175 parent_ix=$(( $parent_ix + 1 ))
186 local which=${2:-dum}
193 echo >>debian/zorkmid$fsuffix "// debian $token"
194 git add debian/zorkmid$fsuffix
195 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
201 echo >>src$fsuffix.c "// upstream $token"
202 git add src$fsuffix.c
203 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
209 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
210 echo "// both! $token" >>$f
213 git commit -m "MIXED add both($fsuffix) ($token)"
220 t-make-new-upstream-tarball () {
222 git checkout make-upstream
223 # leaves ust set to filename of orig tarball
224 echo "upstream $uv" >>docs/README
225 git commit -a -m "upstream $uv tarball"
226 ust=example_$uv.orig.tar.gz
227 git archive -o ../$ust --prefix=example-2.0/ make-upstream
233 # nmu-upload-1 <nmubranch>
234 # gbp pq import or perhaps other similar things
236 # maybe make some dgit-covertible commits
241 git checkout -f -b $nmubranch
243 t-git-debrebase convert-to-gbp
245 # now we are on a gbp patched-unapplied branch
251 t-dch-commit -v $v -m "nmu $nmubranch $v"
257 t-dgit -wgf build-source
260 c=${p}_${v}_source.changes
261 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
262 dput -c $tmp/dput.cf test-dummy $c
264 t-archive-process-incoming sid
270 t-nmu-commit-an-upstream-change () {
271 echo >>newsrc.c "// more upstream"
273 git commit -m 'UPSTREAM NMU'
276 t-maintainer-commit-some-changes () {
277 t-dch-commit -v$v -m "start $v"
279 t-some-changes "maintainer $v"
281 t-git-debrebase stitch
283 git branch did.maintainer
288 t-nmu-causes-ff-fail () {
291 t-expect-fail E:'Not.*fast-forward' \
292 git merge --ff-only dgit/dgit/sid
294 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
298 t-nmu-reconciled-good () {
301 : 'check that what we have is what is expected'
303 git checkout -b compare.nmu origin/master~0
304 git checkout $nmutree .
305 git rm -rf debian/patches
306 git commit -m 'rm patches nmu'
308 git checkout -b compare.maintainer origin/master~0
309 git checkout did.maintainer .
310 git rm -rf --ignore-unmatch debian/patches
311 git commit --allow-empty -m 'rm patches maintainer'
313 git merge compare.nmu
314 git diff --quiet master
316 : 'check that dgit still likes it'
319 t-dgit -wgf quilt-fixup
322 t-gdr-prep-new-upstream () {
325 git checkout make-upstream
326 git reset --hard upstream
327 t-make-new-upstream-tarball $uv
328 git push . make-upstream:upstream