summaryrefslogtreecommitdiff
path: root/localvcsactions
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2006-12-26 18:06:17 +0000
committerJonas Smedegaard <dr@jones.dk>2006-12-26 18:06:17 +0000
commit9b11ced4f6b04401afa960e9d7bc668823e8457e (patch)
tree2d3f8610f02d8af66358d5284c078d960143c75b /localvcsactions
parent661f3bbcffa943757aa3edceca0907df86cc71ca (diff)
Add support for GIT. Cumulate tar_excludes.
Diffstat (limited to 'localvcsactions')
-rwxr-xr-xlocalvcsactions61
1 files changed, 46 insertions, 15 deletions
diff --git a/localvcsactions b/localvcsactions
index 7352c3d..0708638 100755
--- a/localvcsactions
+++ b/localvcsactions
@@ -4,8 +4,6 @@ set -e
action=$(basename $0 .sh)
-tar_excludes="--exclude CVSROOT --exclude .cvsignore --exclude .svn --exclude .arch-ids --exclude {arch} --exclude .hg --exclude .hgignore --exclude .hgtags"
-
projects=${1:-$(find -mindepth 1 -maxdepth 1 -type d -printf '%f\n')}
for project in $projects; do
if [ -x $project/$action.sh ]; then
@@ -14,20 +12,12 @@ for project in $projects; do
else
targets=${2:-$(find $project -mindepth 1 -maxdepth 1 -type d -printf '%f\n')}
for target in $targets; do
+ versys=""
+ versysfile=""
repository=""
branch=""
- if [ -d "$project/$target/.hg" ]; then
- versys="Mercurial"
- versysfile="hg"
- repository="$(cat $project/$target/.hg/hgrc | perl -n -e '/^default\s+=\s+(\S+)/ && print "$1\n"')"
- elif [ -d "$project/$target/{arch}" ]; then
- versys="ARCH"
- versysfile="arch"
- repository="$(cat $project/$target/{arch}/++default-version)"
- elif [ -d "$project/$target/.svn" ]; then
- versys="SVN"
- versysfile="svn"
- elif [ -d "$project/$target/CVS" ]; then
+ tar_excludes=""
+ if [ -d "$project/$target/CVS" ]; then
versys="CVS"
versysfile="cvs"
repository="$(cat $project/$target/CVS/Repository)"
@@ -35,7 +25,36 @@ for project in $projects; do
if [ -f $project/$target/CVS/Tag ]; then
branch="$(egrep '^N' $project/$target/CVS/Tag | sed 's/^N//')"
fi
- else
+ tar_excludes="$tar_excludes --exclude CVSROOT --exclude .cvsignore"
+ fi
+ if [ -d "$project/$target/.svn" ]; then
+ versys="SVN"
+ versysfile="svn"
+ repository=""
+ branch=""
+ tar_excludes="$tar_excludes --exclude .svn"
+ fi
+ if [ -d "$project/$target/{arch}" ]; then
+ versys="ARCH"
+ versysfile="arch"
+ repository="$(cat $project/$target/{arch}/++default-version)"
+ branch=""
+ tar_excludes="$tar_excludes --exclude .arch-ids --exclude {arch}"
+ fi
+ if [ -d "$project/$target/.hg" ]; then
+ versys="Mercurial"
+ versysfile="hg"
+ repository="$(cat $project/$target/.hg/hgrc | perl -n -e '/^default\s+=\s+(\S+)/ && print "$1\n"')"
+ branch=""
+ tar_excludes="$tar_excludes --exclude .hg --exclude .hgignore --exclude .hgtags"
+ fi
+ if [ -d "$project/$target/.git" ]; then
+ versys="GIT"
+ versysfile="git"
+ repository="$(cat $project/$target/.git/description | perl -n -e '/^Unnamed/ or print "$_\n"')"
+ branch=""
+ fi
+ if [ -z "$versys" ] || [ -z "$versysfile" ]; then
echo "ERROR: Unknown version control system used for \"$project/$target\"."
exit 1
fi
@@ -56,6 +75,9 @@ for project in $projects; do
Mercurial)
( cd $project/$target && hg pull -u )
;;
+ GIT)
+ ( cd $project/$target && git pull )
+ ;;
*)
echo "ERROR: Action \"$action\" not supported for \"$project/$target\"."
exit 1
@@ -69,6 +91,11 @@ for project in $projects; do
( cd $project && tar chf - --exclude CVS $tar_excludes $target ) \
| gzip -f9 > $project/$target-$versysfile$(date '+%Y%m%d').tar.gz
;;
+ GIT)
+ # FIXME: use tar_exclude to suppress other dirt than git itself
+ ( cd $project/$target && git archive --format=tar --prefix="$target/" HEAD^{tree} ) \
+ | gzip -f9 > $project/$target-$versysfile$(date '+%Y%m%d').tar.gz
+ ;;
*)
echo "ERROR: Action \"$action\" not supported for \"$project/$target\"."
exit 1
@@ -96,6 +123,10 @@ for project in $projects; do
( cd $project/$target && test -f ../$target.ChangeLog && mv -f ../$target.ChangeLog ../$target.ChangeLog.bak )
( cd $project/$target && hg log -v > ../$target.ChangeLog )
;;
+ GIT)
+ ( cd $project/$target && test -f ../$target.ChangeLog && mv -f ../$target.ChangeLog ../$target.ChangeLog.bak )
+ ( cd $project/$target && git log > ../$target.ChangeLog )
+ ;;
*)
echo "ERROR: Action \"$action\" not supported for \"$project/$target\"."
exit 1