##// END OF EJS Templates
discovery: avoid wrong detection of multiple branch heads (issue6256)...
marmoute -
r44949:7d5455b9 stable
parent child Browse files
Show More
@@ -0,0 +1,91 b''
1 ====================================
2 Testing head checking code: Case E-1
3 ====================================
4
5 Mercurial checks for the introduction of new heads on push. Evolution comes
6 into play to detect if existing branches on the server are being replaced by
7 some of the new one we push.
8
9 This case is part of a series of tests checking this behavior.
10
11 Category E: case involving changeset on multiple branch
12 TestCase 8: moving a branch to another location
13
14 .. old-state:
15 ..
16 .. * 1-changeset on branch default
17 .. * 1-changeset on branch Z (above default)
18 ..
19 .. new-state:
20 ..
21 .. * 1-changeset on branch default
22 .. * 1-changeset on branch Z (rebased away from A0)
23 ..
24 .. expected-result:
25 ..
26 .. * push allowed
27 ..
28 .. graph-summary:
29 ..
30 .. B ø⇠◔ B'
31 .. | |
32 .. A ◔ |
33 .. |/
34 .. ●
35
36 $ . $TESTDIR/testlib/push-checkheads-util.sh
37
38 Test setup
39 ----------
40
41 $ mkdir E1
42 $ cd E1
43 $ setuprepos
44 creating basic server and client repo
45 updating to branch default
46 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
47 $ cd client
48 $ hg branch Z
49 marked working directory as branch Z
50 (branches are permanent and global, did you want a bookmark?)
51 $ mkcommit B0
52 $ hg push --new-branch
53 pushing to $TESTTMP/E1/server
54 searching for changes
55 adding changesets
56 adding manifests
57 adding file changes
58 added 1 changesets with 1 changes to 1 files
59 $ hg up 0
60 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
61 $ hg branch --force Z
62 marked working directory as branch Z
63 $ mkcommit B1
64 created new head
65 $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
66 1 new obsolescence markers
67 obsoleted 1 changesets
68 $ hg log -G --hidden
69 @ c98b855401e7 (draft): B1
70 |
71 | x 93e5c1321ece (draft): B0
72 | |
73 | o 8aaa48160adc (draft): A0
74 |/
75 o 1e4be0697311 (public): root
76
77
78 Actual testing
79 --------------
80
81 $ hg push
82 pushing to $TESTTMP/E1/server
83 searching for changes
84 adding changesets
85 adding manifests
86 adding file changes
87 added 1 changesets with 1 changes to 1 files (+1 heads)
88 1 new obsolescence markers
89 obsoleted 1 changesets
90
91 $ cd ../..
@@ -0,0 +1,105 b''
1 ====================================
2 Testing head checking code: Case E-2
3 ====================================
4
5 Mercurial checks for the introduction of new heads on push. Evolution comes
6 into play to detect if existing branches on the server are being replaced by
7 some of the new one we push.
8
9 This case is part of a series of tests checking this behavior.
10
11 Category E: case involving changeset on multiple branch
12 TestCase 8: moving interleaved branch away from each other
13
14 .. old-state:
15 ..
16 .. * 2-changeset on branch default
17 .. * 1-changeset on branch Z (between the two other)
18 ..
19 .. new-state:
20 ..
21 .. * 2-changeset on branch default, aligned
22 .. * 1-changeset on branch Z (at the same location)
23 ..
24 .. expected-result:
25 ..
26 .. * push allowed
27 ..
28 .. graph-summary:
29 ..
30 .. C ø⇠◔ C'
31 .. | |
32 .. B ◔ |
33 .. | |
34 .. A ø⇠◔ A'
35 .. |/
36 ..
37
38 $ . $TESTDIR/testlib/push-checkheads-util.sh
39
40 Test setup
41 ----------
42
43 $ mkdir E1
44 $ cd E1
45 $ setuprepos
46 creating basic server and client repo
47 updating to branch default
48 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 $ cd client
50 $ hg branch Z
51 marked working directory as branch Z
52 (branches are permanent and global, did you want a bookmark?)
53 $ mkcommit B0
54 $ hg branch default --force
55 marked working directory as branch default
56 $ mkcommit C0
57 created new head
58 $ hg push --new-branch
59 pushing to $TESTTMP/E1/server
60 searching for changes
61 adding changesets
62 adding manifests
63 adding file changes
64 added 2 changesets with 2 changes to 2 files
65 $ hg up 0
66 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
67 $ mkcommit A1
68 created new head
69 $ mkcommit C1
70 $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
71 1 new obsolescence markers
72 obsoleted 1 changesets
73 2 new orphan changesets
74 $ hg debugobsolete `getid "desc(C0)" ` `getid "desc(C1)"`
75 1 new obsolescence markers
76 obsoleted 1 changesets
77 $ hg log -G --hidden
78 @ 0c76bc104656 (draft): C1
79 |
80 o f6082bc4ffef (draft): A1
81 |
82 | x afc55ba2ce61 (draft): C0
83 | |
84 | * 93e5c1321ece (draft): B0
85 | |
86 | x 8aaa48160adc (draft): A0
87 |/
88 o 1e4be0697311 (public): root
89
90
91 Actual testing
92 --------------
93
94 $ hg push -r 'desc("C1")'
95 pushing to $TESTTMP/E1/server
96 searching for changes
97 adding changesets
98 adding manifests
99 adding file changes
100 added 2 changesets with 2 changes to 2 files (+1 heads)
101 2 new obsolescence markers
102 obsoleted 2 changesets
103 1 new orphan changesets
104
105 $ cd ../..
@@ -0,0 +1,94 b''
1 ====================================
2 Testing head checking code: Case E-3
3 ====================================
4
5 Mercurial checks for the introduction of new heads on push. Evolution comes
6 into play to detect if existing branches on the server are being replaced by
7 some of the new one we push.
8
9 This case is part of a series of tests checking this behavior.
10
11 Category E: case involving changeset on multiple branch
12 TestCase 8: moving only part of the interleaved branch away, creating 2 heads
13
14 .. old-state:
15 ..
16 .. * 2-changeset on branch default
17 .. * 1-changeset on branch Z (between the two other)
18 ..
19 .. new-state:
20 ..
21 .. * 2-changeset on branch default, on untouched, the other moved
22 .. * 1-changeset on branch Z (at the same location)
23 ..
24 .. expected-result:
25 ..
26 .. * push rejected
27 ..
28 .. graph-summary:
29 ..
30 .. C ø⇠◔ C'
31 .. | |
32 .. B ◔ |
33 .. | |
34 .. A ◔ |
35 .. |/
36 .. ●
37
38 $ . $TESTDIR/testlib/push-checkheads-util.sh
39
40 Test setup
41 ----------
42
43 $ mkdir E1
44 $ cd E1
45 $ setuprepos
46 creating basic server and client repo
47 updating to branch default
48 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 $ cd client
50 $ hg branch Z
51 marked working directory as branch Z
52 (branches are permanent and global, did you want a bookmark?)
53 $ mkcommit B0
54 $ hg branch default --force
55 marked working directory as branch default
56 $ mkcommit C0
57 created new head
58 $ hg push --new-branch
59 pushing to $TESTTMP/E1/server
60 searching for changes
61 adding changesets
62 adding manifests
63 adding file changes
64 added 2 changesets with 2 changes to 2 files
65 $ hg up 0
66 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
67 $ mkcommit C1
68 created new head
69 $ hg debugobsolete `getid "desc(C0)" ` `getid "desc(C1)"`
70 1 new obsolescence markers
71 obsoleted 1 changesets
72 $ hg log -G --hidden
73 @ dc44c53142f0 (draft): C1
74 |
75 | x afc55ba2ce61 (draft): C0
76 | |
77 | o 93e5c1321ece (draft): B0
78 | |
79 | o 8aaa48160adc (draft): A0
80 |/
81 o 1e4be0697311 (public): root
82
83
84 Actual testing
85 --------------
86
87 $ hg push -r 'desc("C1")'
88 pushing to $TESTTMP/E1/server
89 searching for changes
90 abort: push creates new remote head dc44c53142f0!
91 (merge or see 'hg help push' for details about pushing new heads)
92 [255]
93
94 $ cd ../..
@@ -498,7 +498,6 b' def _postprocessobsolete(pushop, futurec'
498 498 # define various utilities and containers
499 499 repo = pushop.repo
500 500 unfi = repo.unfiltered()
501 tonode = unfi.changelog.node
502 501 torev = unfi.changelog.index.get_rev
503 502 public = phases.public
504 503 getphase = unfi._phasecache.phase
@@ -530,6 +529,7 b' def _postprocessobsolete(pushop, futurec'
530 529 # actually process branch replacement
531 530 while localcandidate:
532 531 nh = localcandidate.pop()
532 current_branch = unfi[nh].branch()
533 533 # run this check early to skip the evaluation of the whole branch
534 534 if torev(nh) in futurecommon or ispublic(torev(nh)):
535 535 newhs.add(nh)
@@ -540,7 +540,12 b' def _postprocessobsolete(pushop, futurec'
540 540 branchrevs = unfi.revs(
541 541 b'only(%n, (%ln+%ln))', nh, localcandidate, newhs
542 542 )
543 branchnodes = [tonode(r) for r in branchrevs]
543
544 branchnodes = []
545 for r in branchrevs:
546 c = unfi[r]
547 if c.branch() == current_branch:
548 branchnodes.append(c.node())
544 549
545 550 # The branch won't be hidden on the remote if
546 551 # * any part of it is public,
General Comments 0
You need to be logged in to leave comments. Login now