X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=test_usage.sh;h=df45f5537eb55e43998cfc4f873df3474d1a8f54;hb=56b6f2a05f3f803ca9d14217ab7a81bbdcf7c1ba;hp=caa53883a60bea7e1b0b5e49cd1329ca96856a6f;hpb=e6d48051cbce1f74ec3c50fc0ccb72003258889e;p=be.git diff --git a/test_usage.sh b/test_usage.sh index caa5388..df45f55 100755 --- a/test_usage.sh +++ b/test_usage.sh @@ -4,14 +4,14 @@ # features work, and gives an example of suggested usage to get people # started. # -# usage: test_usage.sh RCS -# where RCS is one of: +# usage: test_usage.sh VCS +# where VCS is one of: # bzr, git, hg, arch, none # # Note that this script uses the *installed* version of be, not the # one in your working tree. -set -e # exit imediately on failed command +set -e # exit immediately on failed command set -o pipefail # pipes fail if any stage fails set -v # verbose, echo commands to stdout @@ -20,44 +20,31 @@ exec 2>&1 # fd 2 now writes to stdout if [ $# -gt 1 ] then - echo "usage: test_usage.sh [RCS]" + echo "usage: test_usage.sh [VCS]" echo "" - echo "where RCS is one of" - for RCS in bzr git hg arch none + echo "where VCS is one of" + for VCS in arch bzr darcs git hg none do - echo " $RCS" + echo " $VCS" done exit 1 elif [ $# -eq 0 ] then - for RCS in bzr git hg arch none + for VCS in arch bzr darcs git hg none do - echo -e "\n\nTesting $RCS\n\n" - $0 "$RCS" || exit 1 + echo -e "\n\nTesting $VCS\n\n" + $0 "$VCS" || exit 1 done exit 0 fi -RCS="$1" +VCS="$1" TESTDIR=`mktemp -d /tmp/BEtest.XXXXXXXXXX` cd $TESTDIR -if [ "$RCS" == "bzr" ] -then - ID=`bzr whoami` - bzr init -elif [ "$RCS" == "git" ] -then - NAME=`git-config user.name` - EMAIL=`git-config user.email` - ID="$NAME <$EMAIL>" - git init -elif [ "$RCS" == "hg" ] -then - ID=`hg showconfig ui.username` - hg init -elif [ "$RCS" == "arch" ] +# Initialize the VCS repository +if [ "$VCS" == "arch" ] then ID=`tla my-id` ARCH_PARAM_DIR="$HOME/.arch-params" @@ -76,52 +63,88 @@ then sed -i 's/^source .*/source ^[._=a-zA-X0-9].*$/' '{arch}/=tagging-method' echo "tla import -A $ARCH_ARCHIVE --summary 'Began versioning'" tla import -A $ARCH_ARCHIVE --summary 'Began versioning' -elif [ "$RCS" == "none" ] +elif [ "$VCS" == "bzr" ] +then + ID=`bzr whoami` + bzr init +elif [ "$VCS" == "darcs" ] +then + if [ -z "$DARCS_EMAIL" ]; then + export DARCS_EMAIL="J. Doe " + fi + ID="$DARCS_EMAIL" + darcs init +elif [ "$VCS" == "git" ] +then + NAME=`git config user.name` + EMAIL=`git config user.email` + ID="$NAME <$EMAIL>" + git init +elif [ "$VCS" == "hg" ] +then + ID=`hg showconfig ui.username` + hg init +elif [ "$VCS" == "none" ] then ID=`id -nu` else - echo "Unrecognized RCS '$RCS'" + echo "Unrecognized VCS '$VCS'" exit 1 fi + if [ -z "$ID" ] -then # set a default ID +then # set a default ID for VCSs that aren't tracking one yet. ID="John Doe " fi echo "I am '$ID'" -be set-root -OUT=`be new 'having too much fun'` +be init # initialize the Bugs Everywhere repository +OUT=`be new 'having too much fun'` # create a new bug echo "$OUT" BUG=`echo "$OUT" | sed -n 's/Created bug with ID //p'` echo "Working with bug: $BUG" be comment $BUG "This is an argument" -be set user_id "$ID" # get tired of guessing user id for none RCS +#be set user_id "$ID" # get tired of guessing user id for none VCS be set # show settings -be comment $BUG:1 "No it isn't" # comment on the first comment +be comment $BUG/ "No it isn't" # comment on the first comment be show $BUG # show details on a given bug -be close $BUG # set bug status to 'closed' +be status closed $BUG # set bug status to 'closed' be comment $BUG "It's closed, but I can still comment." -be open $BUG # set bug status to 'open' +if [ "$VCS" != 'none' ]; then + be commit 'Initial commit' +fi +be status open $BUG # set bug status to 'open' be comment $BUG "Reopend, comment again" -be status $BUG fixed # set bug status to 'fixed' +be status fixed $BUG # set bug status to 'fixed' be list # list all open bugs be list --status fixed # list all fixed bugs -be assign $BUG # assign the bug to yourself -be list -m -s fixed # see fixed bugs assigned to you -be assign $BUG 'Joe' # assign the bug to Joe -be list -a Joe -s fixed # list the fixed bugs assigned to Joe -be assign $BUG none # assign the bug to noone -be diff # see what has changed +be assign - $BUG # assign the bug to yourself +be list -m --status fixed # see fixed bugs assigned to you +be assign 'Joe' $BUG # assign the bug to Joe +be list -a Joe --status fixed # list the fixed bugs assigned to Joe +be assign none $BUG # un-assign the bug +if [ "$VCS" != 'none' ]; then + be diff # see what has changed +fi OUT=`be new 'also having too much fun'` BUGB=`echo "$OUT" | sed -n 's/Created bug with ID //p'` be comment $BUGB "Blissfully unaware of a similar bug" be merge $BUG $BUGB # join BUGB to BUG -be show $BUG # show bug details & comments +be --no-pager show $BUG # show bug details & comments +# you can also export/import XML bugs/comments +OUT=`be new 'yet more fun'` +BUGC=`echo "$OUT" | sed -n 's/Created bug with ID //p'` +be comment $BUGC "The ants go marching..." +be show --xml $BUGC/ | be import-xml --add-only --root $BUG - be remove $BUG # decide that you don't like that bug after all +be commit "You can even commit using BE" +be commit --allow-empty "And you can add empty commits if you like" +be commit "But this will fail" || echo "Failed" + cd / rm -rf $TESTDIR -if [ "$RCS" == "arch" ] +if [ "$VCS" == "arch" ] then # Cleanup everything outside of TESTDIR rm -rf "$ARCH_ARCHIVE_ROOT"