Mercurial > hg
comparison tests/test-bundle-phase-internal.t @ 50397:f24c2e42e654
strip: do now include internal changeset in the strip backup
See inline comment for details.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 10 Mar 2023 07:10:19 +0100 |
parents | |
children | cc712ce3361f |
comparison
equal
deleted
inserted
replaced
50396:386737600689 | 50397:f24c2e42e654 |
---|---|
1 ===================================================== | |
2 test behavior of the `internal` phase around bundling | |
3 ===================================================== | |
4 | |
5 Long story short, internal changeset are internal implementation details and | |
6 they should never leave the repository. Hence, they should never be in a | |
7 bundle. | |
8 | |
9 Setup | |
10 ===== | |
11 | |
12 $ cat << EOF >> $HGRCPATH | |
13 > [ui] | |
14 > logtemplate="{node|short} [{phase}] {desc|firstline}" | |
15 > EOF | |
16 | |
17 | |
18 $ hg init reference-repo --config format.use-internal-phase=yes | |
19 $ cd reference-repo | |
20 $ echo a > a | |
21 $ hg add a | |
22 $ hg commit -m "a" | |
23 $ echo b > b | |
24 $ hg add b | |
25 $ hg commit -m "b" | |
26 $ echo b > c | |
27 $ hg add c | |
28 $ hg commit -m "c" | |
29 $ hg log -G | |
30 @ 07f0cc02c068 [draft] c | |
31 | | |
32 o d2ae7f538514 [draft] b | |
33 | | |
34 o cb9a9f314b8b [draft] a | |
35 | |
36 $ hg up ".^" | |
37 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
38 | |
39 do a shelve | |
40 | |
41 $ touch a_file.txt | |
42 $ hg shelve -A | |
43 adding a_file.txt | |
44 shelved as default | |
45 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
46 $ hg log -G --hidden | |
47 o 2ec3cf310d86 [internal] changes to: b | |
48 | | |
49 | o 07f0cc02c068 [draft] c | |
50 |/ | |
51 @ d2ae7f538514 [draft] b | |
52 | | |
53 o cb9a9f314b8b [draft] a | |
54 | |
55 $ shelved_node=`hg log --rev tip --hidden -T '{node|short}'` | |
56 | |
57 add more changeset above it | |
58 | |
59 $ hg up 'desc(a)' | |
60 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
61 $ echo d > d | |
62 $ hg add d | |
63 $ hg commit -m "d" | |
64 created new head | |
65 $ echo d > e | |
66 $ hg add e | |
67 $ hg commit -m "e" | |
68 $ hg up null | |
69 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
70 $ hg log -G | |
71 o 636bc07920e3 [draft] e | |
72 | | |
73 o 980f7dc84c29 [draft] d | |
74 | | |
75 | o 07f0cc02c068 [draft] c | |
76 | | | |
77 | o d2ae7f538514 [draft] b | |
78 |/ | |
79 o cb9a9f314b8b [draft] a | |
80 | |
81 $ hg log -G --hidden | |
82 o 636bc07920e3 [draft] e | |
83 | | |
84 o 980f7dc84c29 [draft] d | |
85 | | |
86 | o 2ec3cf310d86 [internal] changes to: b | |
87 | | | |
88 | | o 07f0cc02c068 [draft] c | |
89 | |/ | |
90 | o d2ae7f538514 [draft] b | |
91 |/ | |
92 o cb9a9f314b8b [draft] a | |
93 | |
94 $ cd .. | |
95 | |
96 backup bundle from strip | |
97 ======================== | |
98 | |
99 strip an ancestors of the internal changeset | |
100 -------------------------------------------- | |
101 | |
102 $ cp -ar reference-repo strip-ancestor | |
103 $ cd strip-ancestor | |
104 | |
105 The internal change is stripped, yet it should be skipped from the backup bundle. | |
106 | |
107 $ hg log -G | |
108 o 636bc07920e3 [draft] e | |
109 | | |
110 o 980f7dc84c29 [draft] d | |
111 | | |
112 | o 07f0cc02c068 [draft] c | |
113 | | | |
114 | o d2ae7f538514 [draft] b | |
115 |/ | |
116 o cb9a9f314b8b [draft] a | |
117 | |
118 $ hg debugstrip 'desc(b)' | |
119 saved backup bundle to $TESTTMP/strip-ancestor/.hg/strip-backup/d2ae7f538514-59bd8bc3-backup.hg | |
120 | |
121 The change should be either gone or hidden | |
122 | |
123 $ hg log -G | |
124 o 636bc07920e3 [draft] e | |
125 | | |
126 o 980f7dc84c29 [draft] d | |
127 | | |
128 o cb9a9f314b8b [draft] a | |
129 | |
130 | |
131 The backup should not include it (as people tend to manipulate these directly) | |
132 | |
133 $ ls -1 .hg/strip-backup/ | |
134 d2ae7f538514-59bd8bc3-backup.hg | |
135 $ hg debugbundle .hg/strip-backup/*.hg | |
136 Stream params: {Compression: BZ} | |
137 changegroup -- {nbchanges: 2, version: 03} (mandatory: True) | |
138 d2ae7f538514cd87c17547b0de4cea71fe1af9fb | |
139 07f0cc02c06869c81ebf33867edef30554020c0d | |
140 cache:rev-branch-cache -- {} (mandatory: False) | |
141 phase-heads -- {} (mandatory: True) | |
142 07f0cc02c06869c81ebf33867edef30554020c0d draft | |
143 | |
144 Shelve should still work | |
145 | |
146 $ hg unshelve | |
147 unshelving change 'default' | |
148 rebasing shelved changes | |
149 $ hg status | |
150 A a_file.txt | |
151 | |
152 $ cd .. | |
153 | |
154 strip an unrelated changeset with a lower revnum | |
155 ------------------------------------------------ | |
156 | |
157 $ cp -ar reference-repo strip-unrelated | |
158 $ cd strip-unrelated | |
159 | |
160 The internal change is not directly stripped, but it is affected by the strip | |
161 and it is in the "temporary backup" zone. The zone that needs to be put in a | |
162 temporary bundle while we affect data under it. | |
163 | |
164 $ hg debugstrip 'desc(c)' | |
165 saved backup bundle to $TESTTMP/strip-unrelated/.hg/strip-backup/07f0cc02c068-8fd0515f-backup.hg | |
166 | |
167 The change should be either gone or hidden | |
168 | |
169 $ hg log -G | |
170 o 636bc07920e3 [draft] e | |
171 | | |
172 o 980f7dc84c29 [draft] d | |
173 | | |
174 | o d2ae7f538514 [draft] b | |
175 |/ | |
176 o cb9a9f314b8b [draft] a | |
177 | |
178 The backup should not include it (as people tend to manipulate these directly) | |
179 | |
180 $ ls -1 .hg/strip-backup/ | |
181 07f0cc02c068-8fd0515f-backup.hg | |
182 $ hg debugbundle .hg/strip-backup/*.hg | |
183 Stream params: {Compression: BZ} | |
184 changegroup -- {nbchanges: 1, version: 03} (mandatory: True) | |
185 07f0cc02c06869c81ebf33867edef30554020c0d | |
186 cache:rev-branch-cache -- {} (mandatory: False) | |
187 phase-heads -- {} (mandatory: True) | |
188 07f0cc02c06869c81ebf33867edef30554020c0d draft | |
189 | |
190 Shelve should still work | |
191 | |
192 $ hg unshelve | |
193 unshelving change 'default' | |
194 rebasing shelved changes | |
195 $ hg status | |
196 A a_file.txt | |
197 | |
198 $ cd .. | |
199 | |
200 explicitly strip the internal changeset | |
201 --------------------------------------- | |
202 | |
203 $ cp -ar reference-repo strip-explicit | |
204 $ cd strip-explicit | |
205 | |
206 The internal change is directly selected for stripping. | |
207 | |
208 $ hg debugstrip --hidden $shelved_node | |
209 | |
210 The change should be gone | |
211 | |
212 $ hg log -G --hidden | |
213 o 636bc07920e3 [draft] e | |
214 | | |
215 o 980f7dc84c29 [draft] d | |
216 | | |
217 | o 07f0cc02c068 [draft] c | |
218 | | | |
219 | o d2ae7f538514 [draft] b | |
220 |/ | |
221 o cb9a9f314b8b [draft] a | |
222 | |
223 | |
224 We don't need to backup anything | |
225 | |
226 $ ls -1 .hg/strip-backup/ | |
227 | |
228 Shelve should still work | |
229 | |
230 $ hg unshelve | |
231 unshelving change 'default' | |
232 rebasing shelved changes | |
233 $ hg status | |
234 A a_file.txt | |
235 | |
236 $ cd .. |