-->

How to migrate from RTC Jazz to Git?

2020-05-19 11:53发布

问题:

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.

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).

What will be the best way to migrate our source code and change history from RTC jazz to Git?

回答1:

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.

The script can be found here: https://github.com/rtcTo/rtc2git

Some details how the program works - Its based on the RTC CLI.

  1. It inits an empty git repository clones it and in there it creates a workspace based on your oldest stream.
  2. For a given stream, given by a config file, it reads the baselines of the component.
  3. 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)
  4. The output of the compare will be parsed to get to the necessary informations (author, comment, date etc..)
  5. The change will be accepted in the workspace and shortly after the corresponding git command will be executed to do the same in 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).

EDIT: I consider the current version of the program as stable. So give it a try. :) I welcome any feedback.



回答2:

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.

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.

The import takes advantage of the --git-dir and --work-tree options of the git command.
(As illustrated in this answer or this one)

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.

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.



回答3:

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.

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.

Link to Bitbucket

It did it's job and maybe it can help you as well.

Ralf