1

My question is probably related to git - how can I clone local svn repository? but I cannot quite achieve what I want to.

We have an old local SVN repository. It looks like a single repository, but there are multiple different projects under this repository, like:

project1/
    project1_subproject1/
    project1_subproject2/
    project1_subproject3/
project2/
    project2_subproject1/
    project2_subproject2/
    project2_subproject3/
...

I am trying to git svn clone just one of the sub-projects, not the entire repository, but I am really not sure how to do that.

The main repository is under: /home/user/projects/subversion/

I tried git svn clone file:///home/user/projects/subversion/project2/project2_subproject1 but obviously that fails.

I also tried git svn clone --trunk=project2/project2_subproject1 file:///home/user/projects/subversion/, but that also fails.

Both tries result in W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found:

Note: I have managed to clone the entire subversion repository into one single git repository using git svn clone file:///home/user/projects/subversion/, but that's not what I want.

Any help please?

Armand Jordaan
  • 348
  • 2
  • 11
  • What if instead of using this path you use the http path? see https://stackoverflow.com/a/20962641/1701296 – Francesco Aug 23 '17 at 06:20
  • What's the OS you are using? – Marina Liu Aug 23 '17 at 08:47
  • Hi I'm using ubuntu 16.04 – Armand Jordaan Aug 24 '17 at 04:53
  • The commands `git svn clone file:///home/user/projects/subversion/project2/project2_subproject1` can also works for linux. Please make sure the `project2` folder is located in the **root of svn repo** (not under `trunk/` or `branches/` etc). And what if you add the option `--no-metadata` in the command? – Marina Liu Aug 24 '17 at 09:18

1 Answers1

1

Clone the whole svn repository, replicate and clean up

Possibly the easiest way is to:

  • clone the full SVN repository
  • copy the cloned repository N times, where N is the number of independent projects
  • clean up each individual git repository, such that only one project remains

For the last step, see Remove folder and its contents from git/GitHub's history

petrpulc
  • 940
  • 6
  • 22