mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
purge-stale-projects.sh: Implemented support for git in checking status
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
4fcef03284
commit
1b071fbe8e
1 changed files with 29 additions and 10 deletions
|
|
@ -13,7 +13,32 @@ fatal()
|
|||
|
||||
goodbye()
|
||||
{
|
||||
rm -f $cvs_status
|
||||
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%/[^/]*%%'`
|
||||
|
|
@ -25,7 +50,7 @@ date=`date +'%Y%m%d'`
|
|||
myname=`basename $0`
|
||||
|
||||
trap goodbye EXIT INT QUIT KILL
|
||||
cvs_status=`mktemp /tmp/$myname""_XXXXXX`
|
||||
scm_status=`mktemp /tmp/$myname""_XXXXXX`
|
||||
|
||||
for p in $local_cvs_proj; do
|
||||
[ -L $p ] && continue
|
||||
|
|
@ -52,16 +77,10 @@ for p in $local_git_proj; do
|
|||
[ -L $p ] && continue
|
||||
[ -d $p ] || continue
|
||||
echo $remote_git_proj | grep -q "\(^\| \)$p\($\| \)" && continue
|
||||
cvs status $p > $cvs_status 2>&1
|
||||
if [ $? != 0 ]; then
|
||||
cat $cvs_status
|
||||
fatal "\n======== cvs status failed in project $p, giving up."
|
||||
fi
|
||||
grep -qi "project $p has locally modified" $cvs_status && \
|
||||
fatal "cvs copy has locally modified files, giving up"
|
||||
check_scm $p
|
||||
n=purged/git/$date/$p
|
||||
mkdir -p `dirname $n`
|
||||
mv $p $n
|
||||
log "moving stale CVS project \"$p\" to \"$n\""
|
||||
log "moving stale project \"$p\" to \"$n\""
|
||||
done
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue