Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
#!/bin/sh -eu
|
2012-07-15 22:09:45 +00:00
|
|
|
#
|
|
|
|
# psvn - Wrapper to set Subversion properties automatically
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 Beat Gaetzi <beat@FreeBSD.org>
|
2014-01-21 00:44:08 +00:00
|
|
|
# Copyright (c) 2012,2014 Matthias Andree <mandree@FreeBSD.org>
|
2012-07-15 22:09:45 +00:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
#
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
# MAINTAINER= mandree@FreeBSD.org
|
|
|
|
# beat@ has implicit approval to change this script.
|
2012-07-15 22:09:45 +00:00
|
|
|
#
|
|
|
|
|
2012-07-18 19:52:33 +00:00
|
|
|
#
|
|
|
|
# The psvn wrapper checkes from replaced, conflicting, missing or
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
# untracked files. When committing it adds the needed Subversion
|
2012-07-18 19:52:33 +00:00
|
|
|
# properties and removes unneeded ones.
|
|
|
|
# There is also adds a check subcommand which just executes the
|
|
|
|
# checks.
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
#
|
2012-07-18 19:52:33 +00:00
|
|
|
|
2012-07-15 22:09:45 +00:00
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:${PATH}
|
|
|
|
export PATH
|
|
|
|
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
SVN="$(which svn)"
|
|
|
|
LF="$(printf '\nX')"
|
|
|
|
LF="${LF%X}"
|
2012-07-15 22:09:45 +00:00
|
|
|
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
VERSION=$("${SVN}" --version --quiet | sed -e 's,^\(.*\)\.\(.*\)\..*,\1\2,')
|
2012-07-15 22:09:45 +00:00
|
|
|
if [ ${VERSION} -lt 17 ] ;
|
|
|
|
then
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
echo "===> Please consider upgrading to Subversion 1.7 (or newer)"
|
2012-07-15 22:09:45 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
checkstatus () {
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
local IFS _error _file _status _statusline -
|
2012-07-15 22:09:45 +00:00
|
|
|
_error=0
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
eval "set -- $@"
|
|
|
|
IFS="$LF"
|
|
|
|
set -- $("${SVN}" status -- "$@")
|
2012-07-15 22:09:45 +00:00
|
|
|
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
for _statusline
|
2012-07-15 22:09:45 +00:00
|
|
|
do
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
_status="$(printf '%.7s' "${_statusline}")"
|
|
|
|
_file="${_statusline##????????}"
|
2012-07-15 22:09:45 +00:00
|
|
|
|
|
|
|
case "${_status}" in
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
R*)
|
2014-01-21 00:44:08 +00:00
|
|
|
printf >&2 '===> Do not replace files as this may lose history: "%s"\n' "${_file}"
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
_error=1
|
|
|
|
;;
|
|
|
|
C*|?C*)
|
|
|
|
printf >&2 '===> Conflict detected: \"%s\"\n' "${_file}"
|
2012-07-15 22:09:45 +00:00
|
|
|
_error=1
|
|
|
|
;;
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
\~*)
|
|
|
|
printf >&2 '===> Versioned item \"%s\" obstructed.\n' "${_file}"
|
2012-07-15 22:09:45 +00:00
|
|
|
_error=1
|
|
|
|
;;
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
\?*)
|
|
|
|
printf >&2 '===> Untracked new file "%s". Consider svn adding or deleting it.\n' "${_file}"
|
2012-07-15 22:09:45 +00:00
|
|
|
_error=1
|
|
|
|
;;
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
\!*)
|
|
|
|
printf >&2 '===> Missing file "%s". Consider re-adding or svn deleting it.\n' "${_file}"
|
2012-07-15 22:09:45 +00:00
|
|
|
_error=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ${_error} -ne 0 ] ;
|
|
|
|
then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
setprop () {
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
local _file -
|
|
|
|
eval "set -- $1"
|
2012-07-15 22:09:45 +00:00
|
|
|
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
for _file
|
2012-07-15 22:09:45 +00:00
|
|
|
do
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
if [ -d "${_file}" -o ! -e "${_file}" ] ;
|
2012-07-15 22:09:45 +00:00
|
|
|
then
|
|
|
|
continue
|
|
|
|
fi
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
printf >&2 '=> Adding svn keywords to "%s"\n' "${_file}"
|
|
|
|
case $(egrep -- '\$FreeBSD\$|\$[BDFSer]+:' "${_file}" >/dev/null || echo $?) in
|
|
|
|
"") # matched pattern
|
|
|
|
"${SVN}" -q -- propset svn:keywords "FreeBSD=%H" "${_file}"
|
|
|
|
"${SVN}" -q -- propdel fbsd:nokeywords "${_file}"
|
|
|
|
;;
|
|
|
|
1) # no match
|
2012-09-09 17:07:17 +00:00
|
|
|
"${SVN}" -q -- propset fbsd:nokeywords yes "${_file}"
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
"${SVN}" -q -- propdel svn:keywords "${_file}"
|
|
|
|
;;
|
|
|
|
*) # egrep failed
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
if [ "${_file##/*}" != "bsd.port.mk" ] ; then
|
|
|
|
"${SVN}" -q -- propset svn:eol-style native "${_file}"
|
2012-07-15 22:09:45 +00:00
|
|
|
fi
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
"${SVN}" -q -- propset svn:mime-type text/plain "${_file}"
|
|
|
|
"${SVN}" -q -- propdel cvs2svn:cvs-rev "${_file}"
|
2012-07-15 22:09:45 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
# taken from "Rich's sh (POSIX shell) tricks",
|
|
|
|
# a "Programming Guide[...]" at http://www.etalabs.net/sh_tricks.html
|
|
|
|
savearray() {
|
|
|
|
for i do
|
|
|
|
printf %s\\n "$i" | sed -e "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"
|
|
|
|
done
|
|
|
|
echo " "
|
|
|
|
}
|
|
|
|
|
|
|
|
getfilequotedarray() {
|
|
|
|
local varname IFS
|
|
|
|
varname="$1"
|
|
|
|
shift
|
|
|
|
IFS="$LF"
|
|
|
|
set -- $("${SVN}" status -- "$@" | sed 's/^....... //')
|
|
|
|
eval "$varname=\$(savearray "\$@")"
|
|
|
|
}
|
2012-07-15 22:09:45 +00:00
|
|
|
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
for opt ; do
|
|
|
|
case "${opt}" in
|
|
|
|
-*) continue ;;
|
|
|
|
esac
|
|
|
|
case "${opt}" in
|
2012-07-15 22:09:45 +00:00
|
|
|
check)
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
shift
|
|
|
|
if [ $# -gt 0 ] ; then
|
|
|
|
echo >&2 "===> Unsupported option before, or garbage after command"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
getfilequotedarray "files" "$@"
|
2012-07-15 22:09:45 +00:00
|
|
|
checkstatus "${files}"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
ci|commit)
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
savedargs=$(savearray "$@")
|
2012-07-15 22:09:45 +00:00
|
|
|
shift
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
while getopts :qm:F: opt
|
2012-07-15 22:09:45 +00:00
|
|
|
do
|
|
|
|
case "$opt" in
|
|
|
|
q) ;;
|
|
|
|
m) ;;
|
|
|
|
F) ;;
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
\?) echo >&2 "===> Unsupported option -$OPTARG encountered. Abort."
|
|
|
|
exit 1 ;;
|
|
|
|
:) echo >&2 "===> Missing argument to option -$OPTARG. Abort."
|
|
|
|
exit 1 ;;
|
2012-07-15 22:09:45 +00:00
|
|
|
esac
|
|
|
|
done
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
getfilequotedarray "files" "$@"
|
2012-07-18 19:52:33 +00:00
|
|
|
checkstatus "${files}"
|
|
|
|
setprop "${files}"
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
|
|
|
|
eval "set -- $savedargs"
|
2012-08-24 19:54:38 +00:00
|
|
|
exec "${SVN}" "$@"
|
2012-07-15 22:09:45 +00:00
|
|
|
;;
|
|
|
|
*)
|
2012-08-24 19:54:38 +00:00
|
|
|
exec "${SVN}" "$@"
|
2012-07-15 22:09:45 +00:00
|
|
|
;;
|
Changes over original script:
- FIX: all progress and error output goes to fd#2 (stderr)
- FIX: at top level, properly detect commands if preceded by options
- FIX: in checkstatus(), handle ~ (obstructed versioned item)
- FIX: support blanks, leading dashes, and shell meta characters:
+ in file names, so as not to choke the script on difficult file names
+ in command line arguments, so that svn commit -m "commit message" works,
rather than complaining about an unversioned file "message".
- FIX: in checkstatus(), keep leading spaces from svn status
- FIX: in setprop(), detect egrep errors, rather than assuming "no match"
- ADD: die if "check" psvn-specific command has trailing arguments
- CHANGE: replace `...` by more concise $(...) notation
- CHANGE: take maintainership, offered by beat@.
- SPEEDUP: in checkstatus(), use shell built-ins, rather than commands
- SPEEDUP: when checking files, run svn only once, rather than for each file
- SPEEDUP: when skipping "svn rm"-ed files, use ! -e rather than head|awk
- TODO: handle long options for svn commit
- TODO: do not stomp over svn:mime-type if it's already set (binary files!)
Approved by: beat@ (maintainer)
2012-08-20 20:42:24 +00:00
|
|
|
esac
|
|
|
|
done
|