Show More
@@ -186,11 +186,17 b' def commitfuncfor(repo, src):' | |||||
186 | Note that fold have its own separated logic because its handling is a bit |
|
186 | Note that fold have its own separated logic because its handling is a bit | |
187 | different and not easily factored out of the fold method. |
|
187 | different and not easily factored out of the fold method. | |
188 | """ |
|
188 | """ | |
|
189 | phasemin = src.phase() | |||
189 | def commitfunc(**kwargs): |
|
190 | def commitfunc(**kwargs): | |
190 | extra = kwargs.get('extra', {}).copy() |
|
191 | phasebackup = repo.ui.backupconfig('phases', 'new-commit') | |
191 | extra['histedit_source'] = src.hex() |
|
192 | try: | |
192 | kwargs['extra'] = extra |
|
193 | repo.ui.setconfig('phases', 'new-commit', phasemin) | |
193 | return repo.commit(**kwargs) |
|
194 | extra = kwargs.get('extra', {}).copy() | |
|
195 | extra['histedit_source'] = src.hex() | |||
|
196 | kwargs['extra'] = extra | |||
|
197 | return repo.commit(**kwargs) | |||
|
198 | finally: | |||
|
199 | repo.ui.restoreconfig(phasebackup) | |||
194 | return commitfunc |
|
200 | return commitfunc | |
195 |
|
201 | |||
196 |
|
202 | |||
@@ -357,7 +363,13 b' def finishfold(ui, repo, ctx, oldctx, ne' | |||||
357 | # This is sufficient to solve issue3681 anyway |
|
363 | # This is sufficient to solve issue3681 anyway | |
358 | extra['histedit_source'] = '%s,%s' % (ctx.hex(), oldctx.hex()) |
|
364 | extra['histedit_source'] = '%s,%s' % (ctx.hex(), oldctx.hex()) | |
359 | commitopts['extra'] = extra |
|
365 | commitopts['extra'] = extra | |
360 | n = collapse(repo, ctx, repo[newnode], commitopts) |
|
366 | phasebackup = repo.ui.backupconfig('phases', 'new-commit') | |
|
367 | try: | |||
|
368 | phasemin = max(ctx.phase(), oldctx.phase()) | |||
|
369 | repo.ui.setconfig('phases', 'new-commit', phasemin) | |||
|
370 | n = collapse(repo, ctx, repo[newnode], commitopts) | |||
|
371 | finally: | |||
|
372 | repo.ui.restoreconfig(phasebackup) | |||
361 | if n is None: |
|
373 | if n is None: | |
362 | return ctx, [] |
|
374 | return ctx, [] | |
363 | hg.update(repo, n) |
|
375 | hg.update(repo, n) |
@@ -153,10 +153,12 b' stabilise' | |||||
153 |
|
153 | |||
154 | $ hg rebase -r 'unstable()' -d . |
|
154 | $ hg rebase -r 'unstable()' -d . | |
155 |
|
155 | |||
156 | Check that histedit respect phases |
|
|||
157 | ========================================= |
|
|||
158 |
|
156 | |||
159 | (not directly related to the test file but doesn't deserve it's own test case) |
|
157 | Test phases support | |
|
158 | =========================================== | |||
|
159 | ||||
|
160 | Check that histedit respect immutability | |||
|
161 | ------------------------------------------- | |||
160 |
|
162 | |||
161 | $ cat >> $HGRCPATH << EOF |
|
163 | $ cat >> $HGRCPATH << EOF | |
162 | > [ui] |
|
164 | > [ui] | |
@@ -177,3 +179,226 b' Check that histedit respect phases' | |||||
177 | [255] |
|
179 | [255] | |
178 |
|
180 | |||
179 |
|
181 | |||
|
182 | Prepare further testing | |||
|
183 | ------------------------------------------- | |||
|
184 | ||||
|
185 | $ for x in g h i j k ; do | |||
|
186 | > echo $x > $x | |||
|
187 | > hg add $x | |||
|
188 | > hg ci -m $x | |||
|
189 | > done | |||
|
190 | $ hg phase --force --secret .~2 | |||
|
191 | $ hg log -G | |||
|
192 | @ 16:ee118ab9fa44 (secret) k | |||
|
193 | | | |||
|
194 | o 15:3a6c53ee7f3d (secret) j | |||
|
195 | | | |||
|
196 | o 14:b605fb7503f2 (secret) i | |||
|
197 | | | |||
|
198 | o 13:7395e1ff83bd (draft) h | |||
|
199 | | | |||
|
200 | o 12:6b70183d2492 (draft) g | |||
|
201 | | | |||
|
202 | o 11:b449568bf7fc (draft) f | |||
|
203 | | | |||
|
204 | o 10:40db8afa467b (public) c | |||
|
205 | | | |||
|
206 | o 0:cb9a9f314b8b (public) a | |||
|
207 | ||||
|
208 | $ cd .. | |||
|
209 | ||||
|
210 | simple phase conservation | |||
|
211 | ------------------------------------------- | |||
|
212 | ||||
|
213 | Resulting changeset should conserve the phase of the original one whatever the | |||
|
214 | phases.new-commit option is. | |||
|
215 | ||||
|
216 | New-commit as draft (default) | |||
|
217 | ||||
|
218 | $ cp -r base simple-draft | |||
|
219 | $ cd simple-draft | |||
|
220 | $ cat > commands.txt <<EOF | |||
|
221 | > edit b449568bf7fc 11 f | |||
|
222 | > pick 6b70183d2492 12 g | |||
|
223 | > pick 7395e1ff83bd 13 h | |||
|
224 | > pick b605fb7503f2 14 i | |||
|
225 | > pick 3a6c53ee7f3d 15 j | |||
|
226 | > pick ee118ab9fa44 16 k | |||
|
227 | > EOF | |||
|
228 | $ hg histedit -r 'b449568bf7fc' --commands commands.txt | |||
|
229 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |||
|
230 | adding f | |||
|
231 | abort: Make changes as needed, you may commit or record as needed now. | |||
|
232 | When you are finished, run hg histedit --continue to resume. | |||
|
233 | [255] | |||
|
234 | $ echo f >> f | |||
|
235 | $ hg histedit --continue | |||
|
236 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
237 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
238 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
239 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
240 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
241 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
242 | $ hg log -G | |||
|
243 | @ 22:12e89af74238 (secret) k | |||
|
244 | | | |||
|
245 | o 21:636a8687b22e (secret) j | |||
|
246 | | | |||
|
247 | o 20:ccaf0a38653f (secret) i | |||
|
248 | | | |||
|
249 | o 19:11a89d1c2613 (draft) h | |||
|
250 | | | |||
|
251 | o 18:c1dec7ca82ea (draft) g | |||
|
252 | | | |||
|
253 | o 17:087281e68428 (draft) f | |||
|
254 | | | |||
|
255 | o 10:40db8afa467b (public) c | |||
|
256 | | | |||
|
257 | o 0:cb9a9f314b8b (public) a | |||
|
258 | ||||
|
259 | $ cd .. | |||
|
260 | ||||
|
261 | ||||
|
262 | New-commit as draft (default) | |||
|
263 | ||||
|
264 | $ cp -r base simple-secret | |||
|
265 | $ cd simple-secret | |||
|
266 | $ cat >> .hg/hgrc << EOF | |||
|
267 | > [phases] | |||
|
268 | > new-commit=secret | |||
|
269 | > EOF | |||
|
270 | $ cat > commands.txt <<EOF | |||
|
271 | > edit b449568bf7fc 11 f | |||
|
272 | > pick 6b70183d2492 12 g | |||
|
273 | > pick 7395e1ff83bd 13 h | |||
|
274 | > pick b605fb7503f2 14 i | |||
|
275 | > pick 3a6c53ee7f3d 15 j | |||
|
276 | > pick ee118ab9fa44 16 k | |||
|
277 | > EOF | |||
|
278 | $ hg histedit -r 'b449568bf7fc' --commands commands.txt | |||
|
279 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |||
|
280 | adding f | |||
|
281 | abort: Make changes as needed, you may commit or record as needed now. | |||
|
282 | When you are finished, run hg histedit --continue to resume. | |||
|
283 | [255] | |||
|
284 | $ echo f >> f | |||
|
285 | $ hg histedit --continue | |||
|
286 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
287 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
288 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
289 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
290 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
291 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
292 | $ hg log -G | |||
|
293 | @ 22:12e89af74238 (secret) k | |||
|
294 | | | |||
|
295 | o 21:636a8687b22e (secret) j | |||
|
296 | | | |||
|
297 | o 20:ccaf0a38653f (secret) i | |||
|
298 | | | |||
|
299 | o 19:11a89d1c2613 (draft) h | |||
|
300 | | | |||
|
301 | o 18:c1dec7ca82ea (draft) g | |||
|
302 | | | |||
|
303 | o 17:087281e68428 (draft) f | |||
|
304 | | | |||
|
305 | o 10:40db8afa467b (public) c | |||
|
306 | | | |||
|
307 | o 0:cb9a9f314b8b (public) a | |||
|
308 | ||||
|
309 | $ cd .. | |||
|
310 | ||||
|
311 | ||||
|
312 | Changeset reordering | |||
|
313 | ------------------------------------------- | |||
|
314 | ||||
|
315 | If a secret changeset is put before a draft one, all descendant should be secret. | |||
|
316 | It seems more important to present the secret phase. | |||
|
317 | ||||
|
318 | $ cp -r base reorder | |||
|
319 | $ cd reorder | |||
|
320 | $ cat > commands.txt <<EOF | |||
|
321 | > pick b449568bf7fc 11 f | |||
|
322 | > pick 3a6c53ee7f3d 15 j | |||
|
323 | > pick 6b70183d2492 12 g | |||
|
324 | > pick b605fb7503f2 14 i | |||
|
325 | > pick 7395e1ff83bd 13 h | |||
|
326 | > pick ee118ab9fa44 16 k | |||
|
327 | > EOF | |||
|
328 | $ hg histedit -r 'b449568bf7fc' --commands commands.txt | |||
|
329 | 0 files updated, 0 files merged, 5 files removed, 0 files unresolved | |||
|
330 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
331 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
332 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
333 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
334 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
335 | $ hg log -G | |||
|
336 | @ 21:558246857888 (secret) k | |||
|
337 | | | |||
|
338 | o 20:28bd44768535 (secret) h | |||
|
339 | | | |||
|
340 | o 19:d5395202aeb9 (secret) i | |||
|
341 | | | |||
|
342 | o 18:21edda8e341b (secret) g | |||
|
343 | | | |||
|
344 | o 17:5ab64f3a4832 (secret) j | |||
|
345 | | | |||
|
346 | o 11:b449568bf7fc (draft) f | |||
|
347 | | | |||
|
348 | o 10:40db8afa467b (public) c | |||
|
349 | | | |||
|
350 | o 0:cb9a9f314b8b (public) a | |||
|
351 | ||||
|
352 | $ cd .. | |||
|
353 | ||||
|
354 | Changeset folding | |||
|
355 | ------------------------------------------- | |||
|
356 | ||||
|
357 | Folding a secret changeset with a draft one turn the result secret (again, | |||
|
358 | better safe than sorry). Folding between same phase changeset still works | |||
|
359 | ||||
|
360 | Note that there is a few reordering in this series for more extensive test | |||
|
361 | ||||
|
362 | $ cp -r base folding | |||
|
363 | $ cd folding | |||
|
364 | $ cat >> .hg/hgrc << EOF | |||
|
365 | > [phases] | |||
|
366 | > new-commit=secret | |||
|
367 | > EOF | |||
|
368 | $ cat > commands.txt <<EOF | |||
|
369 | > pick 7395e1ff83bd 13 h | |||
|
370 | > fold b449568bf7fc 11 f | |||
|
371 | > pick 6b70183d2492 12 g | |||
|
372 | > fold 3a6c53ee7f3d 15 j | |||
|
373 | > pick b605fb7503f2 14 i | |||
|
374 | > fold ee118ab9fa44 16 k | |||
|
375 | > EOF | |||
|
376 | $ hg histedit -r 'b449568bf7fc' --commands commands.txt | |||
|
377 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |||
|
378 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
379 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
380 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
381 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
382 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
383 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
384 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
385 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
386 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
387 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
388 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
389 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
390 | saved backup bundle to $TESTTMP/folding/.hg/strip-backup/58019c66f35f-backup.hg (glob) | |||
|
391 | saved backup bundle to $TESTTMP/folding/.hg/strip-backup/83d1858e070b-backup.hg (glob) | |||
|
392 | saved backup bundle to $TESTTMP/folding/.hg/strip-backup/859969f5ed7e-backup.hg (glob) | |||
|
393 | $ hg log -G | |||
|
394 | @ 19:f9daec13fb98 (secret) i | |||
|
395 | | | |||
|
396 | o 18:49807617f46a (secret) g | |||
|
397 | | | |||
|
398 | o 17:050280826e04 (draft) h | |||
|
399 | | | |||
|
400 | o 10:40db8afa467b (public) c | |||
|
401 | | | |||
|
402 | o 0:cb9a9f314b8b (public) a | |||
|
403 | ||||
|
404 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now