我需要了解以下哪一行的头数会发生变化。我发现很难理解第15行的情况。 我知道当一个存储库在从另一个存储库中拉出或推送时没有相同的更改集时,所以有+1头。
当我试图解决时,我的图表看起来像这样:
第12行:从clone2推送到主存储库
第15行:从Clone2推送到Clone1(因为r3与r1不相似)
第17行:拉r2&来自主存储库的r1,因为已经存在r1和r3,所以我添加了r2。
创建的总头数:+3
主 repository:O -------- r2
\----r1
克隆1:O -------- r1
\---r3
\---r2
克隆2:O ------ r2 --------- r3
\--r1--/
mercurial命令如下:
1:/ home / user> hg clone http://remoteserver/mainrepository clone1
2:/ home / user> hg clone http://remoteserver/mainrepository clone2
3:/ home / user> cd clone1
4:/ home / user / clone1> echo one> A.TXT
5:/ home / user / clone1> hg添加a.txt
6:/ home / user / clone1> hg commit -m“添加了一个文件”
7:/ home / user / clone1> cd ../ clone2
8:/ home / user / clone2>回声二> b.txt
9:/ home / user / clone2> hg add b.txt
10:/ home / user / clone2> hg commit -m“添加了一个文件”
11:/ home / user / clone2> hg pull ../ clone1
12:/ home / user / clone2> hg push -f
13:/ home / user / clone2>合并
14:/ home / user / clone2> hg commit -m“Merged”
15:/ home / user / clone2> hg push -f ../ clone1
16:/ home / user / clone2> cd ../ clone1
17:/ home / user / clone1> hg pull
答案 0 :(得分:0)
虽然星球制造者在相关问题中的答案是完全有效的,但我会在这种情况中注意到一些错误,遗漏和错误的假设
>hg pull ..\Clone1 pulling from ..\Clone1 searching for changes adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads)
>hg push -f pushing to Z:\Main searching for changes adding changesets adding manifests adding file changes added 2 changesets with 2 changes to 2 files (+1 heads)
http://i.imgur.com/KKNU39d.png
>hg push -f ..\Clone1 pushing to ..\Clone1 searching for changes adding changesets adding manifests adding file changes added 2 changesets with 1 changes to 1 files
http://i.imgur.com/9bY0URS.png
>hg pull pulling from Z:\Main searching for changes no changes found
-f
不需要且无用)推送到它,以将mergeset作为新的单头存储在存储库中>hg push pushing to Z:\Main searching for changes adding changesets adding manifests adding file changes added 1 changesets with 0 changes to 0 files (-1 heads)