Support CVS. I actually tested the package adding, updating, bumping, and removal operations this time ;-).
This commit is contained in:
@@ -56,6 +56,8 @@ find_repo() {
|
||||
SC_VCS=svn
|
||||
elif hg tip >/dev/null 2>&1; then
|
||||
SC_VCS=hg
|
||||
elif cvs status -l >/dev/null 2>&1; then
|
||||
SC_VCS=cvs
|
||||
else
|
||||
local remotes
|
||||
remotes=$(git branch -r 2>/dev/null)
|
||||
@@ -83,6 +85,8 @@ is_whole_dir_removed() {
|
||||
[ -z "$(git ls-files -c -- "${1}")" ]
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
[ -z "$(hg status -madc "${1}")" ]
|
||||
elif [ ${SC_VCS} = cvs ]; then
|
||||
[ -z "$(cvs -Q status -R "${1}" 2>/dev/null | grep -e '^File:' | grep -v -e 'Status: Locally Removed$')" ]
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -95,6 +99,8 @@ is_package_removal() {
|
||||
list=$(git diff-index --relative --name-only --diff-filter=D HEAD)
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
list=$(hg status -nr .)
|
||||
elif [ ${SC_VCS} = cvs ]; then
|
||||
list=$(cvs -n -q up 2>/dev/null | sed -n -e 's/^R//p')
|
||||
elif [ ${SC_VCS} = svn ]; then
|
||||
list=$(svn status -q | sed -n -e 's/^D //p')
|
||||
fi
|
||||
@@ -188,6 +194,9 @@ check_for_changes() {
|
||||
output=$(hg status -- ${1-.} "${@}")
|
||||
elif [ ${SC_VCS} = svn ]; then
|
||||
output=$(svn status -- "${@}")
|
||||
elif [ ${SC_VCS} = cvs ]; then
|
||||
# `U' indicates a remote, incomming update.
|
||||
output=$(cvs -n -q update -R -- "${@}" 2>/dev/null | grep -v -e '^U')
|
||||
fi
|
||||
|
||||
[ -z "${output}" ] && return 1
|
||||
@@ -205,6 +214,11 @@ vcs_reset() {
|
||||
elif [ ${SC_VCS} = svn ]; then
|
||||
req rm -f -- "${@}"
|
||||
svn revert -- "${@}" >/dev/null
|
||||
elif [ ${SC_VCS} = cvs ]; then
|
||||
# cvs update -C does exist, but it sometimes doesn't
|
||||
# work.
|
||||
req rm -f -- "${@}"
|
||||
cvs update -- "${@}" >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -216,6 +230,8 @@ vcs_status() {
|
||||
hg status -- ${1-.} "${@}"
|
||||
elif [ ${SC_VCS} = svn ]; then
|
||||
svn status -- "${@}"
|
||||
elif [ ${SC_VCS} = cvs ]; then
|
||||
cvs -n -q up -- "${@}" 2>/dev/null | grep -v -e '^U'
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -237,6 +253,8 @@ vcs_commit() {
|
||||
exec hg commit -m "${msg}" -- ${1-.} "${@}"
|
||||
elif [ ${SC_VCS} = svn ]; then
|
||||
exec svn commit -m "${msg}" -- "${@}"
|
||||
elif [ ${SC_VCS} = cvs ]; then
|
||||
exec cvs commit -m "${msg}" -- "${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -244,8 +262,8 @@ vcs_commit() {
|
||||
vcs_update() {
|
||||
# Unlike svn, DVCSes don't push the changes to their origins immediately.
|
||||
# That's why we don't force update to it right here.
|
||||
if [ ${SC_VCS} = svn ]; then
|
||||
svn up -- "${@}" || say 'Warning: svn up failed, trying to proceed anyway.'
|
||||
if [ ${SC_VCS} = svn -o ${SC_VCS} = cvs ]; then
|
||||
${SC_VCS} up -- "${@}" || say "Warning: ${SC_VCS} up failed, trying to proceed anyway."
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -381,7 +399,7 @@ main() {
|
||||
|
||||
# With DVCS repos, we do not do ChangeLogs by default...
|
||||
# ...at least unless they're already there.
|
||||
if [ ${SC_VCS#git-} = svn -o -f ChangeLog ]; then
|
||||
if [ ${SC_VCS#git-} = svn -o ${SC_VCS#git-} = cvs -o -f ChangeLog ]; then
|
||||
sayv 'Cleaning up the ChangeLog...'
|
||||
vcs_reset ChangeLog
|
||||
|
||||
|
||||
Reference in New Issue
Block a user