Created
March 1, 2012 21:40
-
-
Save mdaniel/1953425 to your computer and use it in GitHub Desktop.
regenerate git-svn .rev_map file
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
#! /usr/bin/env gawk -f | |
# git --no-pager log | gawk -f this-script > revmap.txt | |
# xxd -c 24 -r revmap.txt \ | |
# .git/svn/refs/remotes/trunk/.rev_map.cfe28804-0f27-0410-a406-dd0f0b0b656f | |
# 0000000: 0000 0001 cce6 285e 48e1 e3cc 0d7d 0617 beb0 4e88 a126 8634 | |
# 0000018: 0000 0006 6e4f ada4 bed4 6660 c987 dc74 1243 8973 16cc c810 | |
BEGIN { | |
FS=" " | |
# this number comes from ``git --no-pager log | grep ^commit | wc -l`` | |
# and is ZERO-indexed because the last xxd will begin with 0000 | |
# you might be tempted to think it is the highest r-number, but no, | |
# because evidently not every subversion commit made it to git | |
cnt=30554 | |
} | |
/^commit / { | |
cmit=$2 | |
} | |
/git-svn/ { | |
# remove everything except the r-number | |
sub(/[^@]+@/,"") | |
# remove the repository-id | |
sub(/ .*$/,"") | |
addr=cnt * 24 | |
# thankfully, xxd is tolerant of not having | |
# any spaces, so we can just dump the commitish | |
# right into the file | |
printf "%08x: %08x%s \n", addr, $0, cmit | |
cnt = cnt - 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment