Mercurial > hg
comparison tests/test-single-head-obsolescence-named-branch-A3.t @ 48688:053a5bf508da
discovery: port _postprocessobsolete() changes from evolve, add tests
Let's make this function obsolescence-aware as well. Now we check that
revisions are not obsolete first, and only then check that they are going to be
common after exchange.
The tests make sure that rewriting changesets doesn't confuse head computation.
They rely on experimental.single-head-per-branch feature to show that remote
correctly sees the expected result (i.e. either aborts the push or allows it to
succeed). They are ported from evolve as well.
Differential Revision: https://phab.mercurial-scm.org/D12098
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 04 Jan 2022 23:38:39 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
48687:f8f2ecdde4b5 | 48688:053a5bf508da |
---|---|
1 ========================================= | |
2 Testing single head enforcement: Case A-3 | |
3 ========================================= | |
4 | |
5 A repository is set to only accept a single head per name (typically named | |
6 branch). However, obsolete changesets can make this enforcement more | |
7 complicated, because they can be kept visible by other changeset on other | |
8 branch. | |
9 | |
10 This case is part of a series of tests checking this behavior. | |
11 | |
12 Category A: Involving obsolescence | |
13 TestCase 3: Full superseding of a branch interleaved with another | |
14 | |
15 .. old-state: | |
16 .. | |
17 .. * 2 changesets on branch default | |
18 .. * 2 changesets on branch Z interleaved with the other | |
19 .. | |
20 .. new-state: | |
21 .. | |
22 .. * 2 changesets on branch Z at the same location | |
23 .. * 2 changesets on branch default superseding the other ones | |
24 .. | |
25 .. expected-result: | |
26 .. | |
27 .. * only one head detected | |
28 .. | |
29 .. graph-summary: | |
30 .. | |
31 .. D ● (branch Z) | |
32 .. | | |
33 .. C ø⇠◔ C' | |
34 .. | | | |
35 .. B ● | (branch Z) | |
36 .. | | | |
37 .. A ø⇠◔ A' | |
38 .. |/ | |
39 .. ● | |
40 | |
41 $ . $TESTDIR/testlib/push-checkheads-util.sh | |
42 | |
43 $ cat >> $HGRCPATH << EOF | |
44 > [command-templates] | |
45 > log = "{node|short} [{branch}] ({phase}): {desc}\n" | |
46 > EOF | |
47 | |
48 Test setup | |
49 ---------- | |
50 | |
51 $ mkdir A3 | |
52 $ cd A3 | |
53 $ setuprepos single-head | |
54 creating basic server and client repo | |
55 updating to branch default | |
56 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
57 $ cd client | |
58 $ hg branch Z | |
59 marked working directory as branch Z | |
60 (branches are permanent and global, did you want a bookmark?) | |
61 $ mkcommit B0 | |
62 $ hg branch default --force | |
63 marked working directory as branch default | |
64 $ mkcommit C0 | |
65 created new head | |
66 $ hg branch Z --force | |
67 marked working directory as branch Z | |
68 $ mkcommit D0 | |
69 created new head | |
70 $ hg push --new-branch | |
71 pushing to $TESTTMP/A3/server | |
72 searching for changes | |
73 adding changesets | |
74 adding manifests | |
75 adding file changes | |
76 added 3 changesets with 3 changes to 3 files | |
77 $ hg up 0 | |
78 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
79 $ mkcommit A1 | |
80 created new head | |
81 $ mkcommit C1 | |
82 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(A1)"` | |
83 1 new obsolescence markers | |
84 obsoleted 1 changesets | |
85 3 new orphan changesets | |
86 $ hg debugobsolete `getid "desc(C0)"` `getid "desc(C1)"` | |
87 1 new obsolescence markers | |
88 obsoleted 1 changesets | |
89 $ hg heads | |
90 0c76bc104656 [default] (draft): C1 | |
91 78578c4306ce [Z] (draft): D0 | |
92 $ hg log -G --hidden | |
93 @ 0c76bc104656 [default] (draft): C1 | |
94 | | |
95 o f6082bc4ffef [default] (draft): A1 | |
96 | | |
97 | * 78578c4306ce [Z] (draft): D0 | |
98 | | | |
99 | x afc55ba2ce61 [default] (draft): C0 | |
100 | | | |
101 | * 93e5c1321ece [Z] (draft): B0 | |
102 | | | |
103 | x 8aaa48160adc [default] (draft): A0 | |
104 |/ | |
105 o 1e4be0697311 [default] (public): root | |
106 | |
107 | |
108 Actual testing | |
109 -------------- | |
110 | |
111 $ hg push -r 'desc("C1")' | |
112 pushing to $TESTTMP/A3/server | |
113 searching for changes | |
114 adding changesets | |
115 adding manifests | |
116 adding file changes | |
117 added 2 changesets with 2 changes to 2 files (+1 heads) | |
118 2 new obsolescence markers | |
119 obsoleted 2 changesets | |
120 2 new orphan changesets |