X-Git-Url: http://dolda2000.com/gitweb/?p=dcp.git;a=blobdiff_plain;f=dcp-init;h=f8f3667d905d493b32312231e9bda3d30862a853;hp=6984bad536f6214ea2068a569b906244e309a946;hb=HEAD;hpb=8bcd59df8f5afac0ab3c7cf0e3fe91491958e82b diff --git a/dcp-init b/dcp-init index 6984bad..f8f3667 100755 --- a/dcp-init +++ b/dcp-init @@ -3,10 +3,11 @@ set -e usage() { - echo "usage: dcp-init [-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() { @@ -42,7 +43,7 @@ getaptsrc() { } initrepo() { - rungit init -q --shared + rungit init mkdir "$td/control" touch "$td/control/conf" rungit add control @@ -55,6 +56,16 @@ initbase() { mkdir "$td/control/update.d" cat >"$td/control/functions" <repo/src/debian/changelog.new <"$td/control/build" <"$td/control/update.d/post-logchange" <>"$td/control/conf" rungit add control/conf } @@ -139,6 +188,7 @@ EOF defdir=/srv/dcp repodir= confopts=() +shared=n while [ "${1:0:1}" = - ]; do opt="${1:1}" @@ -149,6 +199,8 @@ while [ "${1:0:1}" = - ]; do elif [ "$opt" = h ]; then usage exit 0 + elif [ "$opt" = s ]; then + shared=y elif [ "$opt" = C ]; then confopts=("${confopts[@]}" "$1") shift @@ -198,6 +250,7 @@ initvals() { level=0 } initvals +curbranch=master while [ $# -gt 0 ]; do arg="$1" shift @@ -206,10 +259,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 @@ -229,5 +288,9 @@ while [ $# -gt 0 ]; do done git clone -q --bare "$td" "$repodir" +if [ "$shared" = y ]; then + chmod -R g+w "$repodir" + td="$repodir" rungit config core.sharedrepository 1 +fi rm -rf "$td"