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

c8faf4
#!/bin/bash
c8faf4
#
c8faf4
# cli_getRepoStatus.sh -- This function requests the working copy
5f7975
# using the svn status command and returns the first character in the
5f7975
# output line, as described in svn help status, for the LOCATION
68c0cf
# specified. Use this function to perform verifications based a
5f7975
# repository LOCATION status. 
c8faf4
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# 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.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# WITHOUT ANY WARRANTY; without even the implied warranty of
c8faf4
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c8faf4
# General Public License for more details.
c8faf4
#
c8faf4
# You should have received a copy of the GNU General Public License
c8faf4
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
c8faf4
# ----------------------------------------------------------------------
c8faf4
# $Id$
c8faf4
# ----------------------------------------------------------------------
c8faf4
c8faf4
function cli_getRepoStatus {
c8faf4
c01d0e
    local LOCATION="$1"
c8faf4
2120de
    # Define regular expression pattern to retrive first column,
2120de
    # returned by subversion status command. This column is one
2120de
    # character column as describes `svn help status' command.
9c0f73
    local PATTERN='^( |A|C|D|I|M|R|X|!|~).+$'
2120de
d58ad3
    # Output specific state of location using subversion `status'
d58ad3
    # command.
9c0f73
    svn status "$LOCATION" --quiet | sed -r "s/${PATTERN}/\1/"
c8faf4
c8faf4
}