Skip to content

Commit

Permalink
Item2543: adding checkout_extensions script
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@5899 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
AntonioTerceiro authored and AntonioTerceiro committed Dec 30, 2009
1 parent 7f4500f commit 17cc7ed
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions core/tools/checkout_extensions
@@ -0,0 +1,70 @@
#!/bin/sh

core_extensions() {
cut -d ' ' -f 2 lib/MANIFEST | sed -e 's#lib/Foswiki.*##' | xargs -n 1 basename | grep -v core
}

usage(){
echo "usage: $0 [OPTIONS] [Extension [Extension ...]]"
echo
echo "Options:"
echo
echo " --git checks out the extensions using git instead of svn"
echo " --git-rev REV When checking out with git, start history at revision REV"
echo " --core checks out all the core extensions"
echo " --help displays usage information"
echo
}

checkout_cmd="svn checkout"
extensions=""

while test $# -gt 0; do
case $1 in
--git)
checkout_cmd="git svn clone"
;;
--git-rev)
shift
rev="$1"
if [ "$checkout_cmd" = "git svn clone" ]; then
checkout_cmd="$checkout_cmd -r $rev"
fi
;;
--core)
extensions="$extensions $(core_extensions)"
;;
--developer)
extensions="$extensions BuildContrib TestFixturePlugin UnitTestContrib"
;;
--help)
usage
exit 0
;;
-*)
echo "Invalid option: $1"
usage
exit 1
;;
*)
extensions="$extensions $1"
;;
esac
shift
done

if [ -z "$extensions" ]; then
echo "You must specify at least one extension to checkout."
echo "Try the --core option to checkout all core extensions"
exit 2
fi

for ext in $extensions; do
echo "Checking out $ext"
if [ -d "../$ext" ]; then
echo "W: ../$ext already exists, it seems you already checked it out (not processed)"
else
svnroot=$(svn info $0 | grep URL: | sed -e 's#URL: \(.*\)/core/tools/checkout_extensions#\1#')
(cd .. && $checkout_cmd "$svnroot/$ext")
fi
done

0 comments on commit 17cc7ed

Please sign in to comment.