如何从 RTC Jazz 迁移到 Git?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23928927/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to migrate from RTC Jazz to Git?
提问by Ido.Co
My team was forced to migrate from SVN to the RTC Jazz scm about a year ago. since we are very unhappy with RTC we have decided to abandon it and switch over to Git for version-control.
大约一年前,我的团队被迫从 SVN 迁移到 RTC Jazz scm。由于我们对 RTC 非常不满意,我们决定放弃它并切换到 Git 进行版本控制。
I haven't found a lot of info about migrating out of RTC in general, but I did find this Rational Adapter for Git(that I'm not sure can be used for this kind of migration).
我还没有找到很多关于从 RTC 迁移出来的一般信息,但我确实找到了这个Rational Adapter for Git(我不确定是否可以用于这种迁移)。
What will be the best way to migrate our source code and change history from RTC jazz to Git?
迁移我们的源代码并将历史从 RTC jazz 更改为 Git 的最佳方法是什么?
回答by Joker
Since we run into the same issue and we wanted to keep our history we started to create a python script, which automates the process to migrate RTC SCM Stream by Stream to GIT.
由于我们遇到了同样的问题并且我们想保留我们的历史记录,因此我们开始创建一个 python 脚本,它可以自动执行将 RTC SCM Stream 逐流迁移到 GIT 的过程。
The script can be found here: https://github.com/rtcTo/rtc2git
该脚本可以在这里找到:https: //github.com/rtcTo/rtc2git
Some details how the program works - Its based on the RTC CLI.
程序如何工作的一些细节 - 它基于 RTC CLI。
- It inits an empty git repository clones it and in there it creates a workspace based on your oldest stream.
- For a given stream, given by a config file, it reads the baselines of the component.
- For each baseline of this component a compare command will be executed (to see all diffs, sadly comparing directly with latest stream throws an exception @RTC Version 5.0.1)
- The output of the compare will be parsed to get to the necessary informations (author, comment, date etc..)
- The change will be accepted in the workspace and shortly after the corresponding git command will be executed to do the same in git
- 它初始化一个空的 git 存储库,克隆它,并在那里根据您最旧的流创建一个工作区。
- 对于由配置文件给出的给定流,它读取组件的基线。
- 对于此组件的每个基线,将执行一个比较命令(要查看所有差异,遗憾的是直接与最新流进行比较会引发异常 @RTC 版本 5.0.1)
- 比较的输出将被解析以获得必要的信息(作者、评论、日期等)。
- 更改将在工作区中被接受,并在执行相应的 git 命令以在 git 中执行相同操作后不久
For each stream a branch will be created
将为每个流创建一个分支
Basically that's it. If you want I can also provide some sample commands, which have helped me to get to the necessary information (information is quiet rare on specific stuff regarding RTC CLI).
基本上就是这样。如果您愿意,我还可以提供一些示例命令,它们帮助我获取必要的信息(关于 RTC CLI 的特定内容的信息很少)。
EDIT: I consider the current version of the program as stable. So give it a try. :) I welcome any feedback.
编辑:我认为该程序的当前版本是稳定的。所以试试吧。:) 我欢迎任何反馈。
回答by VonC
I have tested the adapter, and I confirm it is not for migration. It is for linking a git commit with an RTC change set.
我已经测试了适配器,我确认它不用于迁移。它用于将 git commit 与 RTC 更改集链接起来。
The migration itself is limited, and would involve only the source control part, not the work items or the builds.
迁移本身是有限的,并且只涉及源代码控制部分,而不涉及工作项或构建。
I usually set a repo workspace to the last few baselines and import them into a git working tree. I don't import the author names though.
我通常将 repo 工作区设置为最后几个基线并将它们导入到 git 工作树中。不过,我不导入作者姓名。
The import takes advantage of the --git-dir
and --work-tree
options of the git
command.
(As illustrated in this answeror this one)
导入利用了命令的--git-dir
和--work-tree
选项。
(如this answer或this one所示)git
You can type from anywhere:
您可以从任何地方输入:
git --work-tree=/path/to/sandbox --git-dir=/path/to/repo/.git status|add|...
Try a status first, to see what you will import. You might add to the /path/to/repo/.git/exclude
file some pattern to exclude from the import elements you don't want (like the .jazz5
folder!).
Of course, /path/to/sandbox
can be any sub-folder within that sandbox: you don't have to import everything.
首先尝试一个状态,看看你将导入什么。您可以向/path/to/repo/.git/exclude
文件中添加一些模式以从您不想要的导入元素(如.jazz5
文件夹!)中排除。
当然,/path/to/sandbox
可以是该沙箱中的任何子文件夹:您不必导入所有内容。
Repeat that process with the same sandbox, updated with different baselines/snapshots, from the oldest to the newest.
使用相同的沙箱重复该过程,使用不同的基线/快照更新,从最旧到最新。
That give a crude history, which is enough to start.
这给出了一个粗略的历史,这足以开始。
回答by Hennes
I had the same job, namely to convert an entire stream with several components into separate git repositories. After giving the above mentioned python script a try, I found it too complicated (e.g. selecting all the URLs in eclipse for creating history-files, searching the baselines, etc) and not reliable at all. At least not for components with over 4000 change sets.
我有同样的工作,即将包含多个组件的整个流转换为单独的 git 存储库。在尝试了上面提到的python 脚本之后,我发现它太复杂了(例如,在eclipse 中选择所有URL 来创建历史文件、搜索基线等)并且根本不可靠。至少对于具有超过 4000 个变更集的组件而言不是这样。
So I wrote another script in Perl, which works nearly out of the box, at least on Windows 7.0. The script includes a lot of workarounds for all those bugs in scm, so you don't have to bother with it.
所以我用 Perl 编写了另一个脚本,它几乎是开箱即用的,至少在 Windows 7.0 上是这样。该脚本包含许多针对 scm 中所有这些错误的变通方法,因此您不必理会它。
It did it's job and maybe it can help you as well.
它完成了它的工作,也许它也可以帮助你。
Ralf
拉尔夫