Created
November 8, 2024 10:38
-
-
Save dmikushin/229f4cd432b5f3a676c48118848cb3bf to your computer and use it in GitHub Desktop.
Simple Bzr to Git repository converter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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