git svn在非标准svn存储库布局上指定分支和标签 [英] git svn specify branches and tags on a non standard svn repository layout
问题描述
分支\
Project1 /
Branch11 /
...
Branch1N /
Project2 /
Branch21 /
ProjectX /#不在其他地方
排除1 \
排除2 \
排除3 \
排除4 \
程序\
排除11 \
...
排除1N\
Project1 /#主要
Project2 /
...
ProjectN /
标签\
Project1 /
Release1 /
...
Release69 /
排除我设法排除 - 但我完全无法理解,我怎么能将分支/标签映射到git分支/标签 - 最好在事实之后(每个克隆花费大约5个小时)。
请注意,我是SVN的新手 - 我知道不是也不理解分支/标记系统。我在 windoz - svn2git是无法选择的(无论如何,我在感兴趣的是我是如何在克隆后执行此操作的,或者是在克隆版本较差的情况下执行此操作,但仅使用了vanilla git )
另外,我不打算将其作为永久迁移,它将作为SVN和dev中使用的新git repo之间的桥梁 - 所以我想尽可能多地保留信息 - 但不超过需要。在某些时候,它可能会变成永久性的 - 我将需要过滤空提交(对排除的项目)我猜(?)
命令:
$ b
$ git svn clone --ignore-paths =^(?:发布|项目|脚本|游戏|)/ | ^程序/(?: Nif Scanner | Nif Viewer | Raziel23x的遗忘工具集| Shader Disasm | Shader Editor)/--authors-file = authors_with_emails.txt svn://svn.code.sf.net/p/oblivionworks/code/。
克隆后,我有:
$ git branch -r
git-svn
$ git branch
* master
rel =nofollow>克隆了这个东西,不包括我想排除的东西 - 现在我想对git说为每个svn创建一个git分支分支 - 一个真正的git分支,计算增量并压缩它们并删除文件夹分支
- 并跟踪它们 - 而这个(700 mb)标签目录就是标签 - 你做了这些事情(他们做了 not 对应于提交)?
我看不到 evil trunk
我的配置
:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[svn-remotesvn]
ignore-paths = ^(?:发布|项目|脚本|游戏|)/ | ^程序/(?: Nif扫描仪| Nif Viewer | Raziel23x的遗忘工具集| 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 =缩放
几何= 787x377 + 54 + 5 9 305 1127
[remotegithub]
url = https://github.com/Utumno/wrye_bash_refactoring.git
fetch = + refs / heads / *:refs / remotes / github / *
[branchmaster]
remote = github
merge = refs / heads / master
对于分支:
在你的git配置文件中,你可以控制svn分支的位置位于:
[svn-remotesvn]
url = file:///some.url.to / svn / dir
fetch = trunk:refs / remotes / trunk
branches =分支/ * / *:refs / remotes / *
因此,您可以设置不同的分支引用。
好吧,您可以对标签执行相同的操作 - 导致svn,标签和分支是如此相似。
branches = Tags / *:refs / remotes / *
但是你想要真正的git标签,没问题,一旦你将它们引用为分支,你可以再次修改你的git repo来制作好的git标签引用:
git-for-each-ref refs / remotes / origin / tags |剪下-d / -f 5- |
while read ref
do
git tag -a$ ref-m告别SVNrefs / remotes / origin / tags / $ ref
git push原始:refs / heads / tags / $ ref
git push origin tag$ ref
done
显然,您需要稍微修改这些脚本以达到您的目的。
The layout is :
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/
Excluded I managed to exclude - but I am completely unable to understand how can I map branches/tags to git branches/tags - preferably after the fact (each clone takes ~5 hours).
Please bear in mind I am new to SVN - I know not nor do I understand the branching/tagging system.
I am on windoz - svn2git is no option (anyway I am interested in how I do this after the clone or at worse cloning again but with vanilla git only)
Also I do not intend this as a permanent migration, it will function as a bridge between the SVN and the new git repo used in dev - so I want to keep as much info as possible - but no more than needed. At some point it might become permanent - where upon I will need to filter out empty commits (to the excluded projects) I guess (?)
Command :
$ git svn clone --ignore-paths="^(?:Releases|Projects|Scripts|Games|)/|^Programs/(?:Nif Scanner|Nif Viewer|Raziel23x's Oblivion Toolset|Shader Disasm|Shader Editor)/" --authors-file=authors_with_emails.txt svn://svn.code.sf.net/p/oblivionworks/code/ .
After the clone I have :
$ git branch -r
git-svn
$ git branch
* master
Recap : I have cloned the thing excluding what I wanted to exclude - now I want to say to git "create a git branch for each of those svn branches - a real git branch that calculates the deltas and compresses them and deletes the folder Branches
- and track them - and this (700 mb) tags directory is just tags - what could you do about that (they do not correspond to commits) ?"
I see no evil trunk
My config
:
[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
For Branches:
In your git config file you can control where the svn branches are located:
[svn-remote "svn"]
url = file:///some.url.to/svn/dir
fetch = trunk:refs/remotes/trunk
branches = Branches/*/*:refs/remotes/*
So you are able to setup the different references to the branches.
OK so you can do the same for tags - cause in svn, tags and branches are so similar.
branches = Tags/*:refs/remotes/*
But you want "real" git tags, no problem, once you have them referenced as branches, you can modify your git repo again to make good git tag references:
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
Obviously, you will need to slightly modify these scripts for your purposes.
这篇关于git svn在非标准svn存储库布局上指定分支和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!