Skip to content

Instantly share code, notes, and snippets.

@mgedmin
Created June 7, 2012 11:48
Show Gist options
  • Save mgedmin/2888385 to your computer and use it in GitHub Desktop.
Save mgedmin/2888385 to your computer and use it in GitHub Desktop.
get-zope-project [-b branchname] [--git] zope.foo -> checks out from svn.zope.org
#!/bin/sh
# Check out one of Zope 3 subversion projects
USAGE="Usage: $0 [--git] [-b branchname] [-n|--dry-run] projectname [directory]"
BASEURL=svn+ssh://svn.zope.org/repos/main
project=
branch=trunk
dir=
git=0
dry_run=
while true; do
case "$1" in
-h|--help)
echo $USAGE
exit
;;
--git)
git=1
shift
;;
-b)
branch="$2"
shift 2
;;
-n|--dry-run)
dry_run=echo
shift
;;
-*)
echo "$0: unknown option $1" 1>&2
echo $USAGE 1>&2
exit 1
;;
"")
break
;;
*)
if [ -z "$project" ]; then
project="$1"
elif [ -z "$dir" ]; then
dir="$1"
else
echo $USAGE
exit 1
fi
shift
;;
esac
done
if [ -z "$project" ]; then
echo $USAGE
exit 1
fi
if [ -z "$dir" ]; then
if [ "$branch" = "trunk" ]; then
dir="$project"
else
dir="$project-$branch"
fi
fi
if [ "$branch" = "trunk" ]; then
svnurl="$BASEURL/$project/trunk"
else
svnurl="$BASEURL/$project/branches/$branch"
fi
if [ $git -eq 1 ]; then
$dry_run git svn clone $svnurl $dir
else
$dry_run svn co $svnurl $dir
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment