|
|
e142db |
#!/bin/bash
|
|
|
e142db |
#
|
|
|
e142db |
# svn_getRepoStatus.sh -- This function requests the working copy
|
|
|
e142db |
# using the svn status command and returns the first character in the
|
|
|
e142db |
# output line, as described in svn help status, for the LOCATION
|
|
|
e142db |
# specified. Use this function to perform verifications based a
|
|
|
e142db |
# repository LOCATION status.
|
|
|
e142db |
#
|
|
|
e142db |
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
|
|
|
e142db |
#
|
|
|
e142db |
# This program is free software; you can redistribute it and/or modify
|
|
|
e142db |
# it under the terms of the GNU General Public License as published by
|
|
|
e142db |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
e142db |
# your option) any later version.
|
|
|
e142db |
#
|
|
|
e142db |
# This program is distributed in the hope that it will be useful, but
|
|
|
e142db |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
e142db |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
e142db |
# General Public License for more details.
|
|
|
e142db |
#
|
|
|
e142db |
# You should have received a copy of the GNU General Public License
|
|
|
e142db |
# along with this program; if not, write to the Free Software
|
|
|
e142db |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
e142db |
#
|
|
|
e142db |
# ----------------------------------------------------------------------
|
|
|
e142db |
# $Id$
|
|
|
e142db |
# ----------------------------------------------------------------------
|
|
|
e142db |
|
|
|
e142db |
function svn_getRepoStatus {
|
|
|
e142db |
|
|
|
e142db |
local LOCATION="$1"
|
|
|
e142db |
|
|
|
e142db |
# Define regular expression pattern to retrive first column,
|
|
|
e142db |
# returned by subversion status command. This column is one
|
|
|
e142db |
# character column as describes `svn help status' command.
|
|
|
e142db |
local PATTERN='^( |A|C|D|I|M|R|X|!|~).+$'
|
|
|
e142db |
|
|
|
e142db |
# Output specific state of location using subversion `status'
|
|
|
e142db |
# command.
|
|
|
e142db |
${SVN} status "$LOCATION" -N --quiet | sed -r "s/${PATTERN}/\1/"
|
|
|
e142db |
|
|
|
e142db |
}
|