regression: Fix test descriptions
[guilt.git] / guilt-patchbomb
blobe8b75b7cc07339330dc1508f9a5e26cec9c3fa99
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2007
6 DO_NOT_CHECK_BRANCH_EXISTENCE=1
7 source "`dirname $0`/guilt"
9 USAGE="$USAGE <since>[..[<until>]]"
10 # this means:
11 # <hash> - one commit
12 # <hash>.. - hash until head
13 # <hash>..<hash> - from hash to hash
15 if [ $# -ne 1 ]; then
16 print_usage
17 exit 1
20 r="$1"
22 # FIXME: allow r="<hash>"
23 # FIXME: allow in-reply-to
25 # find a suitable pager (this might be a good candidate for putting it into
26 # the lib)
27 pager="$PAGER"
28 if [ -z "$pager" ]; then
29 pager="more"
32 # display the list of commits to be sent as patches
33 git-log --pretty=oneline "$r" | cut -c 1-8,41- | $pager
35 echo -n "Are these what you want to send? [Y/n] "
36 read n
37 if [ "$n" = "n" -o "$n" = "N" ]; then
38 echo "Aborting..."
39 exit 0
42 dir=/tmp/patches-$RANDOM/
43 if [ -e $dir ]; then
44 echo "Conspiracy uncovered: Temporary dir '$dir' already exists" >&2
45 exit 1
47 echo "Using '$dir' as temporary directory"
49 git-format-patch -o $dir -n -s "$r"
51 # get the to/cc addresses
52 echo -n "Enter all the To: email addresses (separated by space): "
53 read rawto
54 echo -n "Enter all the Cc: email addresses (separated by space): "
55 read rawcc
57 # convert list of email addresses to command line options
58 to_opts=""
59 for rt in $rawto; do
60 to_opts="$to_opts --to $rt"
61 done
62 for rc in $rawcc; do
63 to_opts="$to_opts --cc $rc"
64 done
66 opts=""
67 # FIXME: if more than one patch:
68 opts="--no-chain-reply-to --compose"
69 # fi
70 opts="$opts $to_opts"
72 # last possible point to abort!
73 echo "About to execute 'git-send-email $opts $dir'"
74 echo -n "Proceed with patchbomb (this is the last chance to abort)? [y/N] "
75 read n
76 if [ "$n" != "y" -a "$n" != "Y" ]; then
77 echo "Aborting..."
78 exit 0
81 # ...and off they go.
82 git-send-email $opts $dir
84 # cleanup?
85 echo -n "Delete temporary directory? [Y/n] "
86 read n
88 [ "$n" != "n" -a "$n" != "N" ] && exit 0
89 rm -rf $dir