0

I'm currently working on converting SVN repos to git using svn2git. One of the problems I'm running into is that once converted the points at which we merged in svn do not show up in git. Instead we get separated branches and tags with no connections to each other except in rare cases.

To work around this I've been rewriting history manually using git replace and git filter-branch. This is a very slow process that can take hours if not days in some cases. As I have to review the history in git and svn to find the correct locations. Then run replacements on commits to add parents or fix parents in the case of bad merges. I've automated some aspects of this process already using simple scripts that fix things like authors, emails, and dates. However, merges are mostly manual at the moment.

What I would like to do is find a way to automate the process fully. I have an idea of how to manage this with git replace using a list of expected merge locations. Then looping through them to reconnect them using git replace, matching on revision IDs stored in the commit message, and/or using git filter-branch to flow the history. Problem is my understanding of svn is not strong enough to figure out how to export a list of merge points.

Though honestly this doesn't have to be the exact solution as the goal is to preserve merge history to create a proper graph in git. So if there is a way to run svn2git to generate the merges itself that would also be good. As well I have tried sub-git and svn-git with the same results. Sub-git does a better job at handling the tags but both fail at preserving merges.

DarkGuardsman
  • 126
  • 4
  • 15
  • Which svn2git are you using? I used https://github.com/svn-all-fast-export/svn2git with good success. You need to specify every branch path with regex. – EncryptedWatermelon Jun 17 '19 at 15:07
  • That is a good question, I installed it via the terminal so not sure how to tell as there seems to be no version info command. I want to say its https://github.com/nirvdrum/svn2git/blob/master/README.markdown I'll see if I can use the other version with any more success – DarkGuardsman Jun 17 '19 at 15:18
  • Not having much luck building it on mac, you have any info on the process needed? – DarkGuardsman Jun 17 '19 at 16:06
  • Sorry, someone else built it. Can you post your current rules? Maybe I will see something there – EncryptedWatermelon Jun 17 '19 at 17:27
  • The version of svn2git did not include rules – DarkGuardsman Jun 17 '19 at 18:10
  • Are you specifying location of trunk, tags and branches? Depending on your repo you may have to list multiple branches and tags. Default locations is trunk branches and tags at the root of the repo. – EncryptedWatermelon Jun 17 '19 at 19:00
  • Its a default repo though we did replace trunk with one of the branches rather than merging. However, I have yet to get that far with KDE svn2git, only just finally got it to compile and my current issue is it failing to find a format folder in the svn checkout. – DarkGuardsman Jun 17 '19 at 19:42

0 Answers0