From: Petr Baudis Date: Tue, 9 Sep 2008 22:05:39 +0000 (+0200) Subject: tg import: Standard options parsing X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=commitdiff_plain;h=112f06814e4abad03b37a90b181cdbc7a13267e2 tg import: Standard options parsing --- diff --git a/README b/README index 66a1638..c6b4cb9 100644 --- a/README +++ b/README @@ -361,8 +361,6 @@ tg import The branch names are auto-guessed from the commit messages and prefixed by tp/. - Usage: tg import rev1..rev2 - tg update ~~~~~~~~~ Update the current topic branch wrt. changes in the branches diff --git a/tg-import.sh b/tg-import.sh index ddd5321..910d300 100644 --- a/tg-import.sh +++ b/tg-import.sh @@ -4,6 +4,22 @@ # (c) Aneesh Kumar K.V 2008 # GPLv2 +ranges= + + +## Parse options + +while [ -n "$1" ]; do + arg="$1"; shift + case "$arg" in + -*) + echo "Usage: tg [...] import RANGE..." >&2 + exit 1;; + *) + ranges="$ranges $arg";; + esac +done + tg_get_commit_msg() { @@ -40,7 +56,7 @@ tg_process_commit() } # nice arg verification stolen from git-format-patch.sh -for revpair +for revpair in $ranges do case "$revpair" in ?*..?*)