簡體   English   中英

為什么在 Mercurial 中最終合並提交后我希望存在的文件丟失了?

[英]Why is the file I expect to be present missing after the final merge commit in Mercurial?

我在工作中遇到了 Mercurial 的情況,我希望文件存在,但它不存在,我想更好地理解原因。 我已經整理了這個問題的重現。 在此重現中,我希望文件 foo.txt 在最終合並后默認存在,因為合並的一個父級不存在該文件,因為它較早被刪除,而另一個父級由於提交而將其添加回去那是在刪除文件的提交之后發生的。 相反,該文件仍然被刪除,為什么?

這是提交序列的圖像:

提交重現問題的存儲庫

這是從一個空目錄到 go 的實際命令,在這個 state 中有一個 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"   

最終合並后工作目錄的State:

> ls
bar.txt  baz.txt

編輯:這似乎影響 hg 版本 5.9.3 和 6.3.2 但影響 5.0.2

編輯:根據 libera.chat #mercurial 頻道上的討論,修改 repro 中的命令序列以在文件創建后對文件進行編輯不會改變結果。 foo.txt仍然不存在。 https://gist.github.com/OneGeek/6fa5dcd4c2b3db6649310de1167449f9

我只是將 repro 中的步驟粘貼到此處的終端中並嘗試了(兩次),但它沒有重現所描述的問題: foo.txt存在。

最終結果是一個工作目錄,其中包含:

C:\Users\abcde\source\test>dir
...
 Directory of C:\Users\abcde\source\test

01/29/2023  04:08 PM    <DIR>          .
01/29/2023  04:07 PM    <DIR>          ..
01/29/2023  04:08 PM    <DIR>          .hg
01/29/2023  04:07 PM                 0 .hgignore
01/29/2023  04:08 PM                 9 bar.txt
01/29/2023  04:08 PM                 9 baz.txt
01/29/2023  04:08 PM                 6 foo.txt
               4 File(s)             24 bytes

THG 中的圖形看起來與問題中的圖形相同。

我碰巧在 Windows 上使用 HG 5.0.2。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM