How to git svn clone full history despite svn copy

北城以北 提交于 2019-12-07 18:50:09

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/25358628/how-to-git-svn-clone-full-history-despite-svn-copy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!