Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用完整历史记录从Git迁移到SVN_Git_Svn_Version Control Migration - Fatal编程技术网

使用完整历史记录从Git迁移到SVN

使用完整历史记录从Git迁移到SVN,git,svn,version-control-migration,Git,Svn,Version Control Migration,我有一个独立的Git存储库,我想将其迁移到一个新的SVN存储库。至少,我希望迁移具有完整历史记录的主分支,但理想情况下,我希望迁移所有分支和标记。我只需要做一次一次性迁移;我不需要重复这个或做任何双向同步或诸如此类的事情 根据我在网上找到的资料,最好的工具似乎是git svn。我觉得我遗漏了一个明显的东西,那就是我需要通过的git svn init或git svn dcommit的一些参数将使所有这些都正常工作,但我就是找不到它 到目前为止,我已经做了以下尝试: 尝试1:git svn向空白sv

我有一个独立的Git存储库,我想将其迁移到一个新的SVN存储库。至少,我希望迁移具有完整历史记录的主分支,但理想情况下,我希望迁移所有分支和标记。我只需要做一次一次性迁移;我不需要重复这个或做任何双向同步或诸如此类的事情

根据我在网上找到的资料,最好的工具似乎是git svn。我觉得我遗漏了一个明显的东西,那就是我需要通过的
git svn init
git svn dcommit
的一些参数将使所有这些都正常工作,但我就是找不到它

到目前为止,我已经做了以下尝试:

尝试1:git svn向空白svn回购提交数据。
  • 第一个
    git push svntest--all
    失败,原因是“更新被拒绝,因为远程包含本地没有的工作。这通常是由另一个存储库推到同一个引用引起的。在再次推之前,您可能希望先集成远程更改(例如,'git pull…')。”。在执行git pull svntest master--allow unrelated history并提交合并后,推送成功
  • 最后,
    git svn dcommit
    给出了关于空存储库的相同错误
  • 尝试3:使用GitHub的SVN桥
    • GitHub上的Git存储库可以通过SVN访问
    • 我将我的Git回购推送到GitHub,并且可以从SVN访问它。(
      svn公司https://github.com....
    • 通常,
      svnrdump
      能够在给定URL的情况下转储SVN repo(与需要作为本地文件系统中的文件提供repo的
      svnadmin dump
      相反),但是svnrdump返回
      svnrdump:E200007:请求的报告未知。
    • 我能够
      svnrdump dump-r
      单个修订版。任何修订似乎都有效,但指定
      --incremental
      或一系列修订(
      -r 1:2
      或所有内容的默认值)会导致报告该错误
    • 显然,GitHub通过HTTPS实现SVN不支持增量转储
    • 我可以从1到HEAD进行非增量转储,但我不知道有什么方法可以将这些连续的非增量转储转换回增量转储,这样它就可以拥有完整的历史记录
    尝试#4:在SVN中进行初始提交,然后从那里进行数据提交 按杰夫·梅尔卡多的

    在执行所有git SVN操作之前,我在SVN的主干中创建了一个空文件。我第一次通过时,dcommit有到SVN的链接,但实际上没有在初始分支上提交任何内容,然后在切换到另一个分支和切换回主分支时给出了错误。当我重复这些步骤来捕获要发布到这里的输出时,它立即给出了错误。回顾一下命令历史,我看不出有什么不同。不管怎样,我还是不能提交

    [dyaw@localhost v4]$ svn co svn://server/emptyRepo svn
    Checked out revision 0.
    [dyaw@localhost v4]$ cd svn
    [dyaw@localhost svn]$ mkdir trunk tags branches
    [dyaw@localhost svn]$ svn add trunk tags branches
    A         trunk
    A         tags
    A         branches
    [dyaw@localhost svn]$ cd trunk/
    [dyaw@localhost trunk]$ touch dummyMigrationFile
    [dyaw@localhost trunk]$ svn add dummyMigrationFile
    A         dummyMigrationFile
    [dyaw@localhost trunk]$ svn ci -m "Added directory structure and dummy file"
    Adding         .
    Adding         dummyMigrationFile
    Transmitting file data .done
    Committing transaction...
    Committed revision 1.
    [dyaw@localhost trunk]$ cd ../..
    [dyaw@localhost v4]$ mkdir svngit ; cd svngit
    [dyaw@localhost svngit]$ git svn init svn://server/emptyRepo --stdlayout
    Initialized empty Git repository in /home/dyaw/stackoverflow/v4/svngit/.git/
    [dyaw@localhost svngit]$ git svn fetch
            A       dummyMigrationFile
    r1 = a934fa2864bd46f0090c2cdf486c924ceb09fb52 (refs/remotes/origin/trunk)
    Checked out HEAD:
      svn://svn1/Data/00000999-migrate/trunk r1
    [dyaw@localhost svngit]$ git config receive.denyCurrentBranch ignore
    [dyaw@localhost svngit]$ cd ..
    [dyaw@localhost v4]$ git clone /mnt/sharedDrive/sharedRepo/ plaingit
    Cloning into 'plaingit'...
    done.
    [dyaw@localhost v4]$ cd plaingit/
    [dyaw@localhost plaingit]$ git remote add svntest /home/dyaw/stackoverflow/v4/svngit
    [dyaw@localhost plaingit]$ git branch -a | grep remotes/origin | grep -v -- '->' | cut -d/ -f3 | xargs -L1 git checkout
    Branch 'Foo' set up to track remote branch 'Foo' from 'origin'.
    Switched to a new branch 'Foo'
    Switched to branch 'master'
    Your branch is up to date with 'origin/master'.
    [dyaw@localhost plaingit]$ git push svntest --all
    Enumerating objects: 2719, done.
    Counting objects: 100% (2719/2719), done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (2591/2591), done.
    Writing objects: 100% (2719/2719), 4.67 MiB | 18.62 MiB/s, done.
    Total 2719 (delta 2011), reused 237 (delta 123)
    remote: Resolving deltas: 100% (2011/2011), done.
    To /home/dyaw/stackoverflow/v4/svngit
     * [new branch]      Foo -> Foo
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to '/home/dyaw/stackoverflow/v4/svngit'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    [dyaw@localhost plaingit]$ git pull svntest master --allow-unrelated-histories --no-edit
    remote: Enumerating objects: 3, done.
    remote: Counting objects: 100% (3/3), done.
    remote: Total 3 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (3/3), done.
    From /home/dyaw/stackoverflow/v4/svngit
     * branch            master     -> FETCH_HEAD
     * [new branch]      master     -> svntest/master
    Merge made by the 'recursive' strategy.
     dummyMigrationFile | 0
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 dummyMigrationFile
    [dyaw@localhost plaingit]$ git push svntest --all
    Enumerating objects: 593, done.
    Counting objects: 100% (593/593), done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (552/552), done.
    Writing objects: 100% (552/552), 4.05 MiB | 19.00 MiB/s, done.
    Total 552 (delta 417), reused 0 (delta 0)
    remote: Resolving deltas: 100% (417/417), completed with 30 local objects.
    To /home/dyaw/stackoverflow/v4/svngit
       a934fa2..127ed95  master -> master
    [dyaw@localhost plaingit]$ git push svntest --tags
    Enumerating objects: 8, done.
    Counting objects: 100% (8/8), done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (8/8), done.
    Writing objects: 100% (8/8), 1.32 KiB | 1.32 MiB/s, done.
    Total 8 (delta 0), reused 0 (delta 0)
    To /home/dyaw/stackoverflow/v4/svngit
     * [new tag]         Lots of tags
    [dyaw@localhost plaingit]$ cd ../svngit/
    [dyaw@localhost svngit]$ git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
            deleted:    All the files that were in the original git
    
    [dyaw@localhost svngit]$ git reset --hard
    HEAD is now at 127ed95 Merge branch 'master' of /home/dyaw/stackoverflow/v4/svngit
    [dyaw@localhost svngit]$ git status
    On branch master
    nothing to commit, working tree clean
    [dyaw@localhost svngit]$ git svn dcommit
    Unable to determine upstream SVN information from HEAD history.
    Perhaps the repository is empty. at /usr/libexec/git-core/git-svn line 872.
    
    [dyaw@localhost svngit]$ ll
    total 4128
    -rw-r--r--. 1 dyaw domain users       0 Aug 12 12:47 dummyMigrationFile
    -rw-r--r--. 1 dyaw domain users     553 Aug 12 12:48 All the files of the original git
    [dyaw@localhost svngit]$ git log | head -n 20
    commit 127ed959dd48230e100b24878014b290f795d298
    Merge: 3161afd a934fa2
    Author: David Yaw <dyaw@localhost>
    Date:   Wed Aug 12 12:47:49 2020 -0400
    
        Merge branch 'master' of /home/dyaw/stackoverflow/v4/svngit
    
    commit a934fa2864bd46f0090c2cdf486c924ceb09fb52
    Author: (no author) <(no author)@057915ec-d7cd-45ea-bdf3-a57c6415ee48>
    Date:   Wed Aug 12 16:13:26 2020 +0000
    
        Added directory structure and dummy file
    
        git-svn-id: svn://server/emptyRepo/trunk@1 057915ec-d7cd-45ea-bdf3-a57c6415ee48
    
    commit 3161afdcb9272a6b047725ccbd1f125b973c7d68
    Author: someone else
    Date:   Mon May 11 10:10:26 2020 -0400
    
        This is the last commit on master of the original git repo
    [dyaw@localhost svngit]$
    
    [dyaw@localhostv4]$svn公司svn://server/emptyRepo svn
    已签出修订版0。
    [dyaw@localhostv4]$cd svn
    [dyaw@localhostsvn]$mkdir中继标记分支
    [dyaw@localhostsvn]$svn添加中继标记分支
    树干
    A标签
    树枝
    [dyaw@localhostsvn]$cd中继/
    [dyaw@localhosttrunk]$touch dummyMigrationFile
    [dyaw@localhosttrunk]$svn添加dummyMigrationFile
    dummyMigrationFile
    [dyaw@localhosttrunk]$svn ci-m“添加了目录结构和虚拟文件”
    添加。
    添加dummyMigrationFile
    传输文件数据。完成
    正在提交事务。。。
    承诺修订1。
    [dyaw@localhosttrunk]$cd../。。
    [dyaw@localhostv4]$mkdir svngit;cd svngit
    [dyaw@localhostsvngit]$git svn initsvn://server/emptyRepo --标准布局
    已在/home/dyaw/stackoverflow/v4/svngit/.Git中初始化空Git存储库/
    [dyaw@localhostsvngit]$git svn fetch
    dummyMigrationFile
    r1=a934fa2864bd46f0090c2cdf486c924ceb09fb52(参考/遥控/原点/中继)
    结帐户主:
    svn://svn1/Data/00000999-migrate/trunk r1
    [dyaw@localhostsvngit]$git config receive.denyCurrentBranch ignore
    [dyaw@localhostsvngit]$cd。。
    [dyaw@localhostv4]$git clone/mnt/sharedDrive/sharedepo/plaingit
    克隆到“plaingit”。。。
    完成。
    [dyaw@localhostv4]$cd普朗吉特/
    [dyaw@localhostplaingit]$git远程添加svntest/home/dyaw/stackoverflow/v4/svngit
    [dyaw@localhostplaingit]$git branch-a | grep remotes/origin | grep-v--'->'| cut-d/-f3 | xargs-L1 git签出
    分支“Foo”设置为从“源”跟踪远程分支“Foo”。
    切换到新的分支“Foo”
    切换到“主”分支
    您的分支机构是最新的“来源/主”。
    [dyaw@localhostplaingit]$git推送svntest--全部
    枚举对象:2719,完成。
    计数对象:100%(2719/2719),完成。
    增量压缩最多使用8个线程。
    压缩对象:100%(2591/2591),完成。
    写入对象:100%(2719/2719),4.67 MiB | 18.62 MiB/s,完成。
    总计2719(delta 2011),重复使用237(delta 123)
    远程:解析增量:100%(2011/2011),完成。
    To/home/dyaw/stackoverflow/v4/svngit
    *[新分行]Foo->Foo
    ! [已拒绝]主控->主控(先取)
    错误:无法将某些引用推送到“/home/dyaw/stackoverflow/v4/svngit”
    提示:更新被拒绝,因为远程包含您所做的工作
    提示:本地没有。这通常是由另一个存储库推送引起的
    提示:指向同一引用。您可能希望首先集成远程更改
    提示:(例如,“git pull…”)然后再推。
    提示:有关详细信息,请参阅“git push--help”中的“关于快进的说明”。
    [dyaw@localhostplaingit]$git pull svntest master--允许不相关的历史记录--无需编辑
    远程:枚举对象:3,完成。
    远程:计数对象:100%(3/3),完成。
    远程:总计3(增量0),重复使用0(增量0)
    拆包对象:100%(3/3),完成。
    From/home/dyaw/stackoverflow/v4/svngit
    *分支主控->取头
    *[新分支机构]主机->svntest/master
    通过“递归”进行的合并
    
    [dyaw@localhost svngit]$ git svn fetch
    r1 = 81aad897c91af332c969ece7655a86f8f670bfec (refs/remotes/origin/trunk)
    Checked out HEAD:
      svn://server/basicRepo/trunk r1
    
    [dyaw@localhost v4]$ svn co svn://server/emptyRepo svn
    Checked out revision 0.
    [dyaw@localhost v4]$ cd svn
    [dyaw@localhost svn]$ mkdir trunk tags branches
    [dyaw@localhost svn]$ svn add trunk tags branches
    A         trunk
    A         tags
    A         branches
    [dyaw@localhost svn]$ cd trunk/
    [dyaw@localhost trunk]$ touch dummyMigrationFile
    [dyaw@localhost trunk]$ svn add dummyMigrationFile
    A         dummyMigrationFile
    [dyaw@localhost trunk]$ svn ci -m "Added directory structure and dummy file"
    Adding         .
    Adding         dummyMigrationFile
    Transmitting file data .done
    Committing transaction...
    Committed revision 1.
    [dyaw@localhost trunk]$ cd ../..
    [dyaw@localhost v4]$ mkdir svngit ; cd svngit
    [dyaw@localhost svngit]$ git svn init svn://server/emptyRepo --stdlayout
    Initialized empty Git repository in /home/dyaw/stackoverflow/v4/svngit/.git/
    [dyaw@localhost svngit]$ git svn fetch
            A       dummyMigrationFile
    r1 = a934fa2864bd46f0090c2cdf486c924ceb09fb52 (refs/remotes/origin/trunk)
    Checked out HEAD:
      svn://svn1/Data/00000999-migrate/trunk r1
    [dyaw@localhost svngit]$ git config receive.denyCurrentBranch ignore
    [dyaw@localhost svngit]$ cd ..
    [dyaw@localhost v4]$ git clone /mnt/sharedDrive/sharedRepo/ plaingit
    Cloning into 'plaingit'...
    done.
    [dyaw@localhost v4]$ cd plaingit/
    [dyaw@localhost plaingit]$ git remote add svntest /home/dyaw/stackoverflow/v4/svngit
    [dyaw@localhost plaingit]$ git branch -a | grep remotes/origin | grep -v -- '->' | cut -d/ -f3 | xargs -L1 git checkout
    Branch 'Foo' set up to track remote branch 'Foo' from 'origin'.
    Switched to a new branch 'Foo'
    Switched to branch 'master'
    Your branch is up to date with 'origin/master'.
    [dyaw@localhost plaingit]$ git push svntest --all
    Enumerating objects: 2719, done.
    Counting objects: 100% (2719/2719), done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (2591/2591), done.
    Writing objects: 100% (2719/2719), 4.67 MiB | 18.62 MiB/s, done.
    Total 2719 (delta 2011), reused 237 (delta 123)
    remote: Resolving deltas: 100% (2011/2011), done.
    To /home/dyaw/stackoverflow/v4/svngit
     * [new branch]      Foo -> Foo
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to '/home/dyaw/stackoverflow/v4/svngit'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    [dyaw@localhost plaingit]$ git pull svntest master --allow-unrelated-histories --no-edit
    remote: Enumerating objects: 3, done.
    remote: Counting objects: 100% (3/3), done.
    remote: Total 3 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (3/3), done.
    From /home/dyaw/stackoverflow/v4/svngit
     * branch            master     -> FETCH_HEAD
     * [new branch]      master     -> svntest/master
    Merge made by the 'recursive' strategy.
     dummyMigrationFile | 0
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 dummyMigrationFile
    [dyaw@localhost plaingit]$ git push svntest --all
    Enumerating objects: 593, done.
    Counting objects: 100% (593/593), done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (552/552), done.
    Writing objects: 100% (552/552), 4.05 MiB | 19.00 MiB/s, done.
    Total 552 (delta 417), reused 0 (delta 0)
    remote: Resolving deltas: 100% (417/417), completed with 30 local objects.
    To /home/dyaw/stackoverflow/v4/svngit
       a934fa2..127ed95  master -> master
    [dyaw@localhost plaingit]$ git push svntest --tags
    Enumerating objects: 8, done.
    Counting objects: 100% (8/8), done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (8/8), done.
    Writing objects: 100% (8/8), 1.32 KiB | 1.32 MiB/s, done.
    Total 8 (delta 0), reused 0 (delta 0)
    To /home/dyaw/stackoverflow/v4/svngit
     * [new tag]         Lots of tags
    [dyaw@localhost plaingit]$ cd ../svngit/
    [dyaw@localhost svngit]$ git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
            deleted:    All the files that were in the original git
    
    [dyaw@localhost svngit]$ git reset --hard
    HEAD is now at 127ed95 Merge branch 'master' of /home/dyaw/stackoverflow/v4/svngit
    [dyaw@localhost svngit]$ git status
    On branch master
    nothing to commit, working tree clean
    [dyaw@localhost svngit]$ git svn dcommit
    Unable to determine upstream SVN information from HEAD history.
    Perhaps the repository is empty. at /usr/libexec/git-core/git-svn line 872.
    
    [dyaw@localhost svngit]$ ll
    total 4128
    -rw-r--r--. 1 dyaw domain users       0 Aug 12 12:47 dummyMigrationFile
    -rw-r--r--. 1 dyaw domain users     553 Aug 12 12:48 All the files of the original git
    [dyaw@localhost svngit]$ git log | head -n 20
    commit 127ed959dd48230e100b24878014b290f795d298
    Merge: 3161afd a934fa2
    Author: David Yaw <dyaw@localhost>
    Date:   Wed Aug 12 12:47:49 2020 -0400
    
        Merge branch 'master' of /home/dyaw/stackoverflow/v4/svngit
    
    commit a934fa2864bd46f0090c2cdf486c924ceb09fb52
    Author: (no author) <(no author)@057915ec-d7cd-45ea-bdf3-a57c6415ee48>
    Date:   Wed Aug 12 16:13:26 2020 +0000
    
        Added directory structure and dummy file
    
        git-svn-id: svn://server/emptyRepo/trunk@1 057915ec-d7cd-45ea-bdf3-a57c6415ee48
    
    commit 3161afdcb9272a6b047725ccbd1f125b973c7d68
    Author: someone else
    Date:   Mon May 11 10:10:26 2020 -0400
    
        This is the last commit on master of the original git repo
    [dyaw@localhost svngit]$