tests/test-states-enable.t
changeset 110 6d461c2143a0
parent 109 a2e8057117d3
child 111 ab4cef4fbd03
equal deleted inserted replaced
109:a2e8057117d3 110:6d461c2143a0
     1 
       
     2   $ cat >> $HGRCPATH <<EOF
       
     3   > [web]
       
     4   > push_ssl = false
       
     5   > allow_push = *
       
     6   > [extensions]
       
     7   > EOF
       
     8   $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> $HGRCPATH
       
     9 
       
    10   $ mkcommit() {
       
    11   >    echo "$1" > "$1"
       
    12   >    hg add "$1"
       
    13   >    hg ci -m "$1"
       
    14   > }
       
    15   $ alias hglog='hg log --template "{rev} {state}\n"'
       
    16 
       
    17   $ hg init alpha
       
    18   $ cd alpha
       
    19   $ mkcommit 0
       
    20   $ mkcommit 1
       
    21 
       
    22 
       
    23 enable draft: existing changesets stay as published and newer are draft
       
    24   $ hg states draft
       
    25   $ hg states
       
    26   published
       
    27   draft
       
    28   $ hglog
       
    29   1 published
       
    30   0 published
       
    31   $ mkcommit 2
       
    32   $ hglog
       
    33   2 draft
       
    34   1 published
       
    35   0 published
       
    36 
       
    37 enable ready: existing changset states are the same, newer are draft
       
    38   $ hg states ready
       
    39   $ hg states
       
    40   published
       
    41   ready
       
    42   draft
       
    43   $ hglog
       
    44   2 draft
       
    45   1 published
       
    46   0 published
       
    47   $ mkcommit 3
       
    48   $ hglog
       
    49   3 draft
       
    50   2 draft
       
    51   1 published
       
    52   0 published
       
    53 
       
    54 
       
    55 publish all then enable states in other order
       
    56   $ hg published tip
       
    57   $ hg states --off ready draft
       
    58   $ hglog
       
    59   3 published
       
    60   2 published
       
    61   1 published
       
    62   0 published
       
    63 
       
    64 enable ready: changesets stay as published and newer are ready
       
    65   $ hg states ready
       
    66   $ hglog
       
    67   3 published
       
    68   2 published
       
    69   1 published
       
    70   0 published
       
    71   $ mkcommit 4
       
    72   $ hglog
       
    73   4 ready
       
    74   3 published
       
    75   2 published
       
    76   1 published
       
    77   0 published
       
    78 
       
    79 enable draft: changesets stay unchanged and newer are draft
       
    80   $ hg states draft
       
    81   $ hglog
       
    82   4 ready
       
    83   3 published
       
    84   2 published
       
    85   1 published
       
    86   0 published
       
    87   $ mkcommit 5
       
    88   $ hglog
       
    89   5 draft
       
    90   4 ready
       
    91   3 published
       
    92   2 published
       
    93   1 published
       
    94   0 published
       
    95 
       
    96 disable ready
       
    97   $ hg states --off ready
       
    98   abort: could not disable non empty state ready
       
    99   (You may want to use `hg published 'readyheads()'`)
       
   100   [255]
       
   101   $ hg publish 4
       
   102   $ hg states --off ready
       
   103   $ hg states
       
   104   published
       
   105   draft
       
   106   $ hglog
       
   107   5 draft
       
   108   4 published
       
   109   3 published
       
   110   2 published
       
   111   1 published
       
   112   0 published
       
   113   $ hg ready 4
       
   114   abort: state ready is not activated
       
   115   (try ``hg states ready`` before)
       
   116   [255]
       
   117 
       
   118 disable draft
       
   119   $ hg states --off draft
       
   120   abort: could not disable non empty state draft
       
   121   (You may want to use `hg published 'draftheads()'`)
       
   122   [255]
       
   123   $ hg publish tip
       
   124   $ hg states --off draft
       
   125   $ hg states
       
   126   published
       
   127   $ hglog
       
   128   5 published
       
   129   4 published
       
   130   3 published
       
   131   2 published
       
   132   1 published
       
   133   0 published
       
   134   $ hg draft 5
       
   135   abort: state draft is not activated
       
   136   (try ``hg states draft`` before)
       
   137   [255]
       
   138 
       
   139 disable published
       
   140   $ hg states --off published
       
   141   abort: could not disable published
       
   142   [255]
       
   143 
       
   144 
       
   145 enable both draft and ready
       
   146   $ hg states draft ready
       
   147   $ hg states
       
   148   published
       
   149   ready
       
   150   draft
       
   151   $ hglog
       
   152   5 published
       
   153   4 published
       
   154   3 published
       
   155   2 published
       
   156   1 published
       
   157   0 published
       
   158   $ mkcommit 6
       
   159   $ hglog
       
   160   6 draft
       
   161   5 published
       
   162   4 published
       
   163   3 published
       
   164   2 published
       
   165   1 published
       
   166   0 published
       
   167 
       
   168 disable both draft and ready
       
   169   $ hg published tip
       
   170   $ hg states --off draft ready
       
   171   $ hg states
       
   172   published
       
   173 
       
   174 clever enabling
       
   175   $ hg states --clever ready
       
   176   $ hglog
       
   177   6 published
       
   178   5 published
       
   179   4 published
       
   180   3 published
       
   181   2 published
       
   182   1 published
       
   183   0 published
       
   184 
       
   185   $ cd ..
       
   186   $ hg init beta
       
   187   $ cd beta
       
   188   $ mkcommit 0
       
   189   $ mkcommit 1
       
   190   $ hg states --clever ready
       
   191   $ hglog
       
   192   1 ready
       
   193   0 ready
       
   194   $ hg states --clever draft
       
   195   $ hglog
       
   196   1 draft
       
   197   0 draft
       
   198 
       
   199