tests/test-states-exact.t
author Pierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 11 Oct 2011 19:22:41 +0200
changeset 103 23c232a81fbe
parent 96 d5170cc7881c
permissions -rw-r--r--
amend: add a --branch option

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

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

  $ hg init alpha
  $ cd alpha
  $ hg states ready draft
  $ mkcommit a
  $ mkcommit b
  $ mkcommit c
  $ mkcommit d
  $ mkcommit e
  $ mkcommit f

|0 - 1 - 2 - 3 - 4 - 5

  $ hg ready 3
  $ hg published 1
  $ hglog
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 published
  a 0 published

very simple case
  $ hg ready --exact 1
  $ hglog
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 published

required state not in statesheads
  $ hg draft --exact 3
  $ hglog
  f 5 draft
  e 4 draft
  d 3 draft
  c 2 ready
  b 1 ready
  a 0 published

remove all other states
  $ hg draft --exact 0
  $ hglog
  f 5 draft
  e 4 draft
  d 3 draft
  c 2 draft
  b 1 draft
  a 0 draft

draft was not there before
  $ hg ready 5
  $ hg draft --exact 4
  $ hglog
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 ready

already in the required state
  $ hg draft --exact 5
  $ hglog
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 ready

backward and foreward
  $ hg published 1
  $ hg ready --exact 1:4
  $ hglog
  f 5 draft
  e 4 ready
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 published

with complex revset
  $ hg draft --exact 'readyheads()'
  $ hglog
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 published
  $ hg ready --exact 'publishedheads()'
  $ hglog
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 ready

Work with branches now
  $ hg up 1
  0 files updated, 0 files merged, 4 files removed, 0 files unresolved
  $ mkcommit g
  created new head
  $ mkcommit h
  $ hg up 3
  2 files updated, 0 files merged, 2 files removed, 0 files unresolved
  $ mkcommit i
  created new head
  $ mkcommit j

|              / - - - - 6 - 7
|0 - 1 - 2 - 3 - 4 - 5
|      \ - - - - - - - - - - - - 8 - 9

Set the new branches as ready
  $ hg ready 9 7
  $ hglog
  j 9 ready
  i 8 ready
  h 7 ready
  g 6 ready
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 ready

with composite revset
  $ hg draft --exact 5:5 7:8
  $ hglog
  j 9 draft
  i 8 draft
  h 7 draft
  g 6 ready
  f 5 draft
  e 4 draft
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 ready

cross braches
  $ hg published 5 7 9
  $ hg draft --exact 4:6
  $ hglog
  j 9 published
  i 8 published
  h 7 draft
  g 6 draft
  f 5 draft
  e 4 draft
  d 3 published
  c 2 published
  b 1 published
  a 0 published

Ok more complicated stuffs
  $ hg up 7
  2 files updated, 0 files merged, 4 files removed, 0 files unresolved
  $ mkcommit k
  $ hg published 5 9 10

|              / - - - - 6 - 7 - - - - - 10
|0 - 1 - 2 - 3 - 4 - 5
|      \ - - - - - - - - - - - - 8 - 9

cross branches and propagation on the same branche
  $ hg draft --exact 5:8
  $ hglog
  k 10 draft
  j 9 draft
  i 8 draft
  h 7 draft
  g 6 draft
  f 5 draft
  e 4 published
  d 3 published
  c 2 published
  b 1 published
  a 0 published


cross branches and propagation on multiple branches
  $ hg published 10
  $ hg ready --exact 3 6:8
  $ hglog
  k 10 ready
  j 9 draft
  i 8 ready
  h 7 ready
  g 6 ready
  f 5 draft
  e 4 ready
  d 3 ready
  c 2 published
  b 1 published
  a 0 published

propagate ready on multiple branches taht contains draft states
  $ hg ready --exact 1
  $ hglog
  k 10 ready
  j 9 draft
  i 8 ready
  h 7 ready
  g 6 ready
  f 5 draft
  e 4 ready
  d 3 ready
  c 2 ready
  b 1 ready
  a 0 published

brute propagation
  $ hg draft --exact 0
  $ hglog
  k 10 draft
  j 9 draft
  i 8 draft
  h 7 draft
  g 6 draft
  f 5 draft
  e 4 draft
  d 3 draft
  c 2 draft
  b 1 draft
  a 0 draft

forget non activated state
  $ hg init beta
  $ cd beta
  $ hg states draft
  $ mkcommit a
  $ mkcommit b
  $ mkcommit c
  $ mkcommit d
  $ mkcommit e
  $ mkcommit f
  $ hg published 5
  $ hg draft --exact 3
  $ hglog
  f 5 draft
  e 4 draft
  d 3 draft
  c 2 published
  b 1 published
  a 0 published
  $ hg states
  published
  draft
  $ hg ready 3
  abort: state ready is not activated
  (try ``hg states ready`` before)
  [255]
  $ hglog
  f 5 draft
  e 4 draft
  d 3 draft
  c 2 published
  b 1 published
  a 0 published