0

I have the following SVN repository structure. This is not by design, someone did something odd before I became involved.

https://server/svn/repo
https://server/svn/repo/rootfolder1
https://server/svn/repo/rootfolder2
https://server/svn/repo/trunk
https://server/svn/repo/trunk/trunkfolder1
https://server/svn/repo/trunk/trunkfolder2

I am attempting to import the two folders rootfolder1 and rootfolder2 into a Git repository (I will then split them off to separate repositories using git-filter-branch).

Running subgit import --svn-url https://server/svn/repo repo-root, I'm left with a Git repository with trunkfolder1 and trunkfolder2. Passing --trunk repo gives me an empty Git repository. Running as subgit import --svn-url --trunk repo https://server/svn repo-root gives me the following error:

IMPORT FAILED

error: svn: E175002: PROPFIND of '/': 405 Method Not Allowed (https://server)

I also tried subgit --import --trunk . --svn-url https://server/svn/repo repo-root however subgit complains about the --trunk parameter.

Any suggestions on a solution to this problem?

  • "I will then split them off to separate repositories using git-filter-branch" use `git subtree split` instead of filter-branch – CodeWizard Dec 15 '18 at 14:53
  • ah didn't know about that - I was reading an old tutorial maybe. I've already used `git filter branch` on a bunch of other repos. Is there a difference in the result? – AldoSpeedWagon Dec 15 '18 at 14:56
  • subtree split is much better. Read here : https://stackoverflow.com/questions/53695232/git-split-existing-repository-into-submodules/53695584#53695584 – CodeWizard Dec 15 '18 at 14:56

1 Answers1

0

If you eventually intend to have those 'rootfolders' into separate repositories, then it's reasonable to import them into different Git repositories on the import stage, I think. It could be done by the following two commands:

subgit import --trunk rootfolder1 --username <svn user name> --password <svn user password> --non-interactive --trust-server-cert --svn-url https://server/svn/repo <GIT_REPO>

subgit import --trunk rootfolder2 --username <svn user name> --password <svn user password> --non-interactive --trust-server-cert --svn-url https://server/svn/repo <GIT_REPO_2>

In this case, 'rootfolder1' will be imported into GIT_REPO and 'rootfolder2' into GIT_REPO_2, so you won't need to split them.

In addition, I'd recommend providing an authors file during import so that SVN users are translated to suitable Git users, find more details here:

https://subgit.com/documentation/import-book.html#authors_file

Importing both 'rootfolders' into a single Git repository is also possible, but it requires extra steps to get rid of 'trunk':

  • prepare a new Git repo for the import:

    subgit configure https://server/svn/repo GIT_REPO

  • open SubGit configuration file in a text editor:

    GIT_REPO/subgit/config

  • change mapping configuration in the following way:

    [svn]
    
        trunk:refs/heads/master
        excludePath = /trunk
    

    save and close the file.

  • run the import:

    subgit import GIT_REPO

In this case, GIT_REPO will only contain 'rootfolders' as 'trunk' is excluded by 'excludePath' directive.

ildar.hm
  • 526
  • 2
  • 5
  • Hi thanks for this, I got it working using your first approach, exporting the folders individually using `--trunk`. Works great – AldoSpeedWagon Dec 18 '18 at 23:29