Blame Scripts/Bash/Functions/Vcs/Git/git_syncRepoChanges.sh

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