Subgit import - imported svn history showing unrelated revisions

213 Views Asked by At

I am using Subgit to import SVN repository to git, maintaining revision history.

Here is my svn repo structure:

Root
  trunk
  branches
    uat
    qua
      subfolder1
        project1
      subfolder2
        project2
        project3
        ...
        projectn

I would like to import project1 and project2 into a single git repo but with changed folder names, project1newName and project2newName respectively.

Desired git repo structure should be as follows then:

Root
  project1newName
  project2newName

I have no idea how to achieve this through subgit import configuration.

I was trying something like this in subgit config file:

[svn]

trunk = branches/qua:refs/heads/master

includePath = /subfolder1/project1

includePath = /subfolder2/project2

After running subgit import and pushing translated git commits to bitbucket however:

  • subfolder1 and subfolder2 are present in the git repo (I don't need them)
  • project1 and project2 have their names unchanged
  • git repo history includes commits that are unrelated to project1 and project2, eg those for project 3 (probably result of setting trunk to their common root - qua branch)

Is there any way to achieve my goals through subgit import itself? Some kind of smart mapping maybe I missed in the documentation?

1

There are 1 best solutions below

1
On

It looks like you didn't miss anything in the documentation, the setup is correct and the use of includePath is also correct, but I'm afraid that the outcome of this setup is also correct and expected: the includePath setting (as well is its associate excludePath) is purposed to limit the number of imported directories and files. This feature, however, is not able to change paths and names on the fly, so it keeps the directories structure untouched, that's why the subfolder directories appear in Git. Same applies to names, SubGit does not renames directories on the fly -- it is possible to rename branches during the import, but not directories inside the branches. As for the empty commits -- this behavior may be changed by the translate. createEmptyGitCommits setting:

https://subgit.com/documentation/config-options.html#translate.createEmptyGitCommits

[translate]
    createEmptyGitCommits = false