Skip to content

Instantly share code, notes, and snippets.

@dmikushin
Created November 8, 2024 10:38
Show Gist options
  • Save dmikushin/229f4cd432b5f3a676c48118848cb3bf to your computer and use it in GitHub Desktop.
Save dmikushin/229f4cd432b5f3a676c48118848cb3bf to your computer and use it in GitHub Desktop.
Simple Bzr to Git repository converter
#!/bin/bash
for rev in $(bzr log | grep '^revno:' | awk '{print $2}' | tac); do
bzr revert -r $rev
committer=$(bzr log -v -r$rev | grep "committer:.*" | sed "s/committer:\s*//g")
timestamp=$(bzr log -v -r$rev | grep "timestamp:.*" | sed "s/timestamp:\s*//g")
commit_message=$(bzr log -v -r$rev | sed -ne "N;s/message:\s*\n/message:/;P;D" | grep "message:.*" | sed "s/message:\s*//g")
git add .
git commit --author="$committer" --date="$timestamp" -m "$commit_message"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment