3

I'm in the process of writing a general-purpose svn -> git migration script, which allows for a lot more than the standard git svn clone, and during one stage of my script I'm checking the output of git svn show-externals and git svn show-ignore for every branch in the migrating repository, and taking various steps depending on the output of those commands.

My problem now is that while the rest of my script follows through pretty fast, these two commands in particular seem to be taking up the vast majority of my running time. In some cases, git svn show-externals is taking upwards of 10 minutes to run (on a repo containing around 5000 files). When running on a repository of this size with 10 or more branches, you can imagine this adding up considerably.

Why does this operation take so long to execute? Is there anything I can do to speed up it's execution?

majackson
  • 2,823
  • 6
  • 22
  • 38

1 Answers1

4

"git svn show-ignore" performs an additional SVN request per directory.

For migration purposes maybe you would like to have a look at SubGit tool. It translates svn:ignore -> .gitignore for every revision (and also it translates svn:eol-style, tags and so on). The only restriction: it requires local access SVN to repository. So it might be used in combination with svnrdump tool. If you have the SVN repostiory locally, the migration is performed in one step:

$ subgit install path/to/svn/repo
Dmitry Pavlenko
  • 8,530
  • 3
  • 30
  • 38
  • "performs an additional SVN request per directory." - really per directory?? Why doesn't it just do a single recursive `svn propget -R svn:ignore` for the whole tree? – Rup May 21 '12 at 16:55
  • This could be useful. I notice it doesn't support converting externals to submodules though. Any suggestions on that? – majackson May 21 '12 at 16:55
  • 2
    Rup: Have a look at "cmd_show_ignore" function in git-svn script. It calls "prop_walk". Then have a look at "prop_walk" definition. It calls $self->ra->get_dir($path, $rev); -- a method that gets properties and children for a directory. Then "prop_walk" calls itself for every child that is a directory. Very strange but true. – Dmitry Pavlenko May 21 '12 at 17:12
  • majajackson: No, SubGit doesn't convert externals to submodules now, but has this feature in RFE list. Not every svn:externals can be converted to a Git submodules. First, the repository svn:externals point to should have Git interface. And second svn:externals should not point to HEAD revision but to a certain revision. There's another tool that tries to process svn:externals --- SmartGit (it converts them to .gitsvnextmodules file and shows submodules for any Git repository with this file). But it is UI-only solution and can't be called from a script. – Dmitry Pavlenko May 21 '12 at 17:12