When git-svn
needs to rebuild its internal map, it outputs the wanted information to STDERR
:
Rebuilding .git/svn/refs/remotes/origin/trunk/.rev_map.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
r38601 = 28d3a624c5c96db9a1f45d8f261a9b0de1f6f288
r38652 = 74c55b8dff798e5ae1bc2ad00d8ec6eee4f2646b
r38744 = eb457e1949ecf854816ba9cf64b4bace710a7302
r38745 = 5bca99a37fbc6db72d2d50a75301185f4297926c
(...)
The file .git/svn/refs/remotes/origin/trunk/.rev_map.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
is unfortunately binary, thus can't be parsed easily. Is there a way to have git-svn
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?
There might be a better way if you check the internals of the git-svn, but if nothing more convenient you have the mapping in the log messages in the form of
so potentially you could go through the revisions you are interested in and parse the mapping from the last line of the log.
Fetch all SVN revisions:
Map revision numbers <=> git SHA-1:
Output:
Get a list of all hashes (or revisions) and use
git svn find-rev XXX
in cycle.