zb226 zb226 - 22 days ago 4x
Git Question

Map of all svn revision numbers <=> git SHA-1 commit hashes


needs to rebuild its internal map, it outputs the wanted information to

Rebuilding .git/svn/refs/remotes/origin/trunk/.rev_map.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
r38601 = 28d3a624c5c96db9a1f45d8f261a9b0de1f6f288
r38652 = 74c55b8dff798e5ae1bc2ad00d8ec6eee4f2646b
r38744 = eb457e1949ecf854816ba9cf64b4bace710a7302
r38745 = 5bca99a37fbc6db72d2d50a75301185f4297926c

The file
is unfortunately binary, thus can't be parsed easily. Is there a way to have
output the above information by a specific command? I'm on
git 2.7.0
, by the way.

Edit: I'm aware of
git svn find-rev
, but this will only allow me to find out the SHA-1 commit hash of a single revision and I have to provide a specific SVN revision. What I would like to get, though, is the mapping of all revisions. Preferably without brute-forcing my way through or using an external datasource (the SVN repo, namely) to provide SVN revisions as input. Most preferably, without providing anything, as this information is stored in the repository after git-svn has built its revision map - or is it not?


Fetch all SVN revisions:

git config --add svn-remote.<Remote>.url <SVN URL>
git config --add svn-remote.<Remote>.fetch :refs/remotes/<Remote Name>
git svn fetch <Remote>

Map revision numbers <=> git SHA-1:

git checkout remotes/<Remote Name>
git svn log --show-commit --oneline


r50 | 77c9acf | "SVN Commit message"
r1 | 84e6c49 | "SVN Commit message"