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