Replace SC_VCS=git-svn with SC_WANT_CHANGELOG.
Now ChangeLog creation is controlled directly by a dedicated variable. It is disabled by default, and enabled implicitly with cvs, svn and git-svn. It can be enabled explicitly via `-c' too. SC_VCS no longer will contain git-svn -- it will be simply git. That simplifies a lot of checks in the code.
This commit is contained in:
parent
de3ab6ece9
commit
09661479e0
@ -35,9 +35,9 @@ repository (due to limitations of non-distributed VCSes).
|
||||
|
||||
.IP "\fB-c\fP, \fB--changelog\fP"
|
||||
|
||||
Ignored (provided for backwards compatibility). ChangeLog entries are
|
||||
now created as needed. Use \fB--trivial\fP to suppress creation of
|
||||
ChangeLog entries.
|
||||
Force creating a ChangeLog even if DVCS is used. Otherwise, ChangeLog
|
||||
entries will be created if needed. Use \fB--trivial\fP to suppress
|
||||
creation of ChangeLog entries.
|
||||
|
||||
Because of the nature of DVCSes, a ChangeLog will not be created for a
|
||||
new ebuild in a GIT or Mercurial repository. However, if the ebuild
|
||||
|
@ -52,6 +52,8 @@ local_supported || eval 'local() {
|
||||
|
||||
# See if we're in a repo, and what VCS are we using.
|
||||
find_repo() {
|
||||
: ${SC_WANT_CHANGELOG=}
|
||||
|
||||
if svn info >/dev/null 2>&1; then
|
||||
SC_VCS=svn
|
||||
elif hg tip >/dev/null 2>&1; then
|
||||
@ -65,10 +67,9 @@ find_repo() {
|
||||
|
||||
if [ ${ret} -ne 127 ] && [ ${ret} -ne 128 ]; then
|
||||
if echo "${remotes}" | grep git-svn >/dev/null 2>&1; then
|
||||
SC_VCS=git-svn
|
||||
else
|
||||
SC_VCS=git
|
||||
SC_WANT_CHANGELOG=1
|
||||
fi
|
||||
SC_VCS=git-svn
|
||||
else
|
||||
die 'Unable to find any familiar repository type (are you inside the repo?).'
|
||||
fi
|
||||
@ -82,7 +83,7 @@ find_repo() {
|
||||
is_whole_dir_removed() {
|
||||
if [ ${SC_VCS} = svn ]; then
|
||||
[ "$(svn status --depth=empty -- "${1}" | wc -l)" = 1 ]
|
||||
elif [ ${SC_VCS%-svn} = git ]; then
|
||||
elif [ ${SC_VCS} = git ]; then
|
||||
[ -z "$(git ls-files -c -- "${1}")" ]
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
[ -z "$(hg status -madc "${1}")" ]
|
||||
@ -96,7 +97,7 @@ is_package_removal() {
|
||||
local fields list
|
||||
[ -d profiles ] && fields=1-2 || fields=1
|
||||
|
||||
if [ ${SC_VCS%-svn} = git ]; then
|
||||
if [ ${SC_VCS} = git ]; then
|
||||
list=$(git diff-index --relative --name-only --diff-filter=D HEAD)
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
list=$(hg status -nr .)
|
||||
@ -189,7 +190,7 @@ find_ebuilds() {
|
||||
check_for_changes() {
|
||||
local output
|
||||
|
||||
if [ ${SC_VCS%-svn} = git ]; then
|
||||
if [ ${SC_VCS} = git ]; then
|
||||
output=$(git diff-index --name-only --relative HEAD -- "${@}")
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
output=$(hg status -- ${1-.} "${@}")
|
||||
@ -207,7 +208,7 @@ check_for_changes() {
|
||||
|
||||
# Discard any changes to a particular set of files.
|
||||
vcs_reset() {
|
||||
if [ ${SC_VCS%-svn} = git ]; then
|
||||
if [ ${SC_VCS} = git ]; then
|
||||
git checkout HEAD -- "${@}" 2>/dev/null || req rm -f -- "${@}"
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
[ -n "$(hg status -au "${@}")" ] && req rm -f -- "${@}"
|
||||
@ -225,7 +226,7 @@ vcs_reset() {
|
||||
|
||||
# Request VCS to provide a verbose status report.
|
||||
vcs_status() {
|
||||
if [ ${SC_VCS%-svn} = git ]; then
|
||||
if [ ${SC_VCS} = git ]; then
|
||||
git status -s -- ${1-.} "${@}"
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
hg status -- ${1-.} "${@}"
|
||||
@ -238,7 +239,7 @@ vcs_status() {
|
||||
|
||||
# Add particular files to the repository.
|
||||
vcs_add() {
|
||||
${SC_VCS%-svn} add -- "${@}"
|
||||
${SC_VCS} add -- "${@}"
|
||||
}
|
||||
|
||||
# Commit the specified objects using the commit message provided
|
||||
@ -248,7 +249,7 @@ vcs_commit() {
|
||||
msg=${1}
|
||||
shift
|
||||
|
||||
if [ ${SC_VCS%-svn} = git ]; then
|
||||
if [ ${SC_VCS} = git ]; then
|
||||
exec git commit -m "${msg}" ${1+-o} -- "${@}"
|
||||
elif [ ${SC_VCS} = hg ]; then
|
||||
exec hg commit -m "${msg}" -- ${1-.} "${@}"
|
||||
@ -332,7 +333,7 @@ main() {
|
||||
;;
|
||||
|
||||
-c|--changelog)
|
||||
# Now changelog entries are implicit -- backwards compat.
|
||||
SC_WANT_CHANGELOG=1
|
||||
;;
|
||||
-C|--nocolor)
|
||||
monochrome=1
|
||||
@ -408,7 +409,7 @@ main() {
|
||||
|
||||
# With DVCS repos, we do not do ChangeLogs by default...
|
||||
# ...at least unless they're already there.
|
||||
if [ ${SC_VCS#git-} = svn ] || [ ${SC_VCS} = cvs ] || [ -f ChangeLog ]; then
|
||||
if [ -n "${SC_WANT_CHANGELOG}" ] || [ -f ChangeLog ]; then
|
||||
sayv 'Cleaning up the ChangeLog...'
|
||||
vcs_reset ChangeLog
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user