问题描述
我正在尝试使用 hg convert --filemap
清理存储库.除了 rename
之外,转换文件中的任何选项都可以正常工作.如果我向文件映射添加任何 rename
选项,那么它在第一次与 abort 合并时失败:无法转换合并提交,因为目标父项没有完全合并
.
I am trying to clean up a repository using hg convert --filemap
. Convert works fine with any option in filemap except rename
. If I add any rename
option to filemap then it fails at the first merge with abort: unable to convert merge commit since target parents do not merge cleanly
.
我尝试放入文件映射只是一个虚拟 rename foo bar
选项(repo 中实际上不存在 foo 或 bar 路径)我得到了相同的结果.
I tried putting in filemap only a dummy rename foo bar
option (none of the foo or bar paths actually exist in the repo) and I get the same result.
我尝试进行真正的重命名(现有的第一个路径),同样发生.只要有任何重命名,它就会中断.
I tried putting in a real rename (existing 1st path), same happens. As fast as any rename gets in there, it breaks.
这是一个错误吗?我做错了什么?
It this a bug? What am I doing wrong?
更新:重现:
创建文件a
,在里面写一些东西,提交.更新到父级,在 a
中编写其他内容,提交.与其他 head 合并,手动修复冲突.
Create file a
, write something in it, commit. Update to parent, write something else in a
, commit. Merge with other head, fix conflict by hand.
Filemap 由一行和一行组成:rename foo bar
.运行 hg convert
.如果提交不能自动合并,它将失败.
Filemap consists of one line and one line only: rename foo bar
. Run hg convert
. It will fail if the commit can't be automatically merged.
推荐答案
我遇到了同样的错误,我通过将转换分成多个步骤来解决它.
I had the same error and I worked around it by splitting my conversion into multiple steps.
问题似乎在于,在一次 convert
运行期间,文件映射中的重命名组合和包含的历史记录中的合并.所以我这样做了:
It seems like the problem is when you have a combination of renames in the filemap AND merges in the included history during a single run of convert
. So I did this:
第 1 步:使用没有重命名的文件映射运行
hg convert
.基本上只是将原始存储库中的内容包含/排除到临时中间存储库中.
Step 1: run
hg convert
using a filemap with NO RENAMES. Basically just to include/exclude things from the original repository into a temporary intermediate repo.
第 2 步:使用仅重命名的文件映射再次运行 hg convert
.这将从中间存储库到最终存储库.即使合并仍在历史中,也没有问题.
Step 2: run hg convert
again using a filemap that did only renames. This would go from the intermediate to final repositories. Even though merges were still in the history, no problems.
删除中间仓库
这绕过了中止"问题.还有一个次要的好处是,由于第 1 步是最长的(它只从大约 20000 个变更集中挑选了 100 个变更集),因此更容易迭代重命名.我发现文件映射有点难以正确处理,因为事情只会默默地失败.
This got around the "abort" problem. Also a secondary benefit was that since step 1 was the longest (it was picking only a few 100 changesets out of about 20000) it became much easier to iterate on the renames. I find that filemaps are a little hard to get right since things will just fail silently.
我使用的是Mercurial Distributed SCM(版本 5.7)"
I was using "Mercurial Distributed SCM (version 5.7)"
这篇关于使用 --filemap 进行 Mercurial 转换失败并出现任何虚拟重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!