Skip to content

Instantly share code, notes, and snippets.

@WorksOnMyBox
Last active March 10, 2022 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WorksOnMyBox/746131cdb0d4dbb17c461f6e7e684ced to your computer and use it in GitHub Desktop.
Save WorksOnMyBox/746131cdb0d4dbb17c461f6e7e684ced to your computer and use it in GitHub Desktop.
Read a git svn .rev_map file
FileStream fs = new FileStream(@".rev_map.a7f757b4-5dc9-1e4e-bcaa-e126dea94035", FileMode.Open);
BinaryReader br = new BinaryReader(fs);
while (br.BaseStream.Position < br.BaseStream.Length)
{
byte[] bRevision = br.ReadBytes(4);
Array.Reverse(bRevision);
int revision = BitConverter.ToInt32(bRevision, 0);
byte[] bHash = br.ReadBytes(20);
string hash = BitConverter.ToString(bHash).Replace("-", "").ToLower();
Console.WriteLine(revision.ToString() + " : " + hash);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment