【问题标题】:How to combine repositories into a single one in Bazaar?如何在 Bazaar 中将存储库合并为一个存储库?
【发布时间】:2012-03-24 05:42:47
【问题描述】:

我有三个独立的 Bazaar 存储库。它们都与单个项目相关,但没有重叠文件。

我想将它们组合到一个存储库中,在不同的子文件夹下,并保留它们的历史记录。

这可能吗?请注意,我不想保持存储库的独立性。这将是一次性操作。

在 GIT 中有一个解决方案:How do you merge two Git repositories? 但我在 Bazaar 找不到类似的东西。

我尝试过的: 我尝试合并存储库,但是在两个存储库中具有公共路径的文件会导致冲突。我希望将它们合并到不同的子目录下,但不知道如何。我主要以非协作方式使用 Bazaar。我不熟悉merge 命令。

更新:我找到了a bzr plugin,它旨在完全按照我的意愿行事,但有问题。

【问题讨论】:

  • 你试过bzr join命令吗?
  • 是的,我试过了。并点击此错误/功能:bugs.launchpad.net/bzr/+bug/370710
  • 您在运行“bzr join”之前尝试过升级吗?
  • 是的@jelmer,我确实尝试过升级。我什至尝试降级到旧格式。我什至尝试使用 python 脚本为不同的存储库分配唯一的根 ID。我也尝试过级联连接。即AB 合并,然后与C 合并,等等。这是一整天的实验,但没有骰子。

标签: merge bazaar


【解决方案1】:

您可以使用merge -r0..-1 命令来完成。但是如果你想把文件放到不同的子文件夹中,最好在合并之前这样做。

假设您有一个main 组件和两个子组件:foobar。您希望新的组合项目具有以下结构:

ProjectRoot/
    main.txt     <-- any files from main component 
    ...               should be at the root of the project
    ...
    bar/         <-- bar subdirectory with files from bar component
    foo/         <-- foo subdirectory with files from foo component

我们会将foobar 合并为main。但首先让我们将文件移动到子目录中:

cd /path/to/foo
bzr mkdir foo
bzr mv file1 file2 foo
bzr commit -m "files moved into foo/ subdirectory"

bar 也类似:

cd /path/to/bar
bzr mkdir bar
bzr mv file3 file4 bar
bzr commit -m "files moved into bar/ subdirectory"

现在我们准备好将所有内容合并到main

cd /path/to/main
# ensure the working tree does not have uncommitted changes
bzr status
# now merge foo
bzr merge -r0..-1 /path/to/foo
# if there is no conflicts then you can commit this part
bzr status
bzr commit -m "merged foo component"
# now merge bar
bzr merge -r0..-1 /path/to/bar
# if there is no conflicts then you can commit this part
bzr status
bzr commit -m "merged bar component"

之后,您的main 将同时合并foobar

【讨论】:

  • 感谢@bialix,但这遇到了同样的问题:它会在应该不同的项目文件之间产生冲突。在我的情况下,它只发生在最后一次合并中,所以我可能会硬着头皮放弃最后一个存储库的提交历史记录。
  • @HRJ:您可以使用 bzr-fastimport 插件将您的第三个 repo 转换为 1.14 格式(非富根),然后再次合并。
【解决方案2】:

截至撰写本文时(2021 年 7 月),似乎有一个插件,至少适用于集市(而不是微风)-https://launchpad.net/bzr-merge-into

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-21
    • 2012-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-19
    • 1970-01-01
    相关资源
    最近更新 更多