From 9f2db07cb54fd3b0dbee1c35e7529a1cd66b40d7 Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 30 Jan 2009 18:18:31 +0000 Subject: attempting to fix #47 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@786 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/mkbuild | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index f81526a..dd04dec 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -102,6 +102,8 @@ ${red}DESCRIPTION${normal} print debug information ${red}-e${normal}, ${red}--edit${normal} edit a mkbuild + ${red}-wc${normal}, ${red}--working-copy${normal} + create an unversioned mkbuild working copy ${red}EXAMPLES${normal} ${red}mkbuild -sa pyrex.mkbuild${normal} @@ -206,7 +208,7 @@ function set_parameters { break # we need to break otherwise specific arguments are evalued ;; '-ls'|'--list') - # Repository status + # List mkbuild folder contents ACTION="list" set_mkbuild_name $2 break # we need to break otherwise specific arguments are evalued @@ -232,6 +234,13 @@ function set_parameters { # Open mkbuild with $EDITOR set_mkbuild_name $2 ACTION='edit' + break # we need to break otherwise specific arguments are evalued + ;; + '-wc'|'--working-copy') + # Create an unversioned mkbuild working copy + set_mkbuild_name $2 + ACTION='working_copy' + break # we need to break otherwise specific arguments are evalued ;; '-d'|'--debug') # Debug mode @@ -1672,10 +1681,31 @@ function list_mkbuild_contents { ls `dirname $MKBUILD_NAME` else echo "Not found: $MKBUILD_NAME" + return 1 fi } +function working_copy { + + local copy tmpfolder name + + if [ -e "$MKBUILD_NAME" ]; then + name=$(basename $MKBUILD_NAME .mkbuild) + copy=$(basename $(basename $MKBUILD_NAME .mkbuild)) + if [ -d "$copy" ]; then + tmpfolder="`mktemp $name.XXXXXX`" + mv $copy $tmpfolder/ + fi + rsync -av --exclude=".svn" --exclude=".git" `dirname $MKBUILD_NAME`/ $copy/ &> /dev/null + echo "Working copy for $name set at $(pwd)/$name." + else + echo "Not found: $MKBUILD_NAME" + return 1 + fi + +} + # ---------------------------------------------------------------- #============================= @@ -1778,6 +1808,9 @@ case $ACTION in 'edit') edit_mkbuild ;; + 'working_copy') + working_copy + ;; esac # Clear temporary files -- cgit v1.2.3