tests/test-ready.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Fri, 01 Jul 2011 17:03:49 +0200
changeset 25 b372166d460d
parent 24 20ac7fa3fd29
child 26 c9da15600775
permissions -rw-r--r--
Add docstring to move head command.

  $ cat >> $HGRCPATH <<EOF
  > [liquid]
  > publish = False
  > [extensions]
  > graphlog=
  > EOF
  $ echo "states=$(echo $(dirname $TESTDIR))/states.py" >> $HGRCPATH

  $ mkcommit() {
  >    echo "$1" > "$1"
  >    hg add "$1"
  >    hg ci -m "add $1"
  > }

  $ hg init alpha
  $ cd alpha
  $ mkdir .hg/states
  $ echo ready > .hg/states/Enabled
  $ mkcommit z
  $ mkcommit a
  $ mkcommit b
  $ mkcommit c
  $ hg published 1
  $ hg log --graph
  @  changeset:   3:090483935bca
  |  tag:         tip
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add c
  |
  o  changeset:   2:720fd97246d7
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add b
  |
  o  changeset:   1:7a344d213ee2
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add a
  |
  o  changeset:   0:d32fd17cb041
     user:        test
     date:        Thu Jan 01 00:00:00 1970 +0000
     summary:     add z
  
  $ cat .hg/states/published-heads
  7a344d213ee2eb3359d94630d4e076460d59dbf0

publishedheads() should return only revision 1:
  $ hg log -r 'publishedheads()' --graph
  o  changeset:   1:7a344d213ee2
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add a
  |

ancestors of publishedheads shows all frozen revisions:
  $ hg log -r '::publishedheads()' --graph
  o  changeset:   1:7a344d213ee2
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add a
  |
  o  changeset:   0:d32fd17cb041
     user:        test
     date:        Thu Jan 01 00:00:00 1970 +0000
     summary:     add z
  
  $ cd ..
  $ hg init beta
  $ cd beta
  $ mkdir .hg/states
  $ echo ready > .hg/states/Enabled
  $ hg pull ../alpha --update
  pulling from ../alpha
  requesting all changes
  adding changesets
  adding manifests
  adding file changes
  added 4 changesets with 4 changes to 4 files
  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg log --graph -r 'publishedheads()'
  o  changeset:   1:7a344d213ee2
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add a
  |

Freeze in beta and push to alpha:
  $ hg published 3
  $ mkcommit d
  $ hg push --traceback ../alpha
  pushing to ../alpha
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 1 changesets with 1 changes to 1 files
  $ cd ../alpha
  $ hg debugrevspec 'publishedheads()'
  3
  $ hg log --graph -r 'publishedheads()'
  @  changeset:   3:090483935bca
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     add c
  |

  $ hg log -r tip
  changeset:   4:fb98f3f5bba0
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     add d
  
  $ mkcommit e
  created new head
  $ hg up -C 4
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg log -r 'publishedheads()'
  changeset:   3:090483935bca
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     add c
  
  $ hg tag -fr tip babar
  $ hg log -r 'publishedheads()'
  changeset:   5:cdaaa31e4239
  tag:         babar
  parent:      3:090483935bca
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     add e
  
  changeset:   6:bd66bf1525ee
  tag:         tip
  parent:      4:fb98f3f5bba0
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added tag babar for changeset cdaaa31e4239
  
Check rollback

  $ hg merge
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)
  $ hg commit -m 'merge'
  $ hg published tip
  $ hg log -r 'publishedheads()'
  changeset:   7:26631d82e09e
  tag:         tip
  parent:      6:bd66bf1525ee
  parent:      5:cdaaa31e4239
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     merge
  
test rollback does not mess up the liquid changeset
  $ mkcommit bibi
  $ hg rollback
  repository tip rolled back to revision 7 (undo commit)
  working directory now based on revision 7
  $ hg log -r 'publishedheads()'
  changeset:   7:26631d82e09e
  tag:         tip
  parent:      6:bd66bf1525ee
  parent:      5:cdaaa31e4239
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     merge
  

test rollback even when rollbacking frozen

  $ mkcommit bubu
  $ hg published tip
  $ hg rollback
  repository tip rolled back to revision 7 (undo commit)
  working directory now based on revision 7
  $ hg log -r 'publishedheads()'
  changeset:   7:26631d82e09e
  tag:         tip
  parent:      6:bd66bf1525ee
  parent:      5:cdaaa31e4239
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     merge