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 ;;
54 t-git-debrebase analyse >../anal.check
55 expect=`git rev-parse HEAD`
57 local cid ctype info nparents
58 while read cid ctype info; do
59 : ===== $cid $ctype $info =====
61 local cetype=${etypes%%-*}
62 if [ "x$ctype" = "x$cetype" ]; then cetype=SAME; fi
63 local parents="`git log -n1 --pretty=format:%P $cid`"
66 : "$ctype/$cetype" "$parents"
68 case "$ctype/$cetype" in
71 Packaging/Upstream) ;;
73 AddPatches/AddPatchesInterop) ;;
74 Changelog/Packaging) ;;
75 Changelog/Upstream) ;;
80 fail "etypes=$etypes ctype=$ctype cetype=$cetype $cid"
84 case "$ctype/$etypes" in
87 if [ "x$bwtip" != x ]; then
88 test "$bwtip" = "Y:$cid"
95 git log -n1 --pretty=format:%B \
96 | grep '^\[git-debrebase[ :]'
102 expect=${info#Contributor=}
105 git diff --quiet $expect..$cid
108 : 'reject pointless pseudomerges'
109 local overwritten=${parents/$expect/}
110 overwritten=${overwritten// /}
111 t-git-debrebase analyse $overwritten >../anal.overwr
112 local ocid otype oinfo
113 read <../anal.overwr ocid otype oinfo
115 Pseudomerge) test "x$info" != "x$oinfo" ;;
119 git diff --quiet $expect..$cid -- ':.' ':!debian'
120 git diff --quiet $expect..$cid -- ':debian/patches'
124 git diff --quiet $expect..$cid -- \
125 ':.' ':!debian/patches'
129 git diff --quiet $expect..$cid -- \
130 ':.' ':!debian/changelog'
134 git diff --quiet $expect..$cid -- ':debian'
141 local cnparents=`printf "%s" "$parents" | wc -w`
142 test $cnparents = $enparents
145 for f in $parents; do echo $f; done | t-sort -u | wc -w
147 test $cndparents = $cnparents
151 *) fail 'unexpected parent' ;;
159 local which=${2:-dum}
166 echo >>debian/zorkmid$fsuffix "// debian $token"
167 git add debian/zorkmid$fsuffix
168 git commit -m "DEBIAN add zorkmid$fsuffix ($token)"
174 echo >>src$fsuffix.c "// upstream $token"
175 git add src$fsuffix.c
176 git commit -m "UPSTREAM edit src$fsuffix.c ($token)"
182 for f in debian/zorkmid$fsuffix src$fsuffix.c; do
183 echo "// both! $token" >>$f
186 git commit -m "MIXED add both($fsuffix) ($token)"
193 t-make-new-upstream-tarball () {
195 git checkout make-upstream
196 # leaves ust set to filename of orig tarball
197 echo "upstream $uv" >>docs/README
198 git commit -a -m "upstream $uv tarball"
199 ust=example_$uv.orig.tar.gz
200 git archive -o ../$ust --prefix=example-2.0/ make-upstream
206 # nmu-upload-1 <nmubranch>
207 # gbp pq import or perhaps other similar things
209 # maybe make some dgit-covertible commits
214 git checkout -f -b $nmubranch
216 t-git-debrebase convert-to-gbp
218 # now we are on a gbp patched-unapplied branch
224 t-dch-commit -v $v -m "nmu $nmubranch $v"
230 t-dgit -wgf build-source
233 c=${p}_${v}_source.changes
234 debsign -kBCD22CD83243B79D3DFAC33EA3DBCBC039B13D8A $c
235 dput -c $tmp/dput.cf test-dummy $c
237 t-archive-process-incoming sid
243 t-nmu-commit-an-upstream-change () {
244 echo >>newsrc.c "// more upstream"
246 git commit -m 'UPSTREAM NMU'
249 t-maintainer-commit-some-changes () {
250 t-dch-commit -v$v -m "start $v"
252 t-some-changes "maintainer $v"
254 t-git-debrebase stitch
256 git branch did.maintainer
261 t-nmu-causes-ff-fail () {
264 t-expect-fail E:'Not.*fast-forward' \
265 git merge --ff-only dgit/dgit/sid
267 t-expect-fail E:'-fdiverged.*refs/remotes/dgit/dgit/sid' \
271 t-nmu-reconciled-good () {
274 : 'check that what we have is what is expected'
276 git checkout -b compare.nmu origin/master~0
277 git checkout $nmutree .
278 git rm -rf debian/patches
279 git commit -m 'rm patches nmu'
281 git checkout -b compare.maintainer origin/master~0
282 git checkout did.maintainer .
283 git rm -rf --ignore-unmatch debian/patches
284 git commit --allow-empty -m 'rm patches maintainer'
286 git merge compare.nmu
287 git diff --quiet master
289 : 'check that dgit still likes it'
292 t-dgit -wgf quilt-fixup
295 t-gdr-prep-new-upstream () {
298 git checkout make-upstream
299 git reset --hard upstream
300 t-make-new-upstream-tarball $uv
301 git push . make-upstream:upstream