bk fast-import
This post talks about the new fast-import function for importing git repositories. The top post here will stay updated with current usage instructions and the discussion below will talk about what is coming next.
This command is very fast, like 100x faster than the previous git2bk script posted.
pre-alpha
Currently, this code is not integrated and should be considered a pre-alpha state. It is a great way to be able to play with BitKeeper with real data, but it should be validated very carefully before using the results in production.
ie, I just got this to work and I am letting people take a look to help me find bugs.
Repository
The code for this is hosted at:
bk://bkbits.net/u/wscott/dev.fast-import
Typically you would clone a local copy of bk and then pull from that location.
Or try this:
bk clonemod bk://bkbits.net/u/wscott/dev.fast-import LOCALBK dev.fast-import
(That command will get a copy of the change without transferring the whole repository.)
Usage
mkdir bk-repo
cd bk-repo
git -C ../git-repo fast-export master | bk fast-import
Limitations and known bugs
- This will only do an import of a single git branch
- It doesnât do incremental imports yet
- doing the import twice will generate different metadata so you canât currently import two different git branches and have they talk to each other.
- This is currently taking gitâs data directly without trying to enable rename detection.
- Since bk has first class rename events that propagate across merges this is actually very difficult. That is a planned feature.
How to validate an import
I found that a quick way to prove to yourself that the bk import was correct is to turn around and use bk fast-export
to put bkâs data back into your git repository. Something like this:
cd bk-repo
bk fast-export --branch=bkcmp --no-bk-keys | git -C ../git-repo fast-import
Then the commits wonât be exactly the same, but the tree objects should match exactly:
# bk has 2 new csets at the beginning we need to skip
BKROOT=`git log --pretty=%H bkcmp | tail -2 | head -1`
FMT="tree: %T%ncommitter: %ae%ndate: %cD%n%B"
git log --date-order --pretty="$FMT" --raw $BKROOT..bkcmp > BK.log
git log --date-order --pretty="$FMT" --raw master > GIT.log
diff -u BK.log GIT.log