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'
28 LC_MESSAGES=C t-git-debrebase status >../status.check
31 egrep '^ *branch is laundered' ../status.check
35 '^ *branch contains furniture|^ *branch is unlaundered|^ *branch needs laundering' ../status.check
36 egrep '^ stitched$' ../status.check
40 # etypes is either a type,
41 # or PseudoMerge-<more etypes>
42 # or AddPatches-<more etypes>
47 bwtip=Y:`t-git-debrebase breakwater`
49 stitched) etypes=Pseudomerge-Upstream ;;
50 pushed) etypes=AddPatches-Pseudomerge-Upstream ;;
51 pushed-interop) etypes=Pseudomerge-AddPatchesInterop-Upstream ;;
55 t-git-debrebase analyse >$anal.check
56 expect=`git rev-parse HEAD`
58 local cid ctype info nparents
59 while read cid ctype info; do
60 : ===== $cid $ctype $info =====
62 local cetype=${etypes%%-*}
63 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
64 local parents="`git log -n1 --pretty=format:%P $cid`"
67 : "$ctype/$cetype" "$parents"
69 case "$ctype/$cetype" in
72 Packaging/Upstream) ;;
74 AddPatches/AddPatchesInterop) ;;
75 Changelog/Packaging) ;;
76 Changelog/Upstream) ;;
81 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
85 case "$ctype/$etypes" in
88 if [ "x$bwtip" != x ]; then
89 test "$bwtip" = "Y:$cid"
96 git log -n1 --pretty=format:%B \
97 | grep '^\[git-debrebase[ :]'
103 expect=${info#Contributor=}
106 git diff --quiet $expect..$cid
109 : 'reject pointless pseudomerges'
110 local overwritten=${parents/$expect/}
111 overwritten=${overwritten// /}
112 t-git-debrebase analyse $overwritten >$anal.overwr
113 local ocid otype oinfo
114 read <$anal.overwr ocid otype oinfo
116 Pseudomerge) test "x$info" != "x$oinfo" ;;
120 git diff --quiet $expect..$cid -- ':.' ':!debian'
121 git diff --quiet $expect..$cid -- ':debian/patches'
125 git diff --quiet $expect..$cid -- \
126 ':.' ':!debian/patches'
130 git diff --quiet $expect..$cid -- \
131 ':.' ':!debian/changelog'
135 git diff --quiet $expect..$cid -- ':debian'
142 local cnparents=`printf "%s" "$parents" | wc -w`
143 test $cnparents = $enparents
146 for f in $parents; do echo $f; done | t-sort -u | wc -w
148 test $cndparents = $cnparents
152 *) fail 'unexpected parent' ;;
160 local which=${2:-dum}
167 echo >>debian/zorkmid$fsuffix "// debian $token"
168 git add debian/zorkmid$fsuffix
169 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
175 echo >>src$fsuffix.c "// upstream $token"
176 git add src$fsuffix.c
177 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
183 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
184 echo "// both! $token" >>$f
187 git commit -m "MIXED add both($fsuffix) ($token)"
194 t-make-new-upstream-tarball () {
196 git checkout make-upstream
197 # leaves ust set to filename of orig tarball
198 echo "upstream $uv" >>docs/README
199 git commit -a -m "upstream $uv tarball"
200 ust=example_$uv.orig.tar.gz
201 git archive -o ../$ust --prefix=example-2.0/ make-upstream
207 # nmu-upload-1 <nmubranch>
208 # gbp pq import or perhaps other similar things
210 # maybe make some dgit-covertible commits
215 git checkout -f -b $nmubranch
217 t-git-debrebase convert-to-gbp
219 # now we are on a gbp patched-unapplied branch
225 t-dch-commit -v $v -m "nmu $nmubranch $v"
231 t-dgit -wgf build-source
234 c=${p}_${v}_source.changes
235 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
236 dput -c $tmp/dput.cf test-dummy $c
238 t-archive-process-incoming sid
244 t-nmu-commit-an-upstream-change () {
245 echo >>newsrc.c "// more upstream"
247 git commit -m 'UPSTREAM NMU'
250 t-maintainer-commit-some-changes () {
251 t-dch-commit -v$v -m "start $v"
253 t-some-changes "maintainer $v"
255 t-git-debrebase stitch
257 git branch did.maintainer
262 t-nmu-causes-ff-fail () {
265 t-expect-fail E:'Not.*fast-forward' \
266 git merge --ff-only dgit/dgit/sid
268 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
272 t-nmu-reconciled-good () {
275 : 'check that what we have is what is expected'
277 git checkout -b compare.nmu origin/master~0
278 git checkout $nmutree .
279 git rm -rf debian/patches
280 git commit -m 'rm patches nmu'
282 git checkout -b compare.maintainer origin/master~0
283 git checkout did.maintainer .
284 git rm -rf --ignore-unmatch debian/patches
285 git commit --allow-empty -m 'rm patches maintainer'
287 git merge compare.nmu
288 git diff --quiet master
290 : 'check that dgit still likes it'
293 t-dgit -wgf quilt-fixup
296 t-gdr-prep-new-upstream () {
299 git checkout make-upstream
300 git reset --hard upstream
301 t-make-new-upstream-tarball $uv
302 git push . make-upstream:upstream