Skip to contentSkip to conversation

ANNOUNCE: bitkeeper to CVS gateway

DISCUSSION Pavel Machek 1 participant 1 message Jul 24, 2002

lore
Share & tools
lore
#0 lore raw

Hi!

I've created some scripts usefull for doing bitkeeper 2 cvs gateway. I'm currently running them on nl.linux.org (as you can see from the close look). I have not yet figured out how to export resulting CVS to the world.

[These scripts are in CVS at www.sf.net/projects/linux25.]

Hopefully this will be usefull to someone...
Pavel

bk2all:

#!/bin/bash
cd /home/riel/bk-kernel/linux-2.5
A=$1
while [ $A -lt $2 ]; do

	PREV=$A
	A=$[$A+1]

	echo "Processing patch $A"
	bk export -tpatch -r1.$PREV,1.$A > ~/bkdata/1.$A

done

diff2cvs:

#!/bin/bash

fake() {
	eval $1
}
dir() {
	while [ ! -d $1 ]; do
		DIR=$1
		OLDDIR=foo
		while [ $OLDDIR != $DIR ]; do
			mkdir $DIR && fake "cvs add $DIR"
			OLDDIR=$DIR
			DIR=${DIR%/*}
		done
	done		
}

cat $1 | grep '^+++ ' | grep -v "/dev/null" | (

	while true; do
		read A B C || break
		FILE=${B#*/}
		if [ ! -e $FILE ]; then
			touch $FILE || dir ${FILE%/*}
			touch $FILE || echo "Could not create $FILE"
			touch $FILE || exit 1
			fake "cvs add -ko $FILE"
		fi
	done

)
cat $1 | patch -Esp1 || exit 3

cat $1 | grep '^--- ' | grep -v "/dev/null" | (

	while true; do
		read A B C || break
		FILE=${B#*/}
		if [ ! -e $FILE ]; then
			fake "cvs remove $FILE"
		fi
	done

)

cat $1 | grep '^#' > /tmp/delme.diff2cvs

fake "cvs -z 3 commit -F /tmp/delme.diff2cvs ."

all2cvs:

#!/bin/bash
A=$1
while [ $A -lt $2 ]; do

	A=$[$A+1]
	if [ ! -e ../data/1.$A ]; then
	    echo "Patch $A does not exist"
	    exit 1
	fi
	echo "Processing patch $A"
	../scripts/diff2cvs ../data/1.$A
	mv  ../data/1.$A  ../olddata/1.$A
	echo "Done processing $A"
	if [ -e ../data/STOP ]; then
		echo "Stopped at user request after $A"
		echo "Stopped at user request after $A" > ../data/STOP
		exit 1
	fi

	I=1; while [ $I -lt 50000 ]; do I=$[$I+1]; done

done

Pavel

Signature · 2 lines
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?