是否可以将 MKS Integrity 存储库导入 git 中?

发布于 2024-08-02 03:35:38 字数 496 浏览 7 评论 0原文

我只需要源树及其历史记录。 我现在不关心需求/问题。 我用命令行玩了一下,看看是否可以获得主干和一些开发路径的更改包列表。 我认为应该可以为每个更改包提取差异,并使用它来重放自 git 中第一次提交以来的所有更改。 像这样的事情:

  1. 获取第一个提交并将其添加到git
  2. 获取下一个CP
  3. 获取CP的差异
  4. 应用差异到git工作目录
  5. 添加并将更改提交到git
  6. 重复(2.)直到最后一个CP

您还可以用检查点替换更改包(将对我来说足够好)。

一种更简单的方法是仅签出 CP 并添加/提交到 git。 但随后您将无法跟踪添加、删除、移动和重命名操作。

有谁知道如何从“si diff”获得统一差异? 那已经有很大帮助了。

有任何想法吗?

编辑2:
添加了一个答案,显示我实际上是如何进行迁移的......

I need only the source tree and its history. I don't care for the requirements/issues stuff for now. I played a bit with the command line to figure out if I could get a list of change packages for the trunk and some of the dev paths. I thought it should be possible to extract a diff for every change package and use that to replay all the changes since the first commit in git. Something like this:

  1. get first commit and add it to git
  2. get next CP
  3. get diff for CP
  4. apply diff to git working dir
  5. add and commit changes to git
  6. repeat with (2.) until last CP

You could also replace change package with checkpoint (would be good enough for me).

A simpler way would be to just checkout a CP and add/commit to git. But then you would loose track of add, remove, move and rename operations.

Does anyone know how to get a unified diff from "si diff"? That would already help alot.

Any ideas?

Edit2:
Added an answer that shows how I actually did the migration...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

茶花眉 2024-08-09 03:35:38

我无法发布我编写的实际程序,因为我不是在自己的时间里完成的。 不过,我可以发布我是如何做到的。 使用任何脚本语言重做它应该很容易。
我编写的工具一次仅迁移一个分支。 我会告诉它我想要哪个分支(例如1.21.1)以及分支中的开始和结束修订(例如4和78将迁移从1.21.1.4开始到1.21.1.78的所有修订)。 为了将所有分支都放在一个存储库中,我将提供 .git 目录以用于导入。

  • 从开始修订到结束修订开始循环
    • CURRENTREV=BRANCH.loopcounter
    • 创建存储库目录
    • 将 .git 目录移动到 repo 目录
    • 将 .gitignore 文件移至 repo 目录
    • chdir 进入 repo 目录
    • 通过“si createandbox -P MKS_PROJECT_PATH --yes --projectRevision=CURRENTREV”在存储库目录中创建 mks 沙箱
    • 通过“si viewprojecthistory --rfilter=range:CURRENTREV-CURRENTREV”获取修订描述,捕获输出!
    • 从之前的输出中提取用户、日期、标签、评论
    • “git 添加。”
    • 将上面提取的信息通过管道传输到“git commit -qF -”(如果您想要像检查点注释这样的多行,则不能执行 -m 操作)
    • 通过“si Dropsandbox --yes index.pj”删除沙箱
    • 将 .git 和 .gitignore 移动到保存位置(用于下一次迭代)
    • 删除沙箱目录中的所有剩余文件
    • 移至父目录 (..)
    • 删除沙箱/存储库目录
  • 创建最终的git目录
  • 将.git和.gitignore移动到最终的git目录
  • “git重置--hard HEAD”

完成。

MKS 对其字符串使用某种 ASCII 编码,而 git 通常使用 UTF-8,因此在将元数据(用户名、评论、标签等)导入到 git 时请注意问题。

对于更多分支,请执行以下操作:

  • 在 git 目录中签出分支应启动的修订版本并创建分支(“git checkout -b NEWBRANCHNAME”),
  • 现在将 .git 和 .gitignore 移动到保存位置并删除整个目录,
  • 现在执行以下操作与上面相同的事情

还有一件事:“si”是 MKS 命令行工具。 因此,您要么需要指定其完整路径,要么将其路径放入搜索路径中。

I cannot post the actual program I wrote, because I did not do it on my own time. However, I can post how I did it. It should be easy to redo it with any scripting language.
The tool I wrote migrated only one branch at a time. I would tell it which branch I want (e.g. 1.21.1) and the starting and ending revision in the branch (e.g. 4 and 78 would migrate all revisions starting from 1.21.1.4 up to 1.21.1.78). To have all branches in one repo I would provide the .git directory to use for importing into.

  • begin loop from starting revision to ending revision
    • CURRENTREV=BRANCH.loopcounter
    • create the repo directory
    • move the .git dir into the repo directory
    • move the .gitignore file into the repo directory
    • chdir into the repo directory
    • create mks sandbox inside the repo dir via "si createsandbox -P MKS_PROJECT_PATH --yes --projectRevision=CURRENTREV
    • fetch revision description via "si viewprojecthistory --rfilter=range:CURRENTREV-CURRENTREV", capture output!
    • extract user, date, label(s), comments from previous output
    • "git add ."
    • pipe extracted info from above into "git commit -qF -" (cannot do -m if you want multiple lines like the checkpoint comment)
    • drop sandbox via "si dropsandbox --yes index.pj"
    • move .git and .gitignore to a save place (for next iteration)
    • delete all remaining files in the sandbox directory
    • move to parent dir (..)
    • delete sandbox/repo dir
  • create final git dir
  • move .git and .gitignore into final git dir
  • "git reset --hard HEAD"

Done.

MKS uses some kind of ASCII encoding for its string and git usually uses UTF-8 so watch out for problem when importing meta data into git (user names, comments, tags etc.).

For more branches do this:

  • in the git directory checkout the revision where the branch should start and create a branch ("git checkout -b NEWBRANCHNAME")
  • now move .git and .gitignore to the save place and delete the whole dir
  • now do the same thing as above

One more thing: "si" is the MKS command line tool. So you either need to specify its complete path or put its path into the search path.

薆情海 2024-08-09 03:35:38

MKS Integrity 的问题在于其独特的存储库,一切都驻留在其中:

  • 需求、
  • 测试计划、
  • 测试用例、
  • 功能、
  • 开发人员任务、
  • 部署请求

由于这些数据可以按照自己的节奏彼此独立地发展,因此将它们全部导入到一个 Git 存储库中将是一个坏主意:您只能克隆 Git 存储库的所有内容(即使您可以限制该克隆的深度)。
这意味着您将获得所有文档,即使您只对代码感兴趣。
MKS Integrity 导出意味着首先定义多个 Git 存储库来充当子模块


我只需要源代码树及其历史记录。

像往常一样,我建议只导入:

  • 主要标签(对于任何超过一年的标签,或者您觉得舒服的任何时期,您不需要完整检查,因为它太旧了)
  • 所有标签(主要和次要)过去几年。

我不会将所有内容导入 一个 Git 存储库,除非您确信您的所有源都代表一个 作为整体开发的系统(而不是独立开发的几个“模块”)

更简单的方法是仅签出 CP 并添加/提交到 git。

这将是继续下去的方法。

但是这样您就会失去对添加、删除、移动和重命名操作的跟踪。

不! 你不会! Git 将推断这些操作 .
这就是成为文件的优势 内容 VCS

The problem with MKS Integrity is their unique repository in which everything resides:

  • requirements,
  • test plans,
  • test cases,
  • features,
  • developer tasks,
  • deployment requests

Since those data can evolve independently one from another, at their own pace, importing them all in one Git repository would be a bad idea: you can only clone all the content of a Git repo (even if you can limit the depth of that clone).
That means you will get all the documents, even though you are just interested in the code.
An MKS Integrity export would imply to define first many Git repositories to act as submodules.


I need only the source tree and its history.

As usual, I would recommend only importing:

  • the major labels (for anything older than a year, or whatever period you feel comfortable you won't need the examine in full because it is so old)
  • all the labels (major and minors) for the last years.

And I would not import all in one Git repository unless you are confident that all your sources represents one system developed as a all (and not several "modules" developed independently)

A simpler way would be to just checkout a CP and add/commit to git.

That would be the way to proceed.

But then you would loose track of add, remove, move and rename operations.

No! You would not! Git will infer those operations.
That is the advantage of being a file Content VCS.

泅人 2024-08-09 03:35:38

FWIW,遗憾的是 si diff 目前不支持统一 diff。 有人要求对其进行更改,但目前还没有太多客户要求该功能。

免责声明:我在 PTC(该公司收购了 MKS)工作。

FWIW, si diff sadly doesn't currently support unified diff. There is a request for change to have it do so, but there haven't yet been too many customers asking for that feature.

DISCLAIMER: I work for PTC (who acquired MKS).

自我难过 2024-08-09 03:35:38

这适用于检查点...

https://gist.github.com/2369049

不幸的是,检查点似乎是MKS 唯一真正有意义的事情 -> GIT 作为检查点实际上是最接近 GIT 称为提交的“快照”的东西。

MKS 有很多不兼容的概念(每个文件版本跟踪、与 GIT 分支不同的分支、检查点等),这些概念都可以彼此独立地发展,因此很难说出如何将合理的历史记录迁移到 GIT 中。 可能有很多方法可以做到这一点,但没有一种比下一种更“正确”。

也就是说,我很想听到一些好主意。 :)

我很想看到一个以合理的方式捕获每个文件版本控制的解决方案。 在一些讨论中,我们提出了尝试按提交时间或其他方式排列 MKS 每个文件版本的想法。 这样我们就可以通过包含多个文件更改的提交来制定“存储库”的概念。

This works for checkpoints...

https://gist.github.com/2369049

Unfortunately, checkpoints are seemingly the only thing that really makes any sense from MKS -> GIT, as a checkpoint is really the closest thing to the "snapshot" which GIT calls a commit.

MKS has so many incompatible concepts (per file version tracking, branches that are nothing like GIT branches, checkpoints, etc. ) which can all evolve independently from one another it is really hard to tell how to migrate a sensible history into GIT. There are probably many ways to do it and none of them more "correct" than the next.

That said, I'd love to hear some good ideas. :)

I'd love to see a solution which captures the per-file versioning in a sensible way. In some discussions we have thrown around the idea of trying to line up MKS per-file versions by commit-time or something. That way we can formulate the concept of the "repo" evolving through a commit which contains changes in multiple files.

雨落□心尘 2024-08-09 03:35:38

我使用这个工具将更改包从MKS导入到Mercurial中,将其导入到git应该非常相似; 或者你可以先导入到Mercurial,然后使用git工具导入Mercurial。

https://github.com/arsane/py-mks2hg.git

它会尝试找出指定项目下的所有变更包,并按顺序提交到新的Mercurial存储库。

I use this tool to import change packages from MKS into Mercurial, import it to git should be quite similar; or you can import to Mercurial first, and use git tool to import Mercurial next.

https://github.com/arsane/py-mks2hg.git

It will try to find out all the change packages that under the specified project, and commit to new Mercurial repository in order.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文