Support CVS. I actually tested the package adding, updating, bumping, and removal operations this time ;-).

This commit is contained in:
Nathan Phillip Brink 2010-10-27 16:22:46 -04:00
parent 176fcaecef
commit 3a3818cab3
2 changed files with 28 additions and 9 deletions

View File

@ -56,6 +56,8 @@ find_repo() {
SC_VCS=svn SC_VCS=svn
elif hg tip >/dev/null 2>&1; then elif hg tip >/dev/null 2>&1; then
SC_VCS=hg SC_VCS=hg
elif cvs status -l >/dev/null 2>&1; then
SC_VCS=cvs
else else
local remotes local remotes
remotes=$(git branch -r 2>/dev/null) remotes=$(git branch -r 2>/dev/null)
@ -83,6 +85,8 @@ is_whole_dir_removed() {
[ -z "$(git ls-files -c -- "${1}")" ] [ -z "$(git ls-files -c -- "${1}")" ]
elif [ ${SC_VCS} = hg ]; then elif [ ${SC_VCS} = hg ]; then
[ -z "$(hg status -madc "${1}")" ] [ -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 fi
} }
@ -95,6 +99,8 @@ is_package_removal() {
list=$(git diff-index --relative --name-only --diff-filter=D HEAD) list=$(git diff-index --relative --name-only --diff-filter=D HEAD)
elif [ ${SC_VCS} = hg ]; then elif [ ${SC_VCS} = hg ]; then
list=$(hg status -nr .) 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 elif [ ${SC_VCS} = svn ]; then
list=$(svn status -q | sed -n -e 's/^D //p') list=$(svn status -q | sed -n -e 's/^D //p')
fi fi
@ -188,6 +194,9 @@ check_for_changes() {
output=$(hg status -- ${1-.} "${@}") output=$(hg status -- ${1-.} "${@}")
elif [ ${SC_VCS} = svn ]; then elif [ ${SC_VCS} = svn ]; then
output=$(svn status -- "${@}") 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 fi
[ -z "${output}" ] && return 1 [ -z "${output}" ] && return 1
@ -205,6 +214,11 @@ vcs_reset() {
elif [ ${SC_VCS} = svn ]; then elif [ ${SC_VCS} = svn ]; then
req rm -f -- "${@}" req rm -f -- "${@}"
svn revert -- "${@}" >/dev/null 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 fi
} }
@ -216,6 +230,8 @@ vcs_status() {
hg status -- ${1-.} "${@}" hg status -- ${1-.} "${@}"
elif [ ${SC_VCS} = svn ]; then elif [ ${SC_VCS} = svn ]; then
svn status -- "${@}" svn status -- "${@}"
elif [ ${SC_VCS} = cvs ]; then
cvs -n -q up -- "${@}" 2>/dev/null | grep -v -e '^U'
fi fi
} }
@ -237,6 +253,8 @@ vcs_commit() {
exec hg commit -m "${msg}" -- ${1-.} "${@}" exec hg commit -m "${msg}" -- ${1-.} "${@}"
elif [ ${SC_VCS} = svn ]; then elif [ ${SC_VCS} = svn ]; then
exec svn commit -m "${msg}" -- "${@}" exec svn commit -m "${msg}" -- "${@}"
elif [ ${SC_VCS} = cvs ]; then
exec cvs commit -m "${msg}" -- "${@}"
fi fi
} }
@ -244,8 +262,8 @@ vcs_commit() {
vcs_update() { vcs_update() {
# Unlike svn, DVCSes don't push the changes to their origins immediately. # Unlike svn, DVCSes don't push the changes to their origins immediately.
# That's why we don't force update to it right here. # That's why we don't force update to it right here.
if [ ${SC_VCS} = svn ]; then if [ ${SC_VCS} = svn -o ${SC_VCS} = cvs ]; then
svn up -- "${@}" || say 'Warning: svn up failed, trying to proceed anyway.' ${SC_VCS} up -- "${@}" || say "Warning: ${SC_VCS} up failed, trying to proceed anyway."
fi fi
} }
@ -381,7 +399,7 @@ main() {
# With DVCS repos, we do not do ChangeLogs by default... # With DVCS repos, we do not do ChangeLogs by default...
# ...at least unless they're already there. # ...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...' sayv 'Cleaning up the ChangeLog...'
vcs_reset ChangeLog vcs_reset ChangeLog

View File

@ -23,13 +23,13 @@ performing the actual commit, it performs the following tasks:
\- prepends the commit message with package name(s). \- prepends the commit message with package name(s).
The script supports GIT, Mercurial, and Subversion repositories. For The script supports CVS, GIT, Mercurial, and Subversion repositories.
the latter, it supports native checkouts as well as git-svn. For the latter, it supports native checkouts as well as git-svn.
Please note that when used with DVCSes, this script only performs the Please note that when used with DVCSes, this script only performs the
actual commit. (It does not push or dcommit it to the repository). actual commit. (It does not push or dcommit it to the repository).
However, native Subversion commits are sent directly to the remote However, native Subversion and CVS commits are sent directly to the remote
repository (due to limitations of Subversion). repository (due to limitations of non-distributed VCSes).
.SH OPTIONS .SH OPTIONS
@ -55,8 +55,8 @@ sequences).
.IP "\fB-d\fP, \fB--noupdate\fP" .IP "\fB-d\fP, \fB--noupdate\fP"
Do not update and rebase the repository before proceeding with the Do not update and rebase the repository before proceeding with the
commit. This option only applies to Subversion repositories. It makes commit. This option only applies to Subversion and CVS repositories.
no sense to automatically pull from remote DVCS repositories. It makes no sense to automatically pull from remote DVCS repositories.
.IP "\fB-f\fP, \fB--force\fP" .IP "\fB-f\fP, \fB--force\fP"
@ -162,6 +162,7 @@ Michal Gorny <gentoo@mgorny.alt.pl>
.BR ebuild (5), .BR ebuild (5),
.BR echangelog (1), .BR echangelog (1),
.BR cvs (1),
.BR git (1), .BR git (1),
.BR hg (1), .BR hg (1),
.BR repoman (1), .BR repoman (1),