1

My question is very similar to Retaining svn copy history when converting to git except that I am using the free kde svn2git tool

To summarize: I'm trying to convert a single SVN repo over to a single git repo. After migration of the svn repository to git I have noticed that git does not seem to follow svn copy operations so the resulting history is much briefer than I expect. Suppose my SVN repo looked like this:

root

  • a
  • b
  • c
  • parent project

    • b

    • c

Projects b and c were recently copied under parent-proj as part of a restructuring effort with the intention of eventually deleting them from their old locations under root. After migration the resulting git repo is missing all of the history that originated from /b and /c before the move.

I am using the kde svn2git tool which can be found at https://github.com/svn-all-fast-export/svn2git I tried to look at the sample rules files and documentation for this tool but could not find any information on how to achieve this using this tool.

conrad
  • 19
  • 4

1 Answers1

0

In my experience the situation you describe is a frequent occurance in SVN. People create an 'arbitrary trunk'.

Ideally projects should follow the Subversion conventions. That means that each project will have a subfolder called 'trunk, branches, tags'. Then when migrating with svn2git all you need is a rule for those three folders:

create repository fw
end repository

match /Project/trunk/
  repository fw
  branch master
end match

match /Project/branches/([^/]+)/
  repository fw
  branch \1
end match

match /Project/tags/([^/]+)/
  repository fw
  branch refs/tags/\1
end match

Unfortunately, if you are migrating a repository which didn't strictly follow the convention, then you can have arbitrary trunks, which means a completely separate history. So you need a separate rule, for example you might have a rule like this:

match /Project/trunk/subdir1/subdir2/myproj/trunk
  repository fw
  branch master
end match

You may need to write a script examine the svn paths, which generate rules based on paths discovered.

eeijlar
  • 1,232
  • 3
  • 20
  • 53