Blame Scripts/Bash/Functions/Path/path_doDelete.sh

015e01
#!/bin/bash
015e01
#
015e01
# path_doDelete.sh -- This function deletes files inside the working
015e01
# copy using subversion commands.
015e01
#
015e01
# Copyright (C) 2009-2011  Alain Reguera Delgado
015e01
# 
015e01
# This program is free software; you can redistribute it and/or
015e01
# modify it under the terms of the GNU General Public License as
015e01
# published by the Free Software Foundation; either version 2 of the
015e01
# License, or (at your option) any later version.
015e01
# 
015e01
# This program is distributed in the hope that it will be useful, but
015e01
# WITHOUT ANY WARRANTY; without even the implied warranty of
015e01
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015e01
# General Public License for more details.
015e01
#
015e01
# You should have received a copy of the GNU General Public License
015e01
# along with this program; if not, write to the Free Software
015e01
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
015e01
# USA.
015e01
# 
015e01
# ----------------------------------------------------------------------
015e01
# $Id$
015e01
# ----------------------------------------------------------------------
015e01
015e01
function path_doDelete {
015e01
015e01
    local -a SRC
015e01
    local -a DOC
015e01
    local COUNT=0
015e01
015e01
    # Verify target variable. We can't continue if target is empty.
015e01
    if [[ $ACTIONVAL == '' ]];then
015e01
        cli_printMessage "`gettext "There is no source to work with."`" 'AsErrorLine'
015e01
        cli_printMessage "$(caller)" 'AsToKnowMoreLine'
015e01
    fi
015e01
015e01
    # Update texinfo related entry documentation.
015e01
    . /home/centos/bin/centos-art manual --delete="$ACTIONVAL"
015e01
015e01
    # Define source locations. Start with parent directory at position
015e01
    # zero and continue with related parallel directories.
015e01
    SRC[0]=$ACTIONVAL
015e01
    SRC[1]=$(cli_getRepoDirParallel "${SRC[0]}" "$(cli_getRepoTLDir "${SRC[0]}")/Scripts/Bash/Functions/Render/Config")
015e01
    SRC[2]=$(cli_getRepoDirParallel "${SRC[0]}" "$(cli_getRepoTLDir "${SRC[0]}")/Translations")
015e01
015e01
    # Print preamble with affected entries.
015e01
    cli_printMessage "`ngettext "The following entry will be deleted" \
015e01
        "The following entries will be deleted" "${#SRC[*]}"`:"
015e01
    while [[ $COUNT -lt ${#SRC[*]} ]];do
015e01
        # Print affected entry.
015e01
        cli_printMessage "${SRC[$COUNT]}" 'AsResponseLine'
015e01
        # Increment counter.
015e01
        COUNT=$(($COUNT + 1))
015e01
    done
015e01
015e01
    # Request confirmation before continue with action.
015e01
    cli_printMessage "`gettext "Do you want to continue"`" 'AsYesOrNoRequestLine'
015e01
015e01
    # Reset counter.
015e01
    COUNT=0
015e01
015e01
    while [[ $COUNT -lt ${#SRC[*]} ]];do
015e01
015e01
        # Print action message.
015e01
        cli_printMessage "${SRC[$COUNT]}" 'AsDeletingLine'
015e01
015e01
        # Perform action.
015e01
        svn del ${SRC[$COUNT]} --quiet
015e01
015e01
        # Increase counter.
015e01
        COUNT=$(($COUNT + 1))
015e01
015e01
    done 
015e01
015e01
    # Syncronize changes between working copy and central repository.
015e01
    cli_commitRepoChanges "${SRC[@]}"
015e01
015e01
}