Blame Scripts/Bash/Functions/Vcs/Subversion/subversion_copyRepoFile.sh

e27e10
#!/bin/bash
e27e10
#
3b9515
# subversion_copyRepoFile.sh -- This function standardizes the way
3b9515
# files (including directories) are duplicated inside the working
3b9515
# copy. This function is an interface for subversion's `copy' command.
e27e10
#
e6bbbf
# Copyright (C) 2009-2013 The CentOS Project
e27e10
#
e27e10
# This program is free software; you can redistribute it and/or modify
e27e10
# it under the terms of the GNU General Public License as published by
e27e10
# the Free Software Foundation; either version 2 of the License, or (at
e27e10
# your option) any later version.
e27e10
#
e27e10
# This program is distributed in the hope that it will be useful, but
e27e10
# WITHOUT ANY WARRANTY; without even the implied warranty of
e27e10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
e27e10
# General Public License for more details.
e27e10
#
e27e10
# You should have received a copy of the GNU General Public License
e27e10
# along with this program; if not, write to the Free Software
e27e10
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
e27e10
#
e27e10
# ----------------------------------------------------------------------
e27e10
# $Id$
e27e10
# ----------------------------------------------------------------------
e27e10
3b9515
function subversion_copyRepoFile {
e27e10
e27e10
    local SOURCE=$(cli_checkRepoDirSource ${1})
e27e10
    local TARGET=$(cli_checkRepoDirSource ${2})
e27e10
e27e10
    # Verify source location absolute path. It should point either to
e27e10
    # existent files or directories both under version control inside
e27e10
    # the working copy.  Otherwise, if it doesn't point to an existent
e27e10
    # file under version control, finish the script execution with an
e27e10
    # error message.
e27e10
    cli_checkFiles ${SOURCE} -e --is-versioned
e27e10
e27e10
    # Print action reference.
9d70c4
    if [[ -f ${SOURCE} ]];then
9d70c4
        cli_printMessage "${TARGET}/$(basename ${SOURCE})" --as-creating-line
9d70c4
    else
9d70c4
        cli_printMessage "${TARGET}" --as-creating-line
9d70c4
    fi
e27e10
e27e10
    # Copy source location to its target using version control.
3b9515
    ${COMMAND} copy ${SOURCE} ${TARGET} --quiet
e27e10
e27e10
}