Mercurial support.
This commit is contained in:
parent
51e3d9cd78
commit
60a91f15d3
@ -46,6 +46,8 @@ find_repo() {
|
|||||||
|
|
||||||
if [ ${?} -eq 0 ]; then
|
if [ ${?} -eq 0 ]; then
|
||||||
SC_VCS=svn
|
SC_VCS=svn
|
||||||
|
elif hg tip 2>/dev/null; then
|
||||||
|
SC_VCS=hg
|
||||||
else
|
else
|
||||||
local remotes
|
local remotes
|
||||||
remotes=$(git branch -r 2>/dev/null)
|
remotes=$(git branch -r 2>/dev/null)
|
||||||
@ -72,6 +74,8 @@ is_whole_dir_removed() {
|
|||||||
[ -z "$(svn status --depth=empty -- "${1}")" ]
|
[ -z "$(svn status --depth=empty -- "${1}")" ]
|
||||||
elif [ ${SC_VCS%-svn} = git ]; then
|
elif [ ${SC_VCS%-svn} = git ]; then
|
||||||
[ -z "$(git ls-files -c -- "${1}")" ]
|
[ -z "$(git ls-files -c -- "${1}")" ]
|
||||||
|
elif [ ${SC_VCS} = hg ]; then
|
||||||
|
[ -z "$(hg status -madc "${1}")" ]
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,6 +86,8 @@ is_package_removal() {
|
|||||||
|
|
||||||
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)
|
||||||
|
elif [ ${SC_VCS} = hg ]; then
|
||||||
|
list=$(hg status -nr .)
|
||||||
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
|
||||||
@ -167,6 +173,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} = hg ]; then
|
||||||
|
output=$(hg status -- ${1-.} "${@}")
|
||||||
elif [ ${SC_VCS} = svn ]; then
|
elif [ ${SC_VCS} = svn ]; then
|
||||||
output=$(svn status -- "${@}")
|
output=$(svn status -- "${@}")
|
||||||
fi
|
fi
|
||||||
@ -180,6 +188,9 @@ check_for_changes() {
|
|||||||
vcs_reset() {
|
vcs_reset() {
|
||||||
if [ ${SC_VCS%-svn} = git ]; then
|
if [ ${SC_VCS%-svn} = git ]; then
|
||||||
git checkout HEAD -- "${@}" 2>/dev/null || req rm -f -- "${@}"
|
git checkout HEAD -- "${@}" 2>/dev/null || req rm -f -- "${@}"
|
||||||
|
elif [ ${SC_VCS} = hg ]; then
|
||||||
|
[ -n "$(hg status -au "${@}")" ] && req rm -f -- "${@}"
|
||||||
|
hg revert -- "${@}" 2>/dev/null
|
||||||
elif [ ${SC_VCS} = svn ]; then
|
elif [ ${SC_VCS} = svn ]; then
|
||||||
req rm -f -- "${@}"
|
req rm -f -- "${@}"
|
||||||
svn revert -- "${@}" >/dev/null
|
svn revert -- "${@}" >/dev/null
|
||||||
@ -190,6 +201,8 @@ vcs_reset() {
|
|||||||
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} = hg ]; then
|
||||||
|
hg status -- ${1-.} "${@}"
|
||||||
elif [ ${SC_VCS} = svn ]; then
|
elif [ ${SC_VCS} = svn ]; then
|
||||||
svn status -- "${@}"
|
svn status -- "${@}"
|
||||||
fi
|
fi
|
||||||
@ -209,6 +222,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} = hg ]; then
|
||||||
|
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}" -- "${@}"
|
||||||
fi
|
fi
|
||||||
@ -216,8 +231,8 @@ vcs_commit() {
|
|||||||
|
|
||||||
# Call VCS to update the working copy to HEAD revision.
|
# Call VCS to update the working copy to HEAD revision.
|
||||||
vcs_update() {
|
vcs_update() {
|
||||||
# Unlike svn, git doesn't push the changes to origin immediately,
|
# Unlike svn, DVCSes don't push the changes to their origins immediately.
|
||||||
# and 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 ]; then
|
||||||
svn up -- "${@}" || say 'Warning: svn up failed, trying to proceed anyway.'
|
svn up -- "${@}" || say 'Warning: svn up failed, trying to proceed anyway.'
|
||||||
fi
|
fi
|
||||||
@ -353,9 +368,9 @@ main() {
|
|||||||
ebuild-commit)
|
ebuild-commit)
|
||||||
check_for_changes || die 'No changes found to commit.'
|
check_for_changes || die 'No changes found to commit.'
|
||||||
|
|
||||||
# With native git 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 -o -f ChangeLog ]; then
|
if [ ${SC_VCS} != git -a ${SC_VCS} != hg -o -f ChangeLog ]; then
|
||||||
sayv 'Cleaning up the ChangeLog...'
|
sayv 'Cleaning up the ChangeLog...'
|
||||||
vcs_reset ChangeLog
|
vcs_reset ChangeLog
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user