chiark / gitweb /
test suite: gdr-subcommands: Test scrap
[dgit.git] / tests / tests / gdr-subcommands
index fc76b87259ac1b2ad36a88b0fec1b419ee09a829..c48fb5d80e62a68fb97b1912a89142f02896318a 100755 (executable)
@@ -2,8 +2,9 @@
 set -e
 . tests/lib
 
-t-dependencies git-buildpackage libfile-fnmatch-perl faketime
+t-dependencies GDR
 
+t-tstunt-parsechangelog
 t-setup-import gdr-convert-gbp
 
 cd $p
@@ -16,7 +17,8 @@ mix-it () {
        local m=$(git symbolic-ref HEAD)
        t-some-changes "subcommands $m 1"
 
-       t-dgit -wgf quilt-fixup
+       # we want patches mde by dgit, not gdr, for our test cases
+       t-dgit --git-debrebase=true -wgf quilt-fixup
        t-git-next-date
 
        t-some-changes "subcommands $m 2"
@@ -33,10 +35,12 @@ mix-it
 
 git checkout -b unstitched-laundered master
 mix-it
+git branch before-unstitch/unstitched-laundered
 t-git-debrebase
 t-gdr-good laundered
 
 git checkout -b unstitched-mixed master
+git branch before-unstitch/unstitched-mixed
 t-git-debrebase
 mix-it
 
@@ -71,12 +75,25 @@ subcmd () {
                        ;;
                esac
 
+               case "$checkletters" in
+               X*)
+                       t-expect-fail E:'snags: [0-9]* blockers' \
+                       t-git-debrebase $xopts $subcmd
+                       xopts+=' --force'
+                       next_checkletter
+                       ;;
+               esac
+
                case "$checkletters" in
                N*)
                        t-expect-fail E:. \
                        t-git-debrebase $xopts $subcmd
-                       t-git-debrebase $xopts --noop-ok $subcmd
+                       xopts+=' --noop-ok'
+                       next_checkletter
                        ;;
+               esac
+
+               case "$checkletters" in
                [EF]:*)
                        t-expect-fail "$checkletters" \
                        t-git-debrebase $xopts $subcmd
@@ -158,6 +175,12 @@ make_check () {
        f*)
                t-has-ancestor HEAD refs/heads/$before
                ;;
+       Z*)
+               t-refs-same-start
+               t-refs-same refs/heads/$work
+               t-refs-same refs/heads/before-unstitch/$startbranch
+               t-ref-head
+               ;;
        *)
                fail "$1"
                ;;
@@ -180,6 +203,7 @@ subcmd      stitch          Ns      Nu      Sltf    Stf
 subcmd prepush         Ns      Nu      Sltf    Stf
 subcmd quick           ns      Sl      Sltf    Sl
 subcmd conclude        "$Ec"   "$Ec"   Sltf    Sl
+subcmd scrap           Ns      Ns      Z       Z
 subcmd make-patches    sPft    "$Ep"   uPft    "$Ep"
 #subcmd        dgit-upload-hook Psft   "$Ep"   SPft    "$Ep"
 #
@@ -187,6 +211,7 @@ subcmd      make-patches    sPft    "$Ep"   uPft    "$Ep"
 #   E:$pat     } this is an error (must come first)
 #   F:$pat     } arg is passed to expect-fail
 #
+#   X          should fail due to snags, but succeed when forced
 #   XX         crash out of script for manual debugging
 #
 #   N          this is a noop, error unless --noop-ok
@@ -199,6 +224,7 @@ subcmd      make-patches    sPft    "$Ep"   uPft    "$Ep"
 #   V          ffq-prev remains unchanged; implies also u
 #   s          result is stitched, debrebase-last exists and is unchanged
 #   S          result is stitch just made, remaining letters apply to result~
+#   Z          result is rewind to before changes made
 #
 #   P          result is add-patches, remaining letters apply to result~
 #