git svn在非标准svn存储库布局上指定分支和标记

git svn在非标准svn存储库布局上指定分支和标记,git,svn,git-svn,Git,Svn,Git Svn,布局如下: Branches\ Project1/ Branch11/ ... Branch1N/ Project2/ Branch21/ ProjectX/ # not anywhere else Excluded1\ Excluded2\ Excluded3\ Excluded4\ Programs\ Excluded11\ ... Excluded1N\ Projec

布局如下:

Branches\
    Project1/
        Branch11/
        ...
        Branch1N/
    Project2/
        Branch21/
    ProjectX/   # not anywhere else
Excluded1\
Excluded2\
Excluded3\
Excluded4\
Programs\
    Excluded11\
    ...
    Excluded1N\
    Project1/   # the main one
    Project2/
    ...
    ProjectN/
Tags\
    Project1/
        Release1/
        ...
        Release69/
排除我设法排除-但我完全无法理解如何将分支/标记映射到git分支/标记-最好是在事实发生之后(每个克隆需要约5个小时)

请记住我是SVN的新手-我不知道也不了解分支/标记系统

我在windoz上-svn2git是没有选择的(无论如何,我对我在克隆后如何做这件事感兴趣,或者更糟的是,再次克隆,但只使用vanilla git)
此外,我并不打算将其作为永久迁移,它将作为SVN和开发中使用的新git repo之间的桥梁——因此我希望保留尽可能多的信息——但不超过需要。在某种程度上,它可能会成为永久性的——我想,在这之后,我需要过滤掉(对排除的项目)的空提交(?)

命令:

$git svn clone--ignore path=“^(?:Releases | Projects | Scripts | Games |)/Programs/(?:Nif Scanner | Nif Viewer | Raziel23x的遗忘工具集| Shader Disasm | Shader Editor)/”--authors file=authors_with|emails.txtsvn://svn.code.sf.net/p/oblivionworks/code/

克隆后,我有:

$ git branch -r
  git-svn
$ git branch
* master

重述:我已经排除了我想排除的内容-现在我想对git说“为每个svn分支创建一个git分支-一个真正的git分支,它计算增量并压缩它们,删除文件夹
分支
-并跟踪它们-这(700 mb)标签目录只是标签-对此您能做些什么(它们不对应于提交)?“
我看不到邪恶的树干

我的
配置

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[svn-remote "svn"]
    ignore-paths = ^(?:Releases|Projects|Scripts|Games|)/|^Programs/(?:Nif Scanner|Nif Viewer|Raziel23x's Oblivion Toolset|Shader Disasm|Shader Editor)/
    url = svn://svn.code.sf.net/p/oblivionworks/code
    fetch = :refs/remotes/git-svn
[svn]
    authorsfile = authors_with_emails.txt
[gui]
    wmstate = zoomed
    geometry = 787x377+54+59 305 1127
[remote "github"]
    url = https://github.com/Utumno/wrye_bash_refactoring.git
    fetch = +refs/heads/*:refs/remotes/github/*
[branch "master"]
    remote = github
    merge = refs/heads/master
对于分支机构:

在git配置文件中,您可以控制svn分支的位置:

[svn-remote "svn"]
url = file:///some.url.to/svn/dir
fetch = trunk:refs/remotes/trunk
branches = Branches/*/*:refs/remotes/*
因此,您可以设置对分支的不同引用

好的,那么你也可以对标签做同样的事情——因为在svn中,标签和分支非常相似

branches = Tags/*:refs/remotes/*
但是您想要“真正的”git标记,没问题,一旦您将它们作为分支引用,您可以再次修改git repo以获得良好的git标记引用:

git-for-each-ref refs/remotes/origin/tags | cut -d / -f 5- |
while read ref
do
git tag -a "$ref" -m"say farewell to SVN" "refs/remotes/origin/tags/$ref"
git push origin ":refs/heads/tags/$ref"
git push origin tag "$ref"
done

显然,出于您的目的,您需要稍微修改这些脚本。

我最近做了类似的事情

首先,我不知道你为什么要在从svn迁移到git之后重新安排一切。我怀疑这是可能的

其次,如果没有svn2git,我不会梦想这样做。我不确定您所指的Windows问题是什么——svn2git是用Ruby编写的。如果可以避免的话,我不会使用Windows,但肯定有一个适用于Windows的Ruby实现,通过Cygwin实现,如果没有其他功能的话

第三,这是关键,在转换之前,我使用svndumpfilter以我想要的方式(即,以svn2git乐于使用的形式)获得svn回购。这需要一些尝试和错误,但最终效果非常好

有关更多信息,请参阅和(调整SVN版本的链接)

编辑:我本想对此发表评论的,但它太长了。我认为你能做的最好的事情是:

[svn-remote "svn"]
    ignore-paths = ^(?:Releases|Projects|Scripts|Games|)/|^Programs/(?:Nif Scanner|Nif Viewer|Raziel23x's Oblivion Toolset|Shader Disasm|Shader Editor)/
    url = svn://svn.code.sf.net/p/oblivionworks/code
    fetch = Programs/Wrye Bash:refs/remotes/git-svn/Wrye Bash
    branches = Branches/Wrye Bash/*:refs/remotes/git-svn/Wrye Bash/branches/*
    fetch = Programs/Skyrim Viewer:refs/remotes/git-svn/Skyrim Viewer
    fetch = Programs/CBash:refs/remotes/git-svn/CBash
    branches = Branches/CBash/*:refs/remotes/git-svn/CBash/branches/*
# etc.
也就是说,一个
获取
,如果适用,一个
为您感兴趣的每个程序分支
行。与链接到的答案一样,在再次执行
git svn fetch
之前,必须清除
.git/svn/.metadata
文件


但这并没有影响我之前的评论:您的git历史仍然是完全线性的,并没有反映项目的实际分支和合并历史。如果您将此作为永久迁移,这将不是您想要的。

将尽快尝试这些脚本-同时您能否解释一下脚本的实际功能-尤其是
[svn remote“svn”]
?他们所指的行李箱是什么?这会让“分支”被压缩到git数据库中并从我的脸上消失吗?如果你看一下实际的回购协议,并提供一些示例代码,这会有所帮助(至少对我是这样)。您还需要对我不理解的映射的逻辑进行详细说明—问题是repo的结构。添加了ConfigAlway-没有主干-您没有解决创建git分支的问题-真正的git分支知道它们只是delta-因此
分支/Project1/Branch11/
应该知道它是
程序/Project1/
[svn remote“svn”中文件的分支url=svn://svn.code.sf.net/p/oblivionworks/code fetch=:refs/remotes/git svn branchs=branchs/*/*/*:refs/remotes/*
然后
rm.git/svn/.metadata
然后
git svn fetch
现在我将这些分支作为远程分支展开-我该从这里走到哪里<代码>$git branch-a*主远程/git svn remotes/github/master remotes/svn branchs/CBash/dev sharlikran remotes/svn branchs/Wrye%20Bash/291修复程序#。。。远程/svn分支/Wrye%20Flash/Fallout%203远程/svn分支/Wrye%20Flash/Fallout%20NV您现在可以从本地存储库分支跟踪这些分支(记住git是分布式的)。因此,根据分支的输出,诸如git checkout--track-b Fallout3 svn branchs/branchs/Wrye%20Flash/Fallout%203之类的命令被称为svn branchs。这也意味着您希望在以前的配置中使用
[svn remote“svn branchs”]
。因此,我必须在配置中创建一个新的部分吗?还有没有一种简单的方法可以签出每个远程分支的本地分支并在其上运行
git svn rebase
?据我所知,这是我必须做的。这个“根”会把我的树枝插回树上吗?另请参见-在
获取期间
是否找到了可能的分支点
报告?请更新一下你的答案-我很乐意接受,但它仍然缺乏信息谢谢你,但3不是一个选项-我说svn2git不是一个选项-毕竟不是核物理-必须有一种方法可以在git单独完成。但是我想要一些