--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-states-enable.t Sun Sep 25 12:46:45 2011 +0200
@@ -0,0 +1,199 @@
+
+ $ 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 "{rev} {state}\n"'
+
+ $ hg init alpha
+ $ cd alpha
+ $ mkcommit 0
+ $ mkcommit 1
+
+
+enable draft: existing changesets stay as published and newer are draft
+ $ hg states draft
+ $ hg states
+ published
+ draft
+ $ hglog
+ 1 published
+ 0 published
+ $ mkcommit 2
+ $ hglog
+ 2 draft
+ 1 published
+ 0 published
+
+enable ready: existing changset states are the same, newer are draft
+ $ hg states ready
+ $ hg states
+ published
+ ready
+ draft
+ $ hglog
+ 2 draft
+ 1 published
+ 0 published
+ $ mkcommit 3
+ $ hglog
+ 3 draft
+ 2 draft
+ 1 published
+ 0 published
+
+
+publish all then enable states in other order
+ $ hg published tip
+ $ hg states --off ready draft
+ $ hglog
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+
+enable ready: changesets stay as published and newer are ready
+ $ hg states ready
+ $ hglog
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+ $ mkcommit 4
+ $ hglog
+ 4 ready
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+
+enable draft: changesets stay unchanged and newer are draft
+ $ hg states draft
+ $ hglog
+ 4 ready
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+ $ mkcommit 5
+ $ hglog
+ 5 draft
+ 4 ready
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+
+disable ready
+ $ hg states --off ready
+ abort: could not disable non empty state ready
+ (You may want to use `hg published 'readyheads()'`)
+ [255]
+ $ hg publish 4
+ $ hg states --off ready
+ $ hg states
+ published
+ draft
+ $ hglog
+ 5 draft
+ 4 published
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+ $ hg ready 4
+ abort: state ready is not activated
+ (try ``hg states ready`` before)
+ [255]
+
+disable draft
+ $ hg states --off draft
+ abort: could not disable non empty state draft
+ (You may want to use `hg published 'draftheads()'`)
+ [255]
+ $ hg publish tip
+ $ hg states --off draft
+ $ hg states
+ published
+ $ hglog
+ 5 published
+ 4 published
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+ $ hg draft 5
+ abort: state draft is not activated
+ (try ``hg states draft`` before)
+ [255]
+
+disable published
+ $ hg states --off published
+ abort: could not disable published
+ [255]
+
+
+enable both draft and ready
+ $ hg states draft ready
+ $ hg states
+ published
+ ready
+ draft
+ $ hglog
+ 5 published
+ 4 published
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+ $ mkcommit 6
+ $ hglog
+ 6 draft
+ 5 published
+ 4 published
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+
+disable both draft and ready
+ $ hg published tip
+ $ hg states --off draft ready
+ $ hg states
+ published
+
+clever enabling
+ $ hg states --clever ready
+ $ hglog
+ 6 published
+ 5 published
+ 4 published
+ 3 published
+ 2 published
+ 1 published
+ 0 published
+
+ $ cd ..
+ $ hg init beta
+ $ cd beta
+ $ mkcommit 0
+ $ mkcommit 1
+ $ hg states --clever ready
+ $ hglog
+ 1 ready
+ 0 ready
+ $ hg states --clever draft
+ $ hglog
+ 1 draft
+ 0 draft
+
+