【发布时间】:2023-01-30 05:23:41
【问题描述】:
我在工作中遇到了 Mercurial 的情况,我希望文件存在,但它不存在,我想更好地理解为什么。我已经整理了这个问题的重现。在此重现中,我希望文件 foo.txt 在最终合并后默认存在,因为合并的一个父级不存在该文件,因为它较早被删除,而另一个父级由于提交而将其添加回去那事发生了后删除文件的提交。相反,该文件仍然被删除,为什么?
这是提交序列的图像:
下面是从空目录到在该状态下拥有 Mercurial 存储库的实际命令。
hg init
echo foo > foo.txt
echo bar > bar.txt
hg add foo.txt bar.txt
hg commit -m "Add foo.txt and bar.txt"
hg branch feature
hg remove foo.txt
hg commit -m "Remove foo.txt"
echo barbar > bar.txt
hg commit -m "Modify bar.txt"
hg update default
echo baz > baz.txt
hg add baz.txt
hg commit -m "Add baz.txt"
hg update feature
hg merge default
hg commit -m "Merge default"
echo foo > foo.txt
hg add foo.txt
hg commit -m "Restore foo.txt"
hg update default
echo bazbaz > baz.txt
hg commit -m "Modify baz.txt"
hg update 0
hg merge 2
hg commit -m "Merge feature"
hg merge
hg commit -m "Merge"
hg merge feature
hg commit -m "Merge feature"
最终合并后工作目录的状态:
> ls
bar.txt baz.txt
【问题讨论】:
标签: merge version-control mercurial merge-conflict-resolution