chiark / gitweb /
tg import: Standard options parsing
authorPetr Baudis <pasky@suse.cz>
Tue, 9 Sep 2008 22:05:39 +0000 (00:05 +0200)
committerPetr Baudis <pasky@suse.cz>
Tue, 9 Sep 2008 22:05:39 +0000 (00:05 +0200)
README
tg-import.sh

diff --git a/README b/README
index 66a1638c96890eed7e6c73810bde64cc3277b135..c6b4cb95dcfa437827cfbf4babaf5c4c3af7492b 100644 (file)
--- a/README
+++ b/README
@@ -361,8 +361,6 @@ tg import
        The branch names are auto-guessed from the commit messages
        and prefixed by tp/.
 
        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
 tg update
 ~~~~~~~~~
        Update the current topic branch wrt. changes in the branches
index ddd532110ab37a75a3bac7d39b10c69728601e08..910d30080abb498c89d216280104622a6c07700d 100644 (file)
@@ -4,6 +4,22 @@
 # (c) Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>  2008
 # GPLv2
 
 # (c) Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>  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()
 {
 
 tg_get_commit_msg()
 {
@@ -40,7 +56,7 @@ tg_process_commit()
 }
 
 # nice arg verification stolen from git-format-patch.sh
 }
 
 # nice arg verification stolen from git-format-patch.sh
-for revpair
+for revpair in $ranges
 do
        case "$revpair" in
        ?*..?*)
 do
        case "$revpair" in
        ?*..?*)