Permalink
Browse files

Add ability to "mark" tickets

  • Loading branch information...
1 parent 0db15bf commit dbb723fe16da7d969651fa31cd6ef6cea1860f18 @singpolyma committed Jul 23, 2009
Showing with 79 additions and 5 deletions.
  1. +35 −5 bin/git-ticket
  2. +44 −0 bin/git-ticket-mark
View
@@ -1,17 +1,43 @@
#!/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"
shift
git ticket-$COMMAND $*
exit
fi
COMMIT=1
-if [ "$1" = "-C" ]; then
- COMMIT=0
- shift
-fi
+MARK=0
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -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
echo "You must supply a subject for the ticket." 1>&2
@@ -51,6 +77,10 @@ if [ -z "`tail -n2 "$NAME" | sed -e's/\n\n//'`" ]; then
exit
fi
+if [ "$MARK" -eq 1 ]; then
+ git ticket mark "$*"
+fi
+
git add "$NAME"
if [ "$COMMIT" -eq 1 ]; then
if git commit -m"New Ticket: $*"; then
View
@@ -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.