|
|
4debce |
#!/bin/bash
|
|
|
4debce |
#
|
|
|
4debce |
# svn_updateRepoChanges.sh -- This function realizes a subversion
|
|
|
4debce |
# update command against the working copy in order to bring changes
|
|
|
4debce |
# from the central repository into the working copy.
|
|
|
4debce |
#
|
|
|
4debce |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
4debce |
#
|
|
|
4debce |
# This program is free software; you can redistribute it and/or modify
|
|
|
4debce |
# it under the terms of the GNU General Public License as published by
|
|
|
4debce |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
4debce |
# your option) any later version.
|
|
|
4debce |
#
|
|
|
4debce |
# This program is distributed in the hope that it will be useful, but
|
|
|
4debce |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4debce |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4debce |
# General Public License for more details.
|
|
|
4debce |
#
|
|
|
4debce |
# You should have received a copy of the GNU General Public License
|
|
|
4debce |
# along with this program; if not, write to the Free Software
|
|
|
4debce |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
4debce |
#
|
|
|
4debce |
# ----------------------------------------------------------------------
|
|
|
4debce |
# $Id$
|
|
|
4debce |
# ----------------------------------------------------------------------
|
|
|
4debce |
|
|
|
4debce |
function svn_updateRepoChanges {
|
|
|
4debce |
|
|
|
4debce |
local -a FILES
|
|
|
4debce |
local -a INFO
|
|
|
4debce |
local -a FILESNUM
|
|
|
4debce |
local COUNT=0
|
|
|
4debce |
local UPDATEOUT=''
|
|
|
4debce |
local PREDICATE=''
|
|
|
4debce |
local CHNGTOTAL=0
|
|
|
4debce |
|
|
|
4debce |
# Update working copy and retrive update output.
|
|
|
4debce |
cli_printMessage "`gettext "Bringing changes from the repository into the working copy"`" --as-banner-line
|
|
|
4e1989 |
UPDATEOUT=$(${SVN} update ${ACTIONVAL} --quiet)
|
|
|
4debce |
|
|
|
4debce |
# Define path of files considered recent modifications from
|
|
|
4debce |
# central repository to working copy.
|
|
|
4e1989 |
FILES[0]=$(echo "$UPDATEOUT" | egrep "^A" | sed -r "s,^.+${TCAR_WORKDIR},,")
|
|
|
4e1989 |
FILES[1]=$(echo "$UPDATEOUT" | egrep "^D" | sed -r "s,^.+${TCAR_WORKDIR},,")
|
|
|
4e1989 |
FILES[2]=$(echo "$UPDATEOUT" | egrep "^U" | sed -r "s,^.+${TCAR_WORKDIR},,")
|
|
|
4e1989 |
FILES[3]=$(echo "$UPDATEOUT" | egrep "^C" | sed -r "s,^.+${TCAR_WORKDIR},,")
|
|
|
4e1989 |
FILES[4]=$(echo "$UPDATEOUT" | egrep "^G" | sed -r "s,^.+${TCAR_WORKDIR},,")
|
|
|
4debce |
|
|
|
4debce |
# Define description of files considered recent modifications from
|
|
|
4debce |
# central repository to working copy.
|
|
|
4debce |
INFO[0]="`gettext "Added"`"
|
|
|
4debce |
INFO[1]="`gettext "Deleted"`"
|
|
|
4debce |
INFO[2]="`gettext "Updated"`"
|
|
|
4debce |
INFO[3]="`gettext "Conflicted"`"
|
|
|
4debce |
INFO[4]="`gettext "Merged"`"
|
|
|
4debce |
|
|
|
4debce |
while [[ $COUNT -ne ${#FILES[*]} ]];do
|
|
|
4debce |
|
|
|
4debce |
# Define total number of files. Avoid counting empty line.
|
|
|
4debce |
if [[ "${FILES[$COUNT]}" == '' ]];then
|
|
|
4debce |
FILESNUM[$COUNT]=0
|
|
|
4debce |
else
|
|
|
4debce |
FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l)
|
|
|
4debce |
fi
|
|
|
4debce |
|
|
|
4debce |
# Calculate total amount of changes.
|
|
|
4debce |
CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]}))
|
|
|
4debce |
|
|
|
4debce |
# Build report predicate. Use report predicate to show any
|
|
|
4debce |
# information specific to the number of files found. For
|
|
|
4debce |
# example, you can use this section to show warning messages,
|
|
|
4debce |
# notes, and so on. By default we use the word `file' or
|
|
|
4debce |
# `files' at ngettext's consideration followed by change
|
|
|
4debce |
# direction.
|
|
|
4debce |
PREDICATE[$COUNT]=`ngettext "file from the repository" \
|
|
|
4debce |
"files from the repository" $((${FILESNUM[$COUNT]} + 1))`
|
|
|
4debce |
|
|
|
4debce |
# Output report line.
|
|
|
4debce |
cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}"
|
|
|
4debce |
|
|
|
4debce |
# Increase counter.
|
|
|
4debce |
COUNT=$(($COUNT + 1))
|
|
|
4debce |
|
|
|
4debce |
done
|
|
|
4debce |
|
|
|
4debce |
}
|