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

878a2b
#!/bin/bash
878a2b
#
3b9515
# subversion_syncRepoChanges.sh -- This function syncnizes both
3b9515
# central repository and working copy directory structures by
3b9515
# performing a subversion update command first and a subversion commit
3b9515
# command later.
878a2b
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
878a2b
#
878a2b
# This program is free software; you can redistribute it and/or modify
878a2b
# it under the terms of the GNU General Public License as published by
878a2b
# the Free Software Foundation; either version 2 of the License, or (at
878a2b
# your option) any later version.
878a2b
#
878a2b
# This program is distributed in the hope that it will be useful, but
878a2b
# WITHOUT ANY WARRANTY; without even the implied warranty of
878a2b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
878a2b
# General Public License for more details.
878a2b
#
878a2b
# You should have received a copy of the GNU General Public License
878a2b
# along with this program; if not, write to the Free Software
878a2b
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
3b9515
function subversion_syncRepoChanges {
878a2b
a67b85
    local LOCATION=''
a67b85
    local LOCATIONS="${@}"
a67b85
a67b85
    for LOCATION in $LOCATIONS;do
a67b85
a67b85
        # Verify whether the location is valid or not.
a67b85
        LOCATION=$(cli_checkRepoDirSource ${LOCATION})
a67b85
9470ed
        # Verify source location absolute path. It should point either
9470ed
        # to existent files or directories both under version control
9470ed
        # inside the working copy.  Otherwise, if it doesn't point to
9470ed
        # an existent file under version control, finish the script
9470ed
        # execution with an error message.
9470ed
        cli_checkFiles ${LOCATION} -e --is-versioned
a67b85
a67b85
        # Bring changes from the repository into the working copy.
3b9515
        subversion_updateRepoChanges ${LOCATION}
a67b85
a67b85
        # Check changes in the working copy.
3b9515
        subversion_commitRepoChanges ${LOCATION}
a67b85
a67b85
    done
878a2b
878a2b
}