Blame Scripts/CentOS-Art/Functions/cli_isVersioned.sh

3617b9
#!/bin/bash
3617b9
#
3617b9
# cli_isVersioned.sh -- This function determines whether a location is
3617b9
# under version control or not. When the location is under version
4b1f51
# control, this function returns `true'. when the location isn't under
4b1f51
# version control, this function returns `false'.
3617b9
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
3617b9
#
3617b9
# This program is free software; you can redistribute it and/or modify
3617b9
# it under the terms of the GNU General Public License as published by
3617b9
# the Free Software Foundation; either version 2 of the License, or (at
3617b9
# your option) any later version.
3617b9
#
3617b9
# This program is distributed in the hope that it will be useful, but
3617b9
# WITHOUT ANY WARRANTY; without even the implied warranty of
3617b9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3617b9
# General Public License for more details.
3617b9
#
3617b9
# You should have received a copy of the GNU General Public License
3617b9
# along with this program; if not, write to the Free Software
3617b9
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3617b9
#
3617b9
# ----------------------------------------------------------------------
3617b9
# $Id$
3617b9
# ----------------------------------------------------------------------
3617b9
3617b9
function cli_isVersioned {
3617b9
78990f
    # Initialize absolute path using first positional parameter as
78990f
    # reference.
78990f
    local LOCATION="$1"
78990f
78990f
    # Verify location to be sure it really exists.
78990f
    cli_checkFiles $LOCATION
78990f
4b1f51
    # Use subversion to determine whether the location is under
4b1f51
    # version control or not.
3617b9
    svn info $LOCATION &> /dev/null
3617b9
4b1f51
    # Verify subversion exit status and print output.
4b1f51
    if [[ $? -eq 0 ]];then
4b1f51
        echo 'true'
4b1f51
    else
4b1f51
        echo 'false'
4b1f51
    fi
4b1f51
3617b9
}