简体   繁体   English

使用reposurgeon将svn repo转换为Git时,如何跳过前N个提交?

[英]How to skip first N commits when converting svn repo to Git using reposurgeon?

How do I skip the first two commits of a subversion repository when converting it to Git using reposurgeon? 使用reposurgeon将Subversion版本库转换为Git时,如何跳过前两个版本的提交?

The first svn commit imported code using the wrong branch layout ( trunk , tags , branches ) and the second commit deleted all of it. 第一次svn提交使用错误的分支布局( trunktagsbranches )导入的代码,第二次提交删除了所有代码。

The third commit was an import to the correct branch layout ( subdir/trunk , subdir/tags , subdir/branches ). 第三次提交是导入正确的分支布局( subdir/trunksubdir/tagssubdir/branches )。

This false start seems to confuse reposurgeon, because the resulting Git repository only has a single commit: the initial false start. 错误的开始似乎会使reposurgeon感到困惑,因为生成的Git存储库只有一个提交:初始的错误开始。 All later commits are ignored. 以后的所有提交都将被忽略。

Here's what I tried: 这是我尝试过的:

# installed reposurgeon 3.29
mkdir foo
cd foo
repotool initialize foo svn git
# edited the Makefile and set REMOTE_URL
make stubmap
# edited the resulting authors map (foo.map)
echo "1..2 delete" >>foo.lift
make

Im not familiar with reposurgeon bot if you clone from the command line you can specify the number of commits you wish to clone + the name of the name of the branch which you wish to clone. 我不熟悉reposurgeon bot,如果您从命令行进行克隆,则可以指定要克隆的提交数+要克隆的分支名称的名称。

// Clona last X commits of branchA
git clone ... --depth=X --branch=branchA

Now you can add this repository to your reposurgeon server 现在您可以将此存储库添加到您的reposurgeon服务器

Use the following to delete the first two svn commits: 使用以下命令删除前两个svn提交:

<1>..<2> delete

This line means "select the commits from legacy ID 1 to legacy ID 2 (inclusive) and delete them". 该行表示“选择从旧版ID 1到旧版ID 2 (含)的提交并删除它们”。 Alternatively, you can use this syntax: 另外,您可以使用以下语法:

<#1>..<#2> delete

This means "select the commits from the first commit to the second (inclusive) and delete them". 这意味着“选择从第一次提交到第二个(包括)的提交并删除它们”。 This syntax works with non-svn input repositories. 此语法适用于非svn输入存储库。 Be careful—commit #2 might not be a child of commit #1 (eg, they might be two root commits from a Git repository). 注意,提交#2可能不是提交#1的子对象(例如,它们可能是Git存储库中的两个根提交)。

The 1..2 selector means "select the events from the first to the second (inclusive) and delete them". 1..2选择器的意思是“从第一个到第二个(包括第二个)选择事件并删除它们”。 Events are not the same as commits—events include blobs (files), tags, resets, etc. Because blob events must appear before the commits that refer to them, 1..2 is likely to select blobs, not commits. 事件与提交不同,事件包括Blob(文件),标签,重置等。由于Blob事件必须出现在引用它们的提交之前,因此1..2可能会选择Blob,而不是提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM