#!/bin/sh # # Copyright (c) 2011 Frédéric Heitzmann global test_description := ''git svn dcommit --interactive series'' source ./lib-git-svn.sh test_expect_success 'initialize repo' ' svn_cmd mkdir -m"mkdir test-interactive" "$svnrepo/test-interactive" && git svn clone "$svnrepo/test-interactive" test-interactive && cd test-interactive && touch foo && git add foo && git commit -m"foo: first commit" && git svn dcommit ' test_expect_success 'answers: y [\n] yes' ' ( echo "change #1" >> foo && git commit -a -m"change #1" && echo "change #2" >> foo && git commit -a -m"change #2" && echo "change #3" >> foo && git commit -a -m"change #3" && ( echo "y y" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) ) ' test_expect_success 'answers: yes yes no' ' ( echo "change #1" >> foo && git commit -a -m"change #1" && echo "change #2" >> foo && git commit -a -m"change #2" && echo "change #3" >> foo && git commit -a -m"change #3" && ( echo "yes yes no" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) && git reset --hard remotes/git-svn ) ' test_expect_success 'answers: yes quit' ' ( echo "change #1" >> foo && git commit -a -m"change #1" && echo "change #2" >> foo && git commit -a -m"change #2" && echo "change #3" >> foo && git commit -a -m"change #3" && ( echo "yes quit" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && test $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) && git reset --hard remotes/git-svn ) ' test_expect_success 'answers: all' ' ( echo "change #1" >> foo && git commit -a -m"change #1" && echo "change #2" >> foo && git commit -a -m"change #2" && echo "change #3" >> foo && git commit -a -m"change #3" && ( echo "all" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) && test $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) && git reset --hard remotes/git-svn ) ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git svn dcommit --interactive series">)} spids: [10] ) ] spids: [10] ) (C {(.)} {(./lib-git-svn.sh)}) (C {(test_expect_success)} {(SQ <"initialize repo">)} { (SQ <"\n"> <"\tsvn_cmd mkdir -m\"mkdir test-interactive\" \"$svnrepo/test-interactive\" &&\n"> <"\tgit svn clone \"$svnrepo/test-interactive\" test-interactive &&\n"> <"\tcd test-interactive &&\n"> <"\ttouch foo && git add foo && git commit -m\"foo: first commit\" &&\n"> <"\tgit svn dcommit\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"answers: y [\\n] yes">)} { (SQ <"\n"> <"\t(\n"> <"\t\techo \"change #1\" >> foo && git commit -a -m\"change #1\" &&\n"> <"\t\techo \"change #2\" >> foo && git commit -a -m\"change #2\" &&\n"> <"\t\techo \"change #3\" >> foo && git commit -a -m\"change #3\" &&\n"> <"\t\t( echo \"y\n"> <"\n"> <"y\" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&\n"> <"\t\ttest $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn)\n"> <"\t)\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"answers: yes yes no">)} { (SQ <"\n"> <"\t(\n"> <"\t\techo \"change #1\" >> foo && git commit -a -m\"change #1\" &&\n"> <"\t\techo \"change #2\" >> foo && git commit -a -m\"change #2\" &&\n"> <"\t\techo \"change #3\" >> foo && git commit -a -m\"change #3\" &&\n"> <"\t\t( echo \"yes\n"> <"yes\n"> <"no\" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&\n"> <"\t\ttest $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) &&\n"> <"\t\tgit reset --hard remotes/git-svn\n"> <"\t)\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"answers: yes quit">)} { (SQ <"\n"> <"\t(\n"> <"\t\techo \"change #1\" >> foo && git commit -a -m\"change #1\" &&\n"> <"\t\techo \"change #2\" >> foo && git commit -a -m\"change #2\" &&\n"> <"\t\techo \"change #3\" >> foo && git commit -a -m\"change #3\" &&\n"> <"\t\t( echo \"yes\n"> <"quit\" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&\n"> <"\t\ttest $(git rev-parse HEAD^^^) = $(git rev-parse remotes/git-svn) &&\n"> <"\t\tgit reset --hard remotes/git-svn\n"> <"\t)\n"> <"\t"> ) } ) (C {(test_expect_success)} {(SQ <"answers: all">)} { (SQ <"\n"> <"\t(\n"> <"\t\techo \"change #1\" >> foo && git commit -a -m\"change #1\" &&\n"> <"\t\techo \"change #2\" >> foo && git commit -a -m\"change #2\" &&\n"> <"\t\techo \"change #3\" >> foo && git commit -a -m\"change #3\" &&\n"> <"\t\t( echo \"all\" | GIT_SVN_NOTTY=1 git svn dcommit --interactive ) &&\n"> <"\t\ttest $(git rev-parse HEAD) = $(git rev-parse remotes/git-svn) &&\n"> <"\t\tgit reset --hard remotes/git-svn\n"> <"\t)\n"> <"\t"> ) } ) (C {(test_done)}) ] )