ANNOUNCE: bitkeeper to CVS gateway

From: Pavel Machek (pavel@ucw.cz)
Date: Wed Jul 24 2002 - 11:09:41 EST


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

-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 30 2002 - 14:00:16 EST