view tests/test-state-strip.t @ 108:85271a8a7fb9

Properly inherit phase of relocated changeset.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 19 Dec 2011 12:18:04 +0100
parents 21dbec91e775
children
line wrap: on
line source



  $ cat >> $HGRCPATH <<EOF
  > [web]
  > push_ssl = false
  > allow_push = *
  > [extensions]
  > hgext.mq=
  > hgext.graphlog=
  > EOF
  $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> $HGRCPATH

  $ mkcommit() {
  >    echo "$1" > "$1"
  >    hg add "$1"
  >    hg ci -m "$1"
  > }
  $ alias hglog='hg glog --template "{desc} {state} {node}\n"'

  $ hg init alpha
  $ cd alpha
  $ hg states draft ready
  $ mkcommit 0
  $ mkcommit 1
  $ hg up 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ mkcommit 2
  created new head
  $ mkcommit 3
  $ mkcommit 4
  $ hg up 3
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ mkcommit 5
  created new head
  $ hg up 1
  1 files updated, 0 files merged, 3 files removed, 0 files unresolved
  $ mkcommit 6
  $ hg published 6
  $ hg ready 4
  $ hglog
  @  6 published 2a653cad66937648173a936140f09a0e780afd76
  |
  | o  5 draft ffe7eb8acef3efeceaa566b85a1ac419b0ecb856
  | |
  | | o  4 ready 138777f75ddeb6ee0b527cfdb0eebbd1e0037bf6
  | |/
  | o  3 ready 0915e256b0ca7f81dace67bc6fd512bfd1bcab85
  | |
  | o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  | |
  o |  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  

We strip a published heads, so published heads 6 -> 1
  $ hg strip -n 6
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hglog
  o  5 draft ffe7eb8acef3efeceaa566b85a1ac419b0ecb856
  |
  | o  4 ready 138777f75ddeb6ee0b527cfdb0eebbd1e0037bf6
  |/
  o  3 ready 0915e256b0ca7f81dace67bc6fd512bfd1bcab85
  |
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  

Back to the previous configuration.
Then strip accros branches and remove draft changesets completly, and cut in
the middle of ready changesets
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ mkcommit 6
  $ hg strip -n 3:6
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hglog
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
Now merge 1 & 2 then strip merging changeset
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg merge 2
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg commit -m Merge
  $ hg strip -n 3
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hglog
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
Do the same but with merge changeset as ready
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg merge 2
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg commit -m Merge
  $ hg ready 3
  $ hg strip -n 3
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hglog
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
  $ hg log --template "{rev} {node}\n" -r 'readyheads()'
  2 a00ba83de58390cbbdae1fc580df0bb0db2e8e88

More complecated case: a merging changeset inheritate a ready state of one of
its child and have another child in draft. And We strip the ready child
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg merge 2
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m 3
  $ mkcommit 4
  $ hg up 3
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ mkcommit 5
  created new head
  $ mkcommit 6
  $ hg ready 6
  $ hglog
  @  6 ready bfd1096b3dd69e57c184e9f43646a9b7e0dd5927
  |
  o  5 ready 8195da2a3c382a4acd7ce796b4bc74092f1875eb
  |
  | o  4 draft 6aaadc67da669af964adabe681c0a78f46b7ce58
  |/
  o    3 ready e7cd12398be70c568cefab9b4ad86a8a2a728a09
  |\
  | o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  | |
  o |  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
  $ hg strip -n 3
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
  $ hglog
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
Quitelly the same as before but we strip before the merging node, from another
branch than the ready changeset, so this changeset is not a parent of the
the explicitly stripped node.
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ mkcommit 3
  $ hg up 2
  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ hg merge 3
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m '4'
  $ mkcommit 5
  $ hg published 3
  $ hg ready 4
  $ hglog
  @  5 draft 0777a3135ec5396c57db4402c71ab8cba2a0ef7e
  |
  o    4 ready 667667458ecc8cf7763dee1ae172a5a9ebf115f3
  |\
  | o  3 published 03fc50a1c0074093104ff6c5357c486781742b64
  | |
  o |  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  | |
  | o  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
  $ hg strip -n 3
  0 files updated, 0 files merged, 3 files removed, 0 files unresolved
  $ hglog
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  

pathologic case
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ mkcommit 3
  $ hg up 2
  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ hg merge 3
  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m '4'
  $ mkcommit 5
  $ hg up 3
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ mkcommit 6
  created new head
  $ hg published 3
  $ hg ready 4
  $ hglog
  @  6 draft aeb74c71311d9305498bbf371746d095b80ff51f
  |
  | o  5 draft 0777a3135ec5396c57db4402c71ab8cba2a0ef7e
  | |
  | o  4 ready 667667458ecc8cf7763dee1ae172a5a9ebf115f3
  |/|
  o |  3 published 03fc50a1c0074093104ff6c5357c486781742b64
  | |
  | o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  | |
  o |  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
  $ hg strip -n 3
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ hglog
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
pathologic case
  $ hg up 1
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg merge 2
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m 3
  $ hg up 2
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ mkcommit 4
  created new head
  $ hg merge 3
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg ci -m 5
  $ hg up 4
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ mkcommit 6
  created new head
  $ hg ready 4
  $ hglog
  @  6 draft 036d507f2b771a3b7cc88580c93d5037bf4bf1bf
  |
  | o  5 draft 19788060dab104e9385a14c4be2fc5678b9433f0
  |/|
  o |  4 ready 0fc8455e844047eab375a1f51816f697551e34cf
  | |
  | o  3 draft e7cd12398be70c568cefab9b4ad86a8a2a728a09
  |/|
  o |  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  | |
  | o  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
  |/
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
  $ hg strip -n 1
  $ hglog
  @  6 draft 036d507f2b771a3b7cc88580c93d5037bf4bf1bf
  |
  o  4 ready 0fc8455e844047eab375a1f51816f697551e34cf
  |
  o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
  |
  o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
  
  $ hg log --template '{desc} {state} {node}\n' -r 'readyheads()'
  4 ready 0fc8455e844047eab375a1f51816f697551e34cf