| #!/bin/sh |
| # |
| # gitflow -- A collection of Git wrapper scripts to provide high-level |
| # repository operations for Vincent Driessen's branching model: |
| # |
| # Original blog post presenting this model is found at: |
| # http://nvie.com/archives/323 |
| # |
| # Feel free to contribute to this project at: |
| # http://github.com/nvie/gitflow |
| # |
| # Copyright (c) 2010 by Vincent Driessen |
| # |
| |
| export GITFLOW_DIR=$(dirname "$0") |
| |
| usage() { |
| . "$GITFLOW_DIR/gitflow-version" |
| echo "gitflow, version $GITFLOW_VERSION" |
| echo "" |
| echo "usage: gitflow <start|finish> <type> <args>" |
| echo "" |
| echo "arguments:" |
| echo "type can be any of: \"feature\", \"release\", \"hotfix\"" |
| echo "" |
| } |
| |
| check_incoming() { |
| if [ "$ACTION" != "start" -a "$ACTION" != "finish" ]; then |
| usage |
| exit 1 |
| fi |
| |
| if [ "$BTYPE" != "feature" -a "$BTYPE" != "release" -a "$BTYPE" != "hotfix" ]; then |
| usage |
| exit 1 |
| fi |
| } |
| |
| if [ $# -lt 2 ]; then |
| usage |
| exit 1 |
| fi |
| |
| # Set & check arguments |
| ACTION="$1" |
| BTYPE="$2" |
| shift 2 |
| check_incoming |
| |
| # Now, $ACTION and $BTYPE are set |
| # It's time to call the appropriate subcommand |
| . "$GITFLOW_DIR/gitflow-sh-setup" |
| . "$GITFLOW_DIR/gitflow-$BTYPE" |
| |
| if [ "$ACTION" = "start" ]; then |
| start "$@" |
| elif [ "$ACTION" = "finish" ]; then |
| finish "$@" |
| else |
| usage |
| fi |