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

407d66
#!/bin/bash
407d66
#
6ecc07
# path_doCopy.sh -- This function duplicates files inside the working
6ecc07
# copy using subversion commands.
407d66
#
ff008e
# Copyright (C) 2009-2011 Alain Reguera Delgado
407d66
# 
72c8a5
# This program is free software; you can redistribute it and/or
72c8a5
# modify it under the terms of the GNU General Public License as
72c8a5
# published by the Free Software Foundation; either version 2 of the
72c8a5
# License, or (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
c1853c
    # Verify target directory.
c1853c
    cli_checkRepoDirTarget
8ba5a0
ff008e
    # Print action preamble.
ff008e
    cli_printActionPreamble "${FLAG_TO}" 'doCreate' 'AsResponseLine'
ff008e
    
ff008e
    # Verify relation between source and target locations. We cannot
ff008e
    # duplicate an entry if its parent directory doesn't exist as
ff008e
    # entry inside the working copy.
ff008e
    if [[ -f ${ACTIONVAL} ]];then
850ed3
        if [[ ! -d $(dirname "${FLAG_TO}") ]];then
850ed3
           mkdir -p $(dirname "${FLAG_TO}")
ff008e
        fi
850ed3
        svn add $(dirname "${FLAG_TO}") --quiet
ff008e
    fi
6ecc07
ff008e
    # Print action message.
ff008e
    cli_printMessage "${FLAG_TO}" 'AsCreatingLine'
6ecc07
ff008e
    # Copy parent directory.
ff008e
    svn copy ${ACTIONVAL} ${FLAG_TO} --quiet
6ecc07
ff008e
    # Verify syncronization flag.
ff008e
    if [[ $FLAG_SYNC == 'true' ]];then
6ecc07
ff008e
        # Copy parallel directories.
ff008e
        . /home/centos/bin/centos-art manual --copy="$ACTIONVAL" --to="$FLAG_TO"
ff008e
        . /home/centos/bin/centos-art render --copy="$ACTIONVAL" --to="$FLAG_TO"
ff008e
        . /home/centos/bin/centos-art locale --copy="$ACTIONVAL" --to="$FLAG_TO"
8ba5a0
ff008e
    fi
407d66
407d66
}