Hi,
Sorry, this is helpful for SMI developers only at the moment ...
to simplify my development on sfw, I wrote small script which converts
sfw from teamware to hg.
The gate is at
/net/pub.czech/store/rcs/sfw-gate
or
ssh://pub.czech//store/rcs/sfw-gate
it's read only, and it's synchronized every five minutes (so if there
will be two commits in less than five minutes, chances are that they
will be converted to just one changeset.
I'm attaching the script
--
Vlad
-------------- next part --------------
#!/usr/bin/ksh
trap 'exit 1' INT TERM QUIT
alias err='trap '"'"'ERR=$?; echo "$0: error on line $LINENO ($ERR)"; return
$ERR'"'"' ERR'
err
typeset HG_ROOT=/store/rcs/sfwnv-gate
run_sync() {
err
time rsync -a -i -z \
--exclude /deleted_files \
--exclude /archives \
--exclude /packages \
--exclude /proto \
--exclude /public \
--exclude SCCS/ \
--exclude SCCS/ \
--exclude /usr/src/mail_msg_* \
--exclude /usr/src/proto_list_* \
--exclude /usr/src/*.log \
--exclude /usr/src/*.lock \
jansky.sfbay:/ws/sfwnv-gate/ "$HG_ROOT/"
#train
}
extract_comments() {
err
cd "$HG_ROOT"
# nawk is used because it can handle very long lines
nawk '
BEGIN { tmp="" }
{
if ( $0 == "BEGIN COMMENT" ) { copy = 1 }
else if ( $0 == "END COMMENT" ) { copy = 0 }
else if ( $0 == "STATUS 0" ) {
if ( tmp != "" ) { print tmp }
tmp=""
}
else if ( $0 == "STATUS 1" ) { tmp="" }
else if ( copy == 1 ) { tmp=sprintf("%s%s", tmp, $0) }
}
' Codemgr_wsdata/history > sfwnv_sync/history.temp
}
is_gate_changed()
{
err
grep 'COMMAND putback' /ws/sfwnv-gate/Codemgr_wsdata/history >
sfwnv_sync/putback.temp
diff sfwnv_sync/putback sfwnv_sync/putback.temp && return 1 || true
}
main() {
err
cd "$HG_ROOT"
is_gate_changed || return 0
while : ; do
run_sync # we depend on rsync aborting when local data changed
typeset -i count=$( cat Codemgr_wsdata/locks | grep ^writ | wc
-l )
[[ $count -eq 0 ]] && break
done
is_gate_changed || true
extract_comments
typeset commit_message="$( diff sfwnv_sync/history
sfwnv_sync/history.temp | tail +2 | sed -e 's/^..//' )"
[[ -z $commit_message ]] && exit 1
cp sfwnv_sync/putback sfwnv_sync/putback.old
mv sfwnv_sync/putback.temp sfwnv_sync/putback
cp sfwnv_sync/history sfwnv_sync/history.old
mv sfwnv_sync/history.temp sfwnv_sync/history
hg ci -A -m "$commit_message"
echo commit done
}
typeset -ft $(typeset +f)
while : ; do
main
sleep $((5*60))
done
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 193 bytes
Desc: not available
URL:
<http://mail.opensolaris.org/pipermail/sfwnv-discuss/attachments/20081008/130fe707/attachment.bin>