Git-svn - 导入完整的历史记录 [英] Git-svn - import full history
问题描述
默认情况下,git svn clone 仅从分支创建向前导入历史记录,在创建分支之前,文件的历史记录存在于svn存储库中。
我们的svn分支是由 svn copy
创建的,如果有问题的话。
我的尝试
$ c> - no-minimize-url 和 - follow-parent
,但没有成功。生成的git仓库与没有这些参数相同,从分支创建开始。
预期结果
具有svn仓库创建完整历史记录的Git仓库。
更新我的实际命令行是 git svn克隆http:// svnserver / repo / dir1 / dir2 / project
。
什么帮助了-T参数与结果命令一起
git svn克隆http:// svnserver / repo / -T dir1 / dir2 / project
非常感谢!
默认情况下,git svn clone仅从分支创建
开始导入历史记录,尽管事实是,在创建分支之前,文件的历史记录存在于svn
存储库中。
是的。那是真实的。如果被告知的话, git svn
只会尝试将分支导入分支。从git-svn的手册页:
在克隆SVN存储库时,如果没有任何用于描述
存储库布局的选项(--trunk,--tags, - branch,
--stdlayout),git svn clone会创建一个完全线性历史的git仓库,其中分支和标签显示为单独的
目录工作副本。
如果您将一个分支的URL传递给 git svn clone $ c $ (而不是顶级URL),则只会获得该分支的线性历史记录。这可能是你看到的。
如果你想要完整的历史记录,可以使用上面提到的存储库布局选项,并传递顶级URL。然后 git svn
会尝试为SVN分支创建git分支,并且会尝试给它们提供正确的历史记录,然后再创建它们。
请注意,这将为您提供包含所有分支的完整存储库。如果您只想要一些分支,您需要按照手册页中的说明修改配置:
也可以获取子集分支或标记,方法是在花括号中使用
逗号分隔的名称列表。例如:
[svn-remotehuge-project]
url = http://server.org / svn
fetch = trunk / src:refs / remotes / trunk
branches = branches / {red,green} / src:refs / remotes / branches / * $ b $ tags = tags / {1.0 ,2.0} / src:refs / remotes / tags / *
请参阅 git-svn(1)。
Problem
By default git svn clone imports history only from branch creation onwards, despite the fact, that history for files is present in svn repository prior branch creation.
Our svn branch was created by svn copy
, if that matters.
My attempts
I've tried --no-minimize-url
and --follow-parent
, but without success. Produced git repository is same as without these params, starting from branch creation.
Desired result
Git repository with full history from svn repository creation.
Update
My actual command line was git svn clone http://svnserver/repo/dir1/dir2/project
.
What helped was -T argument with resulting command
git svn clone http://svnserver/repo/ -T dir1/dir2/project
Many thanks !
By default git svn clone imports history only from branch creation onwards, despite the fact, that history for files is present in svn repository prior branch creation.
Yes. that is true. git svn
will only try to import branches as branches if it is told so. From the manpage of git-svn:
When cloning an SVN repository, if none of the options for describing the repository layout is used (--trunk, --tags, --branches, --stdlayout), git svn clone will create a git repository with completely linear history, where branches and tags appear as separate directories in the working copy.
If you pass the URL for one branch to git svn clone
(instead of the top-level URL), you'll only get the linear history for that branch. That is probably what you are seeing.
If you want full history, use the repository layout options mentioned above, and pass the top-level URL. Then git svn
will try to create git branches for SVN branches, and will try to give them the right history, going back before their creation.
Note that this will give you the complete repository with all branches. If you only want some branches, you need to modify your configuration as explained in the manpage:
It is also possible to fetch a subset of branches or tags by using a comma-separated list of names within braces. For example:
[svn-remote "huge-project"] url = http://server.org/svn fetch = trunk/src:refs/remotes/trunk branches = branches/{red,green}/src:refs/remotes/branches/* tags = tags/{1.0,2.0}/src:refs/remotes/tags/*
See git-svn(1).
这篇关于Git-svn - 导入完整的历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!