mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 20:13:32 +01:00
Which doesn't make a whole lot of sense on a stale project without an online counterpart. Removed the check without having a clear idea on what it had been there for in the first place. Signed-off-by: Jan Lindemann <jan@janware.com>
86 lines
1.9 KiB
Bash
86 lines
1.9 KiB
Bash
#!/bin/bash
|
|
|
|
log()
|
|
{
|
|
echo $@
|
|
}
|
|
|
|
fatal()
|
|
{
|
|
log $@
|
|
exit 1
|
|
}
|
|
|
|
goodbye()
|
|
{
|
|
rm -f $scm_status
|
|
}
|
|
|
|
check_scm()
|
|
{
|
|
local p=$1
|
|
if [ -d $p/.git ]; then
|
|
log + checking git
|
|
#git -C $p pull --no-edit || fatal "git pull failed, giving up"
|
|
git -C $p status --porcelain | grep -v '^??' | grep -q . && {
|
|
git -C $p status
|
|
fatal "git in project \"$p\" has locally modified files, giving up"
|
|
}
|
|
else
|
|
log + checking cvs
|
|
#cvs update -dP $p
|
|
cvs status $p > $scm_status 2>&1
|
|
if [ $? != 0 ]; then
|
|
cat $scm_status
|
|
fatal "\n======== cvs status failed in project \"$p\", giving up."
|
|
fi
|
|
grep -qi "locally modified" $scm_status && \
|
|
fatal "cvs copy in project \"$p\" has locally modified files, giving up"
|
|
grep -qi "needs" $scm_status && \
|
|
fatal "+ cvs copy in project \"$p\" is out-of-date, giving up"
|
|
fi
|
|
}
|
|
|
|
local_cvs_proj=`ls -d */CVS 2>/dev/null | sed 's%/[^/]*%%'`
|
|
local_git_proj=`ls -d */.git 2>/dev/null | sed 's%/[^/]*%%'`
|
|
remote_cvs_proj=`ssh cvs.jannet.de find /home/jannet/arc/cvs/proj -type d -maxdepth 1 -mindepth 1 | sed 's%.*/%%'`
|
|
remote_git_proj=`ssh git.jannet.de git-srv-admin.sh -j list-personal-projects`
|
|
|
|
date=`date +'%Y%m%d'`
|
|
myname=`basename $0`
|
|
|
|
trap goodbye EXIT INT QUIT KILL
|
|
scm_status=`mktemp /tmp/$myname""_XXXXXX`
|
|
|
|
for p in $local_cvs_proj; do
|
|
[ -L $p ] && continue
|
|
[ -d $p ] || continue
|
|
echo $remote_cvs_proj | grep -q "\(^\| \)$p\($\| \)" && continue
|
|
n=purged/cvs/$date/$p
|
|
mkdir -p `dirname $n`
|
|
echo moving stale cvs project $p to $n
|
|
mv $p $n
|
|
purged="$purged $p"
|
|
done
|
|
|
|
[ -d old ] && mv old purged
|
|
|
|
[ "$purged" ] && {
|
|
cp -p CVS/Entries CVS/Entries-$date-`date +'%H%M%S'`
|
|
}
|
|
|
|
for p in $purged; do
|
|
sed -i "/D\/$p\/\/\/\// d" CVS/Entries
|
|
done
|
|
|
|
for p in $local_git_proj; do
|
|
[ -L $p ] && continue
|
|
[ -d $p ] || continue
|
|
echo $remote_git_proj | grep -q "\(^\| \)$p\($\| \)" && continue
|
|
check_scm $p
|
|
n=purged/git/$date/$p
|
|
mkdir -p `dirname $n`
|
|
mv $p $n
|
|
log "moving stale project \"$p\" to \"$n\""
|
|
done
|
|
|