Added -m operation to dcp-init.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 27 Jan 2008 22:38:32 +0000 (23:38 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 27 Jan 2008 22:38:32 +0000 (23:38 +0100)
dcp-init

index 38f0459..262a2bb 100755 (executable)
--- a/dcp-init
+++ b/dcp-init
@@ -3,10 +3,11 @@
 set -e
 
 usage() {
-    echo "usage: dcp-init [-sh] [-C key=val] [-d REPODIR] PACKAGE [PATCH...]"
+    echo "usage: dcp-init [-sh] [-C key=val] [-d REPODIR] PACKAGE [(PATCH|-m)...]"
     echo "       PATCH ::= [-p LEVEL] [-bB BRANCH] FILE"
     echo "       -b creates a new branch at the current patch"
     echo "       -B creates a new branch at the upstream sources"
+    echo "       -m merges the current branch into the master branch"
 }
 
 rungit() {
@@ -206,6 +207,7 @@ initvals() {
     level=0
 }
 initvals
+curbranch=master
 while [ $# -gt 0 ]; do
     arg="$1"
     shift
@@ -214,10 +216,16 @@ while [ $# -gt 0 ]; do
            level="$1"
            shift
        elif [ "$arg" = -b ]; then
-           rungit checkout -q -b "$1"
+           curbranch="$1"
            shift
+           rungit checkout -q -b "$curbranch"
        elif [ "$arg" = -B ]; then
-           rungit checkout -q -b "$1" upstream
+           curbranch="$1"
+           shift
+           rungit checkout -q -b "$curbranch" upstream
+       elif [ "$arg" = -m ]; then
+           rungit checkout -q master
+           rungit merge -n "$curbranch"
        else
            echo "dcp-init: unknown patch option '$arg'" >&2
            exit 1