Browse Source

Update git and svn functions

master
mid-kid 8 years ago
parent
commit
27be085dfe
  1. 15
      satellites/functions/vcs/git.sh
  2. 14
      satellites/functions/vcs/svn.sh

15
satellites/functions/vcs/git.sh

@ -1,14 +1,21 @@
vcs_git() {
local url="$1"; shift
local branch="$1"
local branch=''
local reponame="$(basename "$url")"
local OPTIND=1
local opt
while getopts 'b:' opt; do case "$opt" in
b) local branch="$OPTARG" ;;
esac; done
shift $((OPTIND-1))
[ "$1" = '--' ] && shift
local reponame="$(basename "$1")"
local dir="$dir_source/$name/$reponame"
mkdir -p "$dir"
if [ ! -d "$dir/.git" ]; then
# Clone new repo
git clone --recursive --depth=1 $([ "$branch" ] && echo "-b $branch") "$url" "$dir"
git clone --recursive --depth=1 $([ "$branch" ] && echo "-b $branch") "$1" "$dir"
cd "$dir"
echo "$(git rev-parse @)" > "${dir}_rev_$_satname"
vcs_compile=true

14
satellites/functions/vcs/svn.sh

@ -1,9 +1,17 @@
vcs_svn() {
local revision=''
local OPTIND=1
local opt
while getopts 'r:' opt; do case "$opt" in
r) local revision="-r $OPTARG" ;;
esac; done
shift $((OPTIND-1))
[ "$1" = '--' ] && shift
local reponame="$(basename "$1")"
local dir="$dir_source/$name/$reponame"
[ "$2" ] && local revision="-r $2" || local revision=""
if [ ! -d "$dir" ]; then
# Clone new repo
svn co $revision "$1" "$dir"
@ -18,6 +26,6 @@ vcs_svn() {
fi
fi
[ "$2" ] || version="r$(svn info "$dir" --show-item revision | xargs)"
[ "$branch" ] || version="r$(svn info "$dir" --show-item revision | xargs)"
getfile "$reponame"
}

Loading…
Cancel
Save