version control - Query about mercurial heads diagram and heads counting -
i need understand in of following lines number of heads change. im finding hard understand going on in line 15.. know when repository doesn't have same change-sets when pulling or pushing repository there +1 head.
my diagram looks when tried solve it:
line 12: push clone2 main repository
line 15: push clone2 clone1 (because r3 doesn't similar r1)
line 17: pull r2 & r1 main repository, since r1 , r3 there, i've added r2 .
total heads created: +3
main repository: o--------r2
\----r1
clone 1: o--------r1
\---r3 \---r2
clone 2: o------r2---------r3
\--r1--/
the mercurial commands below:
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 1 > a.txt
5: /home/user/clone1> hg add a.txt
6: /home/user/clone1> hg commit -m "added file"
7: /home/user/clone1> cd ../clone2
8: /home/user/clone2> echo 2 > b.txt
9: /home/user/clone2> hg add b.txt
10: /home/user/clone2> hg commit -m "added file"
11: /home/user/clone2> hg pull ../clone1
12: /home/user/clone2> hg push -f
13: /home/user/clone2> hg merge
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
while planetmaker's answer in linked question full , valid, i'll note mistakes, omissions , wrong assumptions in this situation
- clone2 got head+1 on step 11
>hg pull ..\clone1 pulling ..\clone1 searching changes adding changesets adding manifests adding file changes added 1 changesets 1 changes 1 files (+1 heads)
- main got head+1 on step 12
>hg push -f pushing z:\main searching changes adding changesets adding manifests adding file changes added 2 changesets 2 changes 2 files (+1 heads)
http://i.imgur.com/kknu39d.png
- clone2 got head-1 on step 14
- clone1 not got head+1 on step 15 (mergeset pushed, previous heads in clone2 parents of mergeset), @ step clone1 equal (in dag-terms) clone2
>hg push -f ..\clone1 pushing ..\clone1 searching changes adding changesets adding manifests adding file changes added 2 changesets 1 changes 1 files
http://i.imgur.com/9by0urs.png
- steps 16-17 do nothing, because clone1 dag is fuller main (it has mergeset clone2 on top of main-history)
>hg pull pulling z:\main searching changes no changes found
- in order have full history in main must push of clones (
-f
not needed , useless) have mergeset new single head in repository
>hg push pushing z:\main searching changes adding changesets adding manifests adding file changes added 1 changesets 0 changes 0 files (-1 heads)
Comments
Post a Comment