|
|
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 |
#
|
|
|
2d3646 |
# 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 |
local STATUS=''
|
|
|
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.
|
|
|
25b88b |
local PATTERN='^( |A|C|D|I|M|R|X|\?|!|~).+$'
|
|
|
2120de |
|
|
|
c8faf4 |
# Verify the file used as source to retrive its status
|
|
|
c8faf4 |
# information. We only use regular files or directories inside the
|
|
|
c8faf4 |
# working copy.
|
|
|
07ad06 |
cli_checkFiles "$LOCATION" --working-copy
|
|
|
c8faf4 |
|
|
|
c8faf4 |
# Use subversion `status' command to retrive the first character
|
|
|
25b88b |
# in the output. Discard standard error output.
|
|
|
25b88b |
STATUS="$(svn status "$LOCATION" | sed -r "s/${PATTERN}/\1/" 2>/dev/null)"
|
|
|
c8faf4 |
|
|
|
c8faf4 |
# Outout status information.
|
|
|
c8faf4 |
echo -n "$STATUS"
|
|
|
c8faf4 |
|
|
|
c8faf4 |
}
|