4

In my company we are about to switch from svn to git. The SVN we use is very big, doesn't have a svn layout and on every version split we made a svn copy.

SVN Repository structur:

  • svnserver.company.de
    • product xy
      • majorversionnumber 1
      • majorversionnumber 2
      • majorversionnumber 3
        • minorversionnumber 3.0.0
        • minorversionnumber 3.0.1
        • minorversionnumber ...
      • majorversionnumber 4
      • ....
    • product zw

What we want or what i was expecting git to do:

git svn clone does clone all files from one subfolder / copy with the full history of these files (like tortoise does by unchecking "Stop on copy/rename").

What git is doing:

git svn clone --prefix=origin/ --username=spe --authors-file=authors.txt https://svnserver.company.de/repos/product/majorversionnumber/Master/Source product

-> does clone all files from one subfolder / copy but only with the history until the copy has taken place.

The Question:

Has git a equivalent to svns "Stop on copy/rename" or how to clone full history despite svn copy?

What i have found so far: Git-svn - import full history Work-around for failing "git svn clone" (requiring full history) https://github.com/githubtraining/zzz_deprecated-feedback/issues/43

To be honest, i didn't understand the solution approaches of these links neighter if they had the same problem as we do.

Community
  • 1
  • 1
Spenhouet
  • 6,556
  • 12
  • 51
  • 76
  • Please add some examples: What does your repo structure look like? How you invoke `git svn clone` (the options make a difference...)? What result do you expect from git-svn? – sleske Aug 18 '14 at 11:31
  • I've added an example of our svn repo structure and the git command. What result i expect is already under "What we want or what i was...". – Spenhouet Aug 18 '14 at 11:46
  • Help us understand how the structure came to be this way; i.e. the history. Say you were now going to create "majorversionnumber 5" of "product xy" -- what SVN command would you use to do that? Similarly for "majorversionnumber 3.0.2", what's the SVN command? – Matt McHenry Aug 19 '14 at 11:41
  • major 5: New Folder in SVN in product xy named (in this example) "majorversionnumber 5" and a "master" folder in the major folder. Then a copy of the source from major 4 master to major 5 master. SVN can track the history correct. minor 3.0.2: New Folder in SVN in major 3 named "minor... 3.0.2". Then a copy of the source from major 3 master to this new Folder. – Spenhouet Aug 19 '14 at 11:59
  • possible duplicate of [How to migrate SVN repository with history to a new Git repository?](http://stackoverflow.com/questions/79165/how-to-migrate-svn-repository-with-history-to-a-new-git-repository) – kenorb Mar 18 '15 at 13:06

1 Answers1

2

Okay, so if I understand correctly your full layout is like this:

svnserver.company.de
  product xy
    majorversionnumber 1
      master
        <actual source starts here>
    majorversionnumber 2
    majorversionnumber 3
      master
        <actual source starts here>
      minorversionnumber 3.0.0
        master
          <actual source starts here>
      minorversionnumber 3.0.1
      minorversionnumber ...
    majorversionnumber 4
    ....
  product zw

This is just an untested educated guess, but I'd try something like this. First, git svn init svn://svnserver.company.de. Then edit .git/config's [svn-remote] section to look something like this:

fetch = product xy/majorversionnumber 1/master:refs/remotes/origin/trunk
branches = product xy/{majorversionnumber 2,majorversionnumber 3}/master:refs/remotes/origin/branches/*
branches = product xy/majorversionnumber 3/{minorversionnumber 3.0.0,minorverionnumber 3.0.1}/master:refs/remotes/origin/branches/*

Then git svn fetch. You can use similar commands + config to create a clone for product zw.

See the CONFIGURATION section of git help svn for more details.

Matt McHenry
  • 20,009
  • 8
  • 65
  • 64