|
|
f20852 |
#!/bin/bash
|
|
|
f20852 |
#
|
|
|
f20852 |
# copy.sh -- This function copies files inside the repository and
|
|
|
f20852 |
# updates menu, nodes and cross references inside repository
|
|
|
f20852 |
# documentation manual for each file copied.
|
|
|
f20852 |
#
|
|
|
f20852 |
# When a copying action is performed inside the repository,
|
|
|
f20852 |
# centos-art.sh script verifies whether the file being copied (the
|
|
|
f20852 |
# source file) is a regular file or a directory.
|
|
|
f20852 |
#
|
|
|
f20852 |
# When a regular file is the source of copying actions, the target
|
|
|
f20852 |
# location can be anything accepted by subversion copy command.
|
|
|
f20852 |
# However, when the source location is a directory, centos-art.sh
|
|
|
f20852 |
# verifies whether that directory is empty or not. If the directory is
|
|
|
f20852 |
# empty, then it is copied to target. However, when there is one or
|
|
|
f20852 |
# more files inside, centos-art.sh loops recursively through all files
|
|
|
f20852 |
# inside that directory, builds a list of files to process and copy
|
|
|
f20852 |
# file by file to target location creating parents directories for
|
|
|
f20852 |
# target files when it be needed.
|
|
|
f20852 |
#
|
|
|
f20852 |
# Copyright (C) 2009-2011 Alain Reguera Delgado
|
|
|
f20852 |
#
|
|
|
f20852 |
# This program is free software; you can redistribute it and/or modify
|
|
|
f20852 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
f20852 |
#
|
|
|
dcd347 |
# This program is distributed in the hope that it will be useful,
|
|
|
dcd347 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
f20852 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
f20852 |
# General Public License for more details.
|
|
|
f20852 |
#
|
|
|
f20852 |
# You should have received a copy of the GNU General Public License
|
|
|
f20852 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
f20852 |
# ----------------------------------------------------------------------
|
|
|
f20852 |
# $Id$
|
|
|
f20852 |
# ----------------------------------------------------------------------
|
|
|
f20852 |
|
|
|
f20852 |
function copy {
|
|
|
f20852 |
|
|
|
f20852 |
local ACTIONNAM=''
|
|
|
f20852 |
local ACTIONVAL=''
|
|
|
f20852 |
local -a ACTIONVALS
|
|
|
f20852 |
local -a SRC
|
|
|
f20852 |
local DST=''
|
|
|
f20852 |
local COUNT=0
|
|
|
f20852 |
|
|
|
f20852 |
# Interpret arguments and options passed through command-line.
|
|
|
f20852 |
copy_getArguments
|
|
|
f20852 |
|
|
|
f20852 |
# Redefine positional parameters using ARGUMENTS. At this point,
|
|
|
f20852 |
# option arguments have been removed from ARGUMENTS variable and
|
|
|
f20852 |
# only non-option arguments remain in it.
|
|
|
f20852 |
eval set -- "$ARGUMENTS"
|
|
|
f20852 |
|
|
|
f20852 |
# Store remaining arguments into an array. This way it is possible
|
|
|
f20852 |
# to find out which is the last argument in the list. The last
|
|
|
f20852 |
# argument in the list is considered the target location while all
|
|
|
f20852 |
# other arguments are considered source locations.
|
|
|
f20852 |
for ACTIONVAL in "$@";do
|
|
|
f20852 |
ACTIONVALS[((++${#ACTIONVALS[*]}))]="$ACTIONVAL"
|
|
|
f20852 |
done
|
|
|
f20852 |
|
|
|
f20852 |
# Define list of source locations using remaining arguments.
|
|
|
f20852 |
while [[ ${COUNT} -lt $((${#ACTIONVALS[*]} - 1)) ]];do
|
|
|
f20852 |
SRC[((++${#SRC[*]}))]=${ACTIONVALS[$COUNT]}
|
|
|
f20852 |
COUNT=$(($COUNT + 1))
|
|
|
f20852 |
done
|
|
|
f20852 |
|
|
|
f20852 |
# Define target location.
|
|
|
f20852 |
DST=$(cli_checkRepoDirTarget "${ACTIONVALS[((${#ACTIONVALS[*]} - 1))]}")
|
|
|
f20852 |
|
|
|
f20852 |
# Loop through source locations and copy them to target location.
|
|
|
f20852 |
for ACTIONVAL in "${SRC[@]}";do
|
|
|
f20852 |
|
|
|
f20852 |
# Check action value. Be sure the action value matches the
|
|
|
f20852 |
# convenctions defined for source locations inside the working
|
|
|
f20852 |
# copy.
|
|
|
f20852 |
cli_checkRepoDirSource
|
|
|
f20852 |
|
|
|
f20852 |
# Syncronize changes between repository and working copy. At
|
|
|
f20852 |
# this point, changes in the repository are merged in the
|
|
|
f20852 |
# working copy and changes in the working copy committed up to
|
|
|
f20852 |
# repository.
|
|
|
f20852 |
cli_syncroRepoChanges "$ACTIONVAL $DST"
|
|
|
f20852 |
|
|
|
f20852 |
# Copy source location to target location.
|
|
|
f20852 |
echo "svn copy $ACTIONVAL $DST"
|
|
|
f20852 |
|
|
|
f20852 |
# Commit changes from working copy to central repository only.
|
|
|
f20852 |
# At this point, changes in the repository are not merged in
|
|
|
f20852 |
# the working copy, but chages in the working copy do are
|
|
|
f20852 |
# committed up to repository.
|
|
|
f20852 |
cli_commitRepoChanges "$ACTIONVAL $DST"
|
|
|
f20852 |
|
|
|
f20852 |
# Update repository documentation manual structure.
|
|
|
f20852 |
centos-art help "$ACTIONVAL" "$DST" --copy
|
|
|
f20852 |
|
|
|
f20852 |
done
|
|
|
f20852 |
|
|
|
f20852 |
}
|