diff tests/test-histedit-obsolete.t @ 18440:35513c59f376

histedit: proper phase conservation (issue3724) Before this changeset, histedit created all new changesets according phases.new-commit option without any regards for the phases of the original changesets. This changeset fix that using the phase of rewritten changeset to decide the phase of the resulting changeset. In case of reordering or folding, we keep secret item secret as it seems the safer path. temporary commit creation are not affected. They are head only and stripped at the end of the histedit. As for the resolution of issue3681 (obsolescence cycle prevention), we do not handle changesets created by edit command.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 16 Jan 2013 19:21:03 +0100
parents c6e3fa134da5
children 21daee53c101
line wrap: on
line diff
--- a/tests/test-histedit-obsolete.t	Wed Jan 16 19:19:56 2013 +0100
+++ b/tests/test-histedit-obsolete.t	Wed Jan 16 19:21:03 2013 +0100
@@ -153,10 +153,12 @@
 
   $ hg rebase  -r 'unstable()' -d .
 
-Check that histedit respect phases
-=========================================
 
-(not directly related to the test file but doesn't deserve it's own test case)
+Test phases support
+===========================================
+
+Check that histedit respect immutability
+-------------------------------------------
 
   $ cat >> $HGRCPATH << EOF
   > [ui]
@@ -177,3 +179,226 @@
   [255]
 
 
+Prepare further testing
+-------------------------------------------
+
+  $ for x in g h i j k ; do
+  >     echo $x > $x
+  >     hg add $x
+  >     hg ci -m $x
+  > done
+  $ hg phase --force --secret .~2
+  $ hg log -G
+  @  16:ee118ab9fa44 (secret) k
+  |
+  o  15:3a6c53ee7f3d (secret) j
+  |
+  o  14:b605fb7503f2 (secret) i
+  |
+  o  13:7395e1ff83bd (draft) h
+  |
+  o  12:6b70183d2492 (draft) g
+  |
+  o  11:b449568bf7fc (draft) f
+  |
+  o  10:40db8afa467b (public) c
+  |
+  o  0:cb9a9f314b8b (public) a
+  
+  $ cd ..
+
+simple phase conservation
+-------------------------------------------
+
+Resulting changeset should conserve the phase of the original one whatever the
+phases.new-commit option is.
+
+New-commit as draft (default)
+
+  $ cp -r base simple-draft
+  $ cd simple-draft
+  $ cat > commands.txt <<EOF
+  > edit b449568bf7fc 11 f
+  > pick 6b70183d2492 12 g
+  > pick 7395e1ff83bd 13 h
+  > pick b605fb7503f2 14 i
+  > pick 3a6c53ee7f3d 15 j
+  > pick ee118ab9fa44 16 k
+  > EOF
+  $ hg histedit -r 'b449568bf7fc' --commands commands.txt
+  0 files updated, 0 files merged, 6 files removed, 0 files unresolved
+  adding f
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  [255]
+  $ echo f >> f
+  $ hg histedit --continue
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -G
+  @  22:12e89af74238 (secret) k
+  |
+  o  21:636a8687b22e (secret) j
+  |
+  o  20:ccaf0a38653f (secret) i
+  |
+  o  19:11a89d1c2613 (draft) h
+  |
+  o  18:c1dec7ca82ea (draft) g
+  |
+  o  17:087281e68428 (draft) f
+  |
+  o  10:40db8afa467b (public) c
+  |
+  o  0:cb9a9f314b8b (public) a
+  
+  $ cd ..
+
+
+New-commit as draft (default)
+
+  $ cp -r base simple-secret
+  $ cd simple-secret
+  $ cat >> .hg/hgrc << EOF
+  > [phases]
+  > new-commit=secret
+  > EOF
+  $ cat > commands.txt <<EOF
+  > edit b449568bf7fc 11 f
+  > pick 6b70183d2492 12 g
+  > pick 7395e1ff83bd 13 h
+  > pick b605fb7503f2 14 i
+  > pick 3a6c53ee7f3d 15 j
+  > pick ee118ab9fa44 16 k
+  > EOF
+  $ hg histedit -r 'b449568bf7fc' --commands commands.txt
+  0 files updated, 0 files merged, 6 files removed, 0 files unresolved
+  adding f
+  abort: Make changes as needed, you may commit or record as needed now.
+  When you are finished, run hg histedit --continue to resume.
+  [255]
+  $ echo f >> f
+  $ hg histedit --continue
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -G
+  @  22:12e89af74238 (secret) k
+  |
+  o  21:636a8687b22e (secret) j
+  |
+  o  20:ccaf0a38653f (secret) i
+  |
+  o  19:11a89d1c2613 (draft) h
+  |
+  o  18:c1dec7ca82ea (draft) g
+  |
+  o  17:087281e68428 (draft) f
+  |
+  o  10:40db8afa467b (public) c
+  |
+  o  0:cb9a9f314b8b (public) a
+  
+  $ cd ..
+
+
+Changeset reordering
+-------------------------------------------
+
+If a secret changeset is put before a draft one, all descendant should be secret.
+It seems more important to present the secret phase.
+
+  $ cp -r base reorder
+  $ cd reorder
+  $ cat > commands.txt <<EOF
+  > pick b449568bf7fc 11 f
+  > pick 3a6c53ee7f3d 15 j
+  > pick 6b70183d2492 12 g
+  > pick b605fb7503f2 14 i
+  > pick 7395e1ff83bd 13 h
+  > pick ee118ab9fa44 16 k
+  > EOF
+  $ hg histedit -r 'b449568bf7fc' --commands commands.txt
+  0 files updated, 0 files merged, 5 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -G
+  @  21:558246857888 (secret) k
+  |
+  o  20:28bd44768535 (secret) h
+  |
+  o  19:d5395202aeb9 (secret) i
+  |
+  o  18:21edda8e341b (secret) g
+  |
+  o  17:5ab64f3a4832 (secret) j
+  |
+  o  11:b449568bf7fc (draft) f
+  |
+  o  10:40db8afa467b (public) c
+  |
+  o  0:cb9a9f314b8b (public) a
+  
+  $ cd ..
+
+Changeset folding
+-------------------------------------------
+
+Folding a secret changeset with a draft one turn the result secret (again,
+better safe than sorry). Folding between same phase changeset still works
+
+Note that there is a few reordering in this series for more extensive test
+
+  $ cp -r base folding
+  $ cd folding
+  $ cat >> .hg/hgrc << EOF
+  > [phases]
+  > new-commit=secret
+  > EOF
+  $ cat > commands.txt <<EOF
+  > pick 7395e1ff83bd 13 h
+  > fold b449568bf7fc 11 f
+  > pick 6b70183d2492 12 g
+  > fold 3a6c53ee7f3d 15 j
+  > pick b605fb7503f2 14 i
+  > fold ee118ab9fa44 16 k
+  > EOF
+  $ hg histedit -r 'b449568bf7fc' --commands commands.txt
+  0 files updated, 0 files merged, 6 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/58019c66f35f-backup.hg (glob)
+  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/83d1858e070b-backup.hg (glob)
+  saved backup bundle to $TESTTMP/folding/.hg/strip-backup/859969f5ed7e-backup.hg (glob)
+  $ hg log -G
+  @  19:f9daec13fb98 (secret) i
+  |
+  o  18:49807617f46a (secret) g
+  |
+  o  17:050280826e04 (draft) h
+  |
+  o  10:40db8afa467b (public) c
+  |
+  o  0:cb9a9f314b8b (public) a
+  
+  $ cd ..