mirror of
https://github.com/StackExchange/blackbox.git
synced 2025-12-16 03:23:00 +02:00
inital checkin of svn support
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -5,6 +5,9 @@ __pycache__/
|
|||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
|
||||||
|
# backup shell files
|
||||||
|
*~
|
||||||
|
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python
|
.Python
|
||||||
env/
|
env/
|
||||||
|
|||||||
@@ -14,10 +14,13 @@
|
|||||||
|
|
||||||
# Outputs a string that is the base directory of this VCS repo.
|
# Outputs a string that is the base directory of this VCS repo.
|
||||||
# By side-effect, sets the variable VCS_TYPE to either 'git', 'hg',
|
# By side-effect, sets the variable VCS_TYPE to either 'git', 'hg',
|
||||||
# or 'unknown'.
|
# 'svn' or 'unknown'.
|
||||||
function _determine_vcs_base_and_type() {
|
function _determine_vcs_base_and_type() {
|
||||||
if git rev-parse --show-toplevel 2>/dev/null ; then
|
if git rev-parse --show-toplevel 2>/dev/null ; then
|
||||||
VCS_TYPE=git
|
VCS_TYPE=git
|
||||||
|
elif [ -d ".svn" ] ; then
|
||||||
|
echo `pwd`
|
||||||
|
VCS_TYPE=svn
|
||||||
elif hg root 2>/dev/null ; then
|
elif hg root 2>/dev/null ; then
|
||||||
# NOTE: hg has to be tested last because it always "succeeds".
|
# NOTE: hg has to be tested last because it always "succeeds".
|
||||||
VCS_TYPE=hg
|
VCS_TYPE=hg
|
||||||
@@ -69,7 +72,7 @@ function fail_if_not_exists() {
|
|||||||
function fail_if_not_in_repo() {
|
function fail_if_not_in_repo() {
|
||||||
_determine_vcs_base_and_type
|
_determine_vcs_base_and_type
|
||||||
if [[ $VCS_TYPE = "unknown" ]]; then
|
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...
|
echo Exiting...
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -302,6 +305,17 @@ function is_in_git() {
|
|||||||
echo false
|
echo false
|
||||||
fi
|
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).
|
# Add a file to the repo (but don't commit it).
|
||||||
@@ -316,6 +330,10 @@ function vcs_add_hg() {
|
|||||||
function vcs_add_git() {
|
function vcs_add_git() {
|
||||||
git add """$@"""
|
git add """$@"""
|
||||||
}
|
}
|
||||||
|
# Subversion
|
||||||
|
function vcs_add_svn() {
|
||||||
|
svn add --parents """$@"""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Commit a file to the repo
|
# Commit a file to the repo
|
||||||
@@ -330,6 +348,11 @@ function vcs_commit_hg() {
|
|||||||
function vcs_commit_git() {
|
function vcs_commit_git() {
|
||||||
git commit -m"""$@"""
|
git commit -m"""$@"""
|
||||||
}
|
}
|
||||||
|
# Subversion
|
||||||
|
function vcs_commit_svn() {
|
||||||
|
svn commit -m"""$@"""
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Remove file from repo, even if it was deleted locally already.
|
# Remove file from repo, even if it was deleted locally already.
|
||||||
@@ -345,3 +368,7 @@ function vcs_remove_hg() {
|
|||||||
function vcs_remove_git() {
|
function vcs_remove_git() {
|
||||||
git rm --ignore-unmatch -f -- """$@"""
|
git rm --ignore-unmatch -f -- """$@"""
|
||||||
}
|
}
|
||||||
|
# Subversion
|
||||||
|
function vcs_remove_svn() {
|
||||||
|
svn delete """$@"""
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,14 +24,24 @@ fi
|
|||||||
echo cd "$REPOBASE"
|
echo cd "$REPOBASE"
|
||||||
cd "$REPOBASE"
|
cd "$REPOBASE"
|
||||||
|
|
||||||
# Update .gitignore or .hgignore
|
echo VCS_TYPE: $VCS_TYPE
|
||||||
|
|
||||||
IGNOREFILE=".${VCS_TYPE}ignore"
|
if [[ $VCS_TYPE = "git" || $VCS_TYPE = "hg" ]]; then
|
||||||
if ! grep -sx >/dev/null 'pubring.gpg~' "$IGNOREFILE" ; then
|
# Update .gitignore or .hgignore
|
||||||
echo 'pubring.gpg~' >>"$IGNOREFILE"
|
|
||||||
fi
|
IGNOREFILE=".${VCS_TYPE}ignore"
|
||||||
if ! grep -sx >/dev/null 'secring.gpg' "$IGNOREFILE" ; then
|
if ! grep -sx >/dev/null 'pubring.gpg~' "$IGNOREFILE" ; then
|
||||||
echo 'secring.gpg' >>"$IGNOREFILE"
|
echo 'pubring.gpg~' >>"$IGNOREFILE"
|
||||||
|
fi
|
||||||
|
if ! grep -sx >/dev/null 'secring.gpg' "$IGNOREFILE" ; then
|
||||||
|
echo 'secring.gpg' >>"$IGNOREFILE"
|
||||||
|
fi
|
||||||
|
elif [[ $VCS_TYPE = "svn" ]]; then
|
||||||
|
# add file to svn ignore propset
|
||||||
|
IGNOREFILE="";
|
||||||
|
svn propset svn:ignore 'pubring.gpg~
|
||||||
|
secring.gpg' .
|
||||||
|
svn commit -m "ignore file list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make directories
|
# Make directories
|
||||||
|
|||||||
Reference in New Issue
Block a user