Native subversion support.

This commit is contained in:
Michał Górny 2010-07-12 14:59:56 +02:00
parent 364ade7b73
commit b2d4d1df00

View File

@ -52,22 +52,30 @@ find_repo() {
fi
fi
if [ ${SC_VCS} = svn ]; then
die 'Native subversion repositories are not supported at the moment.'
fi
sayv "Ok, we're in ${SC_VCS} working tree. Let's see what I can do around here..."
}
is_whole_dir_removed() {
if [ ${SC_VCS} = svn ]; then
local flist
flist=$(find "${1}" \( -name '.svn' -prune -o ! -name "${1}" -print \))
[ -z "${flist}" ]
elif [ ${SC_VCS%-svn} = git ]; then
[ ! -e "${1}" ]
fi
}
# Check whether we're having a clean package removal.
is_package_removal() {
local fields list
[ -d profiles ] && fields=1-2 || fields=1
if [ ${SC_VCS%-svn} = git ]; then
list=$(git diff-index --relative --name-only --diff-filter=D HEAD \
| cut -d / -f ${fields} | sort | uniq)
list=$(git diff-index --relative --name-only --diff-filter=D HEAD)
elif [ ${SC_VCS} = svn ]; then
list=$(svn status -q | sed -n -e 's/^D //p')
fi
list=$(echo "${list}" | cut -d / -f ${fields} | sort | uniq)
# 1) We have to have any removes.
[ -z "${list}" ] && return 1
@ -76,7 +84,7 @@ is_package_removal() {
local dir olist
for dir in ${list}; do
# 2) These removes have to remove whole directories.
[ -e ${dir} ] || olist=${olist+${olist} }${dir}
is_whole_dir_removed ${dir} && olist=${olist+${olist} }${dir}
done
[ -z "${olist}" ] && return 1
@ -141,6 +149,8 @@ check_for_changes() {
if [ ${SC_VCS%-svn} = git ]; then
output=$(git diff-index --name-only --relative HEAD "$@")
elif [ ${SC_VCS} = svn ]; then
output=$(svn status "$@")
fi
[ -z "${output}" ] && return 1
@ -152,12 +162,17 @@ vcs_reset() {
if [ ${SC_VCS%-svn} = git ]; then
req git reset -q HEAD "${1}"
git checkout -f "${1}" 2>/dev/null || req rm -f ChangeLog
elif [ ${SC_VCS} = svn ]; then
req rm -f ChangeLog
svn up ChangeLog >/dev/null 2>&1
fi
}
vcs_status() {
if [ ${SC_VCS%-svn} = git ]; then
git status -s ${1-.} "${@}"
elif [ ${SC_VCS} = svn ]; then
svn status "${@}"
fi
}
@ -172,6 +187,8 @@ vcs_commit() {
if [ ${SC_VCS%-svn} = git ]; then
exec git commit -m "${msg}" ${1+-o} "${@}"
elif [ ${SC_VCS} = svn ]; then
exec svn commit -m "${msg}" "${@}"
fi
}
@ -311,7 +328,7 @@ main() {
if [ -z "${trivial}" ]; then
sayv '...and appending to it.'
req echangelog "${commitmsg}"
echangelog "${commitmsg}" || die 'Please correct the problems pointed by echangelog.'
echo
fi