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

407d66
#!/bin/bash
407d66
#
407d66
# path_doCopy.sh -- This function implements duplication of files
407d66
# inside the working copy.
407d66
#
407d66
# Copyright (C) 2009, 2010 Alain Reguera Delgado
407d66
# 
407d66
# This program is free software; you can redistribute it and/or modify
407d66
# it under the terms of the GNU General Public License as published by
407d66
# the Free Software Foundation; either version 2 of the License, or
407d66
# (at your option) any later version.
407d66
# 
407d66
# This program is distributed in the hope that it will be useful, but
407d66
# WITHOUT ANY WARRANTY; without even the implied warranty of
407d66
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
407d66
# General Public License for more details.
407d66
#
407d66
# You should have received a copy of the GNU General Public License
407d66
# along with this program; if not, write to the Free Software
407d66
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
407d66
# USA.
407d66
# 
407d66
# ----------------------------------------------------------------------
407d66
# $Id$
407d66
# ----------------------------------------------------------------------
407d66
407d66
function path_doCopy {
407d66
407d66
    local ARGSL
407d66
    local ARGSS
407d66
407d66
    # Define short options supported by copy command we want to
407d66
    # support inside centos-art.sh script. The value of this variable
407d66
    # is used as `getopt --options' option.
407d66
    ARGSS="t:r:m:F:"
407d66
407d66
    # Define long options supported by copy command we want to support
407d66
    # inside centos-art.sh script. The value of this variable is used
407d66
    # as defined by `getopt --longoptions' option.
407d66
    ARGSL="to:,revision:,message:,file:,force-log,editor-cmd:,encoding:,username:,password:,no-auth-cache,non-interactive,config-dir:"
407d66
407d66
    # Parse arguments using getopt(1) command parser.
407d66
    cli_doParseArguments
407d66
407d66
    # Reset positional parameters using output from (getopt) argument
407d66
    # parser.
407d66
    eval set -- "$ARGUMENTS"
407d66
407d66
    # Define target locations using positonal parameters as
407d66
    # reference.
407d66
    while true; do
407d66
        case "$1" in
407d66
            -t|--to )
407d66
                TARGET="$2"
407d66
                shift 2
407d66
                ;;
407d66
            * )
407d66
                break 
407d66
        esac
407d66
    done
407d66
407d66
    # Redefine positional parameters stored inside ARGUMENTS variable.
407d66
    cli_doParseArgumentsReDef "$@"
407d66
407d66
    # Parse positional parameters sotred inside ARGUMENTS variable.
407d66
    cli_doParseArguments
407d66
407d66
    # Build subversion command to duplicate locations inside the
407d66
    # workstation.
407d66
    eval svn copy $SOURCE $TARGET --quiet $ARGUMENTS
407d66
407d66
    # Output action results.
407d66
    if [[ $? -ne 0 ]];then
407d66
        cli_printMessage "$(caller)" 'AsToKnowMoreLine'
407d66
    fi
407d66
    
407d66
}