Skip to content

Commit

Permalink
Add ability to "mark" tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Jul 23, 2009
1 parent 0db15bf commit dbb723f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 5 deletions.
40 changes: 35 additions & 5 deletions bin/git-ticket
@@ -1,17 +1,43 @@
#!/bin/sh #!/bin/sh


if [ "$1" = "list" -o "$1" = "close" -o "$1" = "comment" ]; then if [ "$1" = "list" -o "$1" = "close" -o "$1" = "comment" -o "$1" = "mark" ]; then
COMMAND="$1" COMMAND="$1"
shift shift
git ticket-$COMMAND $* git ticket-$COMMAND $*
exit exit
fi fi


COMMIT=1 COMMIT=1
if [ "$1" = "-C" ]; then MARK=0
COMMIT=0 while [ $# -gt 0 ]; do
shift case "$1" in
fi -C)
COMMIT=0
shift
;;
-m)
MARK=1
shift
;;
-mC)
COMMIT=0
MARK=1
shift
;;
-Cm)
COMMIT=0
MARK=1
shift
;;
-*)
echo "Unsupported switch $1" 1>&2
exit 1
;;
*)
break
;;
esac
done


if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "You must supply a subject for the ticket." 1>&2 echo "You must supply a subject for the ticket." 1>&2
Expand Down Expand Up @@ -51,6 +77,10 @@ if [ -z "`tail -n2 "$NAME" | sed -e's/\n\n//'`" ]; then
exit exit
fi fi


if [ "$MARK" -eq 1 ]; then
git ticket mark "$*"
fi

git add "$NAME" git add "$NAME"
if [ "$COMMIT" -eq 1 ]; then if [ "$COMMIT" -eq 1 ]; then
if git commit -m"New Ticket: $*"; then if git commit -m"New Ticket: $*"; then
Expand Down
44 changes: 44 additions & 0 deletions bin/git-ticket-mark
@@ -0,0 +1,44 @@
#!/bin/sh

COMMAND="add"
if [ "$1" = "rm" -o "$1" = "clear" ]; then
COMMAND="$1"
shift
fi

SUBDIRECTORY_OK=1
if ! . "`git --exec-path`/git-sh-setup"; then
exit 1
fi
if ! cd_to_toplevel; then
exit 1
fi

if [ -z "`grep .tickets/current .git/info/exclude`" ]; then
echo ".tickets/current" >> .git/info/exclude
fi

mkdir -p .tickets
cd .tickets

if [ "$COMMAND" = "clear" ]; then
rm current
echo "Marks cleared"
exit
fi

if [ -z "$1" -o ! -f "$1" ]; then
echo "Must specify a valid ticket." 1>&2
exit 1
fi

if [ "$COMMAND" = "rm" ]; then
touch current
DATA="`sed -e"s/^$1$//" current`"
echo "$DATA" > current
echo "Mark removed"
exit
fi

echo "$1" >> current
echo "Marked"

0 comments on commit dbb723f

Please sign in to comment.