inital checkin of svn support

This commit is contained in:
bendra
2014-10-15 11:01:52 -07:00
parent 6ed02298f0
commit 0c3886df65
3 changed files with 49 additions and 9 deletions

View File

@@ -14,10 +14,13 @@
# Outputs a string that is the base directory of this VCS repo.
# By side-effect, sets the variable VCS_TYPE to either 'git', 'hg',
# or 'unknown'.
# 'svn' or 'unknown'.
function _determine_vcs_base_and_type() {
if git rev-parse --show-toplevel 2>/dev/null ; then
VCS_TYPE=git
elif [ -d ".svn" ] ; then
echo `pwd`
VCS_TYPE=svn
elif hg root 2>/dev/null ; then
# NOTE: hg has to be tested last because it always "succeeds".
VCS_TYPE=hg
@@ -69,7 +72,7 @@ function fail_if_not_exists() {
function fail_if_not_in_repo() {
_determine_vcs_base_and_type
if [[ $VCS_TYPE = "unknown" ]]; then
echo "ERROR: This must be run in a VCS repo such as git or hg."
echo "ERROR: This must be run in a VCS repo: git, hg, or svn."
echo Exiting...
exit 1
fi
@@ -302,6 +305,17 @@ function is_in_git() {
echo false
fi
}
# Subversion
function is_in_svn() {
local filename
filename="$1"
if svn list "$filename" ; then
echo true
else
echo false
fi
}
# Add a file to the repo (but don't commit it).
@@ -316,6 +330,10 @@ function vcs_add_hg() {
function vcs_add_git() {
git add """$@"""
}
# Subversion
function vcs_add_svn() {
svn add --parents """$@"""
}
# Commit a file to the repo
@@ -330,6 +348,11 @@ function vcs_commit_hg() {
function vcs_commit_git() {
git commit -m"""$@"""
}
# Subversion
function vcs_commit_svn() {
svn commit -m"""$@"""
}
# Remove file from repo, even if it was deleted locally already.
@@ -345,3 +368,7 @@ function vcs_remove_hg() {
function vcs_remove_git() {
git rm --ignore-unmatch -f -- """$@"""
}
# Subversion
function vcs_remove_svn() {
svn delete """$@"""
}