]> Pileus Git - ~andy/sunrise/blobdiff - scripts/sunrise-commit
sieve use flag for net-mail/dbmail
[~andy/sunrise] / scripts / sunrise-commit
index 56a8f38442433435b760c7f4abb58a97a1c04ac8..c64a5b5efe59557d72592ce768d7f31457464c26 100755 (executable)
@@ -34,7 +34,6 @@ opt_norepoman=0
 opt_noupdate=0
 opt_quiet=0
 opt_verbose=0
-working_copy_base_dir=""
 
 changelog_append() {
        if [[ $opt_changelog == 1 ]] ; then
@@ -45,46 +44,32 @@ changelog_append() {
                        echo "!!! pre-existing modifications please run sunrise-commit again without the -c"
                        echo "!!! option. To discard the pre-existing modifications run:"
                        echo "!!!   svn revert ChangeLog"
-                       exit 1
+                       echo "!!!"
+                       echo -n "!!! "
+                       echo -n "${BOLD}Are you SURE you want to append to ChangeLog?${NORMAL} [${GREEN}No${NORMAL}/${RED}Yes${NORMAL}] "
+                       read choice
+                       echo
+                       case "$choice" in
+                               yes|Yes|YES)
+                                       ;;
+
+                               n*|N*|"")
+                                       echo "Aborting.  Run sunrise-commit without the -c this time around."
+                                       exit 1 ;;
+
+                               *)
+                                       echo "Unrecognized response - assuming no."
+                                       echo "Aborting.  Run sunrise-commit without the -c this time around."
+                                       exit 1 ;;
+                       esac
                fi
                ebegin "Appending/creating ChangeLog"
-               echangelog "$*"
+               [ -e $(dirname $0)/echangelog ] && ec="$(dirname $0)/echangelog" || ec="echangelog"
+               $ec "$*"
                eend $?
        fi
 }
 
-check_working_copy_base_dir() {
-       local num_dirs=0
-
-       # Ascend to nearest working copy dir in parent dirs
-       while ! get_current_svn_status ; do
-               if [[ "$(pwd)" == "$(dirs -l +1 2>&1)" ]] ; then
-                       echo "!!! Error: No working copy found in parents of current directory."
-                       echo "!!! sunrise-commit must be run from within a working copy tree."
-                       exit 1
-               fi
-               (( num_dirs++ ))
-               pushd .. >/dev/null
-       done
-
-       # Ascend from there to nearest non-working copy dir in parent dirs
-       while get_current_svn_status ; do
-               if [[ "$(pwd)" == "$(dirs -l +1 2>&1)" ]] ; then
-                       break
-               fi
-               (( num_dirs++ ))
-               pushd .. >/dev/null
-       done
-
-       # Working copy base dir is previous dir on stack
-       popd >/dev/null && (( num_dirs-- ))
-    working_copy_base_dir="$(pwd)"
-
-       for (( i=num_dirs ; i > 0 ; i-- )) ; do
-               popd >/dev/null
-       done
-}
-
 create_digests() {
        if [[ $cwd_is_ebuild_dir == 1 ]] ; then
                ebegin "Digesting ebuilds"
@@ -147,8 +132,7 @@ repoman_check() {
        if [[ $opt_norepoman == 0 ]] ; then
                if [[ $cwd_is_ebuild_dir == 1 ]] ; then
                        ebegin "Running repoman"
-                       echo export PORTDIR_OVERLAY="$working_copy_base_dir"
-                       export PORTDIR_OVERLAY="$working_copy_base_dir"
+                       export PORTDIR_OVERLAY="$(dirname $(dirname $(pwd)))"
                        repoman
                        eend $?
                fi
@@ -345,7 +329,6 @@ if [[ -z "$*" ]] ; then
        exit 1
 fi
 
-check_working_copy_base_dir
 [[ "$(ls)" =~ '\.ebuild' ]] && cwd_is_ebuild_dir=1
 
 pushd . >/dev/null
@@ -359,6 +342,7 @@ svn_up || exit $?
 
 [[ $cwd_is_ebuild_dir == 1 && ! -e metadata.xml ]] && cp ../../skel.metadata.xml metadata.xml >/dev/null 2>&1
 
+svn_add || exit $?
 changelog_append "$*" || exit $?
 create_digests || exit $?
 svn_add || exit $?