本文介绍了使用汞转换扩展,分支图选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个Mercurial存储库 RepoA RepoB ,有2个人一直在各自的存储库上进行独立工作,RepoA仅具有一个分支(默认),但有9个提交,RepoB有2个分支,Default和Experiment1,这些分支每个都有大约30个提交.现在事实证明RepoB是RepoA的子集,即RepoB中的很多内容都可以放入RepoA中.我想将RepoB的所有内容拉入(导入)到RepoA中的一个分支中.我不希望导入进入RepoA的Default分支,而是进入RepoA中的命名分支,称为 Developer1WIP .我特别需要知道

I've got 2 Mercurial repositories RepoA and RepoB, 2 people have been working independenlty on each of their repos, RepoA only has one branch(Default) but 9 commits, RepoB has 2 branches, Default and Experiment1, each of these branches have approx 30 commits. Now it turns out that RepoB is a subset of RepoA, i.e alot of the stuff in RepoB can be put into RepoA. I'd like to Pull(import) all the contents of RepoB into a branch in RepoA. I do not want the import to go the Default branch of RepoA but rather a named branch in RepoA, called Developer1WIP. I specifically need to know

  1. 如何在RepoA中创建一个命名分支(Developer1WIP)并将所有RepoB导入到RepoA上的Developer1WIP分支中

我相信带有分支映射的HgConvert扩展是前进的好方法."branchmap是一个文件,当您从任何外部存储库引入分支时,都可以重命名该分支." ....

I believe the HgConvert Extension with branch-map is a good way forward."The branchmap is a file that allows you to rename a branch when it is being brought in from whatever external repository."....

  1. 这是什么文件?
  2. 要在哪里创建&应该在里面什么?
  3. 我可以得到一些有关如何在Windows中确切使用此命令的示例吗?

推荐答案

Mercurial Wiki中记录了所有内容,以下摘录自转换扩展页面:

Everything is documented in the Mercurial wiki, here's an excerpt from the ConvertExtension page:

-分支地图

自v1.3起

branchmap是一个文件,允许您在重命名分支时 从任何外部存储库中引入.当用于 与splicemap结合使用,可以实现强大的组合 帮助修复即使是管理最差的存储库,也可以将其打开 进入结构良好的Mercurial存储库.分支图包含 表格行

The branchmap is a file that allows you to rename a branch when it is being brought in from whatever external repository. When used in conjunction with a splicemap, it allows for a powerful combination to help fix even the most badly mismanaged repositories and turn them into nicely structured Mercurial repositories. The branchmap contains lines of the form

original_branch_name new_branch_name

原始分支名称"是 源存储库中分支的名称,"new_branch_name"为 分支的名称是目标存储库.可以用 将代码库中的代码从默认"移动到命名分支.

"original_branch_name" is the name of the branch in the source repository, and "new_branch_name" is the name of the branch is the destination repository. This can be used to move code in one repository from "default" to a named branch.

请记住,默认"标识Mercurial的默认分支 存储库,默认情况下,日志,标题或 父母的命令.要删除命名的分支标记,请将其转换为 带有分支图的默认"

Remember that "default" identifies the default branch of Mercurial repositories, which is not displayed by default by log, heads or parents commands. To erase named branch markers, convert it to "default" with a branchmap like

original_branch_name default

修订将仍然存在,但没有 不再附加到原始命名分支.

The revisions will still be there but no longer attached to the original named branch.

...

因此,基本上,您将创建一个包含以下内容的文本文件:

So basically you'll create a textfile containing this:

default Developer1WIP
Experiment1 Developer1WIP

(转换后是否要在同一分支上同时使用default和Experiment1?您的问题有点不清楚,但我想您已经这样做了.)

然后发出转换命令:

hg convert ORIGINAL_REPO CONVERTED_REPO --branchmap MAP.TXT

这篇关于使用汞转换扩展,分支图选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 20:03