tests/test-states-exact.t
changeset 110 6d461c2143a0
parent 109 a2e8057117d3
child 111 ab4cef4fbd03
equal deleted inserted replaced
109:a2e8057117d3 110:6d461c2143a0
     1   $ cat >> $HGRCPATH <<EOF
       
     2   > [web]
       
     3   > push_ssl = false
       
     4   > allow_push = *
       
     5   > [extensions]
       
     6   > EOF
       
     7   $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> $HGRCPATH
       
     8 
       
     9   $ mkcommit() {
       
    10   >    echo "$1" > "$1"
       
    11   >    hg add "$1"
       
    12   >    hg ci -m "$1"
       
    13   > }
       
    14   $ alias hglog='hg log --template "{desc|short} {rev} {state}\n"'
       
    15 
       
    16   $ hg init alpha
       
    17   $ cd alpha
       
    18   $ hg states ready draft
       
    19   $ mkcommit a
       
    20   $ mkcommit b
       
    21   $ mkcommit c
       
    22   $ mkcommit d
       
    23   $ mkcommit e
       
    24   $ mkcommit f
       
    25 
       
    26 |0 - 1 - 2 - 3 - 4 - 5
       
    27 
       
    28   $ hg ready 3
       
    29   $ hg published 1
       
    30   $ hglog
       
    31   f 5 draft
       
    32   e 4 draft
       
    33   d 3 ready
       
    34   c 2 ready
       
    35   b 1 published
       
    36   a 0 published
       
    37 
       
    38 very simple case
       
    39   $ hg ready --exact 1
       
    40   $ hglog
       
    41   f 5 draft
       
    42   e 4 draft
       
    43   d 3 ready
       
    44   c 2 ready
       
    45   b 1 ready
       
    46   a 0 published
       
    47 
       
    48 required state not in statesheads
       
    49   $ hg draft --exact 3
       
    50   $ hglog
       
    51   f 5 draft
       
    52   e 4 draft
       
    53   d 3 draft
       
    54   c 2 ready
       
    55   b 1 ready
       
    56   a 0 published
       
    57 
       
    58 remove all other states
       
    59   $ hg draft --exact 0
       
    60   $ hglog
       
    61   f 5 draft
       
    62   e 4 draft
       
    63   d 3 draft
       
    64   c 2 draft
       
    65   b 1 draft
       
    66   a 0 draft
       
    67 
       
    68 draft was not there before
       
    69   $ hg ready 5
       
    70   $ hg draft --exact 4
       
    71   $ hglog
       
    72   f 5 draft
       
    73   e 4 draft
       
    74   d 3 ready
       
    75   c 2 ready
       
    76   b 1 ready
       
    77   a 0 ready
       
    78 
       
    79 already in the required state
       
    80   $ hg draft --exact 5
       
    81   $ hglog
       
    82   f 5 draft
       
    83   e 4 draft
       
    84   d 3 ready
       
    85   c 2 ready
       
    86   b 1 ready
       
    87   a 0 ready
       
    88 
       
    89 backward and foreward
       
    90   $ hg published 1
       
    91   $ hg ready --exact 1:4
       
    92   $ hglog
       
    93   f 5 draft
       
    94   e 4 ready
       
    95   d 3 ready
       
    96   c 2 ready
       
    97   b 1 ready
       
    98   a 0 published
       
    99 
       
   100 with complex revset
       
   101   $ hg draft --exact 'readyheads()'
       
   102   $ hglog
       
   103   f 5 draft
       
   104   e 4 draft
       
   105   d 3 ready
       
   106   c 2 ready
       
   107   b 1 ready
       
   108   a 0 published
       
   109   $ hg ready --exact 'publishedheads()'
       
   110   $ hglog
       
   111   f 5 draft
       
   112   e 4 draft
       
   113   d 3 ready
       
   114   c 2 ready
       
   115   b 1 ready
       
   116   a 0 ready
       
   117 
       
   118 Work with branches now
       
   119   $ hg up 1
       
   120   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
       
   121   $ mkcommit g
       
   122   created new head
       
   123   $ mkcommit h
       
   124   $ hg up 3
       
   125   2 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   126   $ mkcommit i
       
   127   created new head
       
   128   $ mkcommit j
       
   129 
       
   130 |              / - - - - 6 - 7
       
   131 |0 - 1 - 2 - 3 - 4 - 5
       
   132 |      \ - - - - - - - - - - - - 8 - 9
       
   133 
       
   134 Set the new branches as ready
       
   135   $ hg ready 9 7
       
   136   $ hglog
       
   137   j 9 ready
       
   138   i 8 ready
       
   139   h 7 ready
       
   140   g 6 ready
       
   141   f 5 draft
       
   142   e 4 draft
       
   143   d 3 ready
       
   144   c 2 ready
       
   145   b 1 ready
       
   146   a 0 ready
       
   147 
       
   148 with composite revset
       
   149   $ hg draft --exact 5:5 7:8
       
   150   $ hglog
       
   151   j 9 draft
       
   152   i 8 draft
       
   153   h 7 draft
       
   154   g 6 ready
       
   155   f 5 draft
       
   156   e 4 draft
       
   157   d 3 ready
       
   158   c 2 ready
       
   159   b 1 ready
       
   160   a 0 ready
       
   161 
       
   162 cross braches
       
   163   $ hg published 5 7 9
       
   164   $ hg draft --exact 4:6
       
   165   $ hglog
       
   166   j 9 published
       
   167   i 8 published
       
   168   h 7 draft
       
   169   g 6 draft
       
   170   f 5 draft
       
   171   e 4 draft
       
   172   d 3 published
       
   173   c 2 published
       
   174   b 1 published
       
   175   a 0 published
       
   176 
       
   177 Ok more complicated stuffs
       
   178   $ hg up 7
       
   179   2 files updated, 0 files merged, 4 files removed, 0 files unresolved
       
   180   $ mkcommit k
       
   181   $ hg published 5 9 10
       
   182 
       
   183 |              / - - - - 6 - 7 - - - - - 10
       
   184 |0 - 1 - 2 - 3 - 4 - 5
       
   185 |      \ - - - - - - - - - - - - 8 - 9
       
   186 
       
   187 cross branches and propagation on the same branche
       
   188   $ hg draft --exact 5:8
       
   189   $ hglog
       
   190   k 10 draft
       
   191   j 9 draft
       
   192   i 8 draft
       
   193   h 7 draft
       
   194   g 6 draft
       
   195   f 5 draft
       
   196   e 4 published
       
   197   d 3 published
       
   198   c 2 published
       
   199   b 1 published
       
   200   a 0 published
       
   201 
       
   202 
       
   203 cross branches and propagation on multiple branches
       
   204   $ hg published 10
       
   205   $ hg ready --exact 3 6:8
       
   206   $ hglog
       
   207   k 10 ready
       
   208   j 9 draft
       
   209   i 8 ready
       
   210   h 7 ready
       
   211   g 6 ready
       
   212   f 5 draft
       
   213   e 4 ready
       
   214   d 3 ready
       
   215   c 2 published
       
   216   b 1 published
       
   217   a 0 published
       
   218 
       
   219 propagate ready on multiple branches taht contains draft states
       
   220   $ hg ready --exact 1
       
   221   $ hglog
       
   222   k 10 ready
       
   223   j 9 draft
       
   224   i 8 ready
       
   225   h 7 ready
       
   226   g 6 ready
       
   227   f 5 draft
       
   228   e 4 ready
       
   229   d 3 ready
       
   230   c 2 ready
       
   231   b 1 ready
       
   232   a 0 published
       
   233 
       
   234 brute propagation
       
   235   $ hg draft --exact 0
       
   236   $ hglog
       
   237   k 10 draft
       
   238   j 9 draft
       
   239   i 8 draft
       
   240   h 7 draft
       
   241   g 6 draft
       
   242   f 5 draft
       
   243   e 4 draft
       
   244   d 3 draft
       
   245   c 2 draft
       
   246   b 1 draft
       
   247   a 0 draft
       
   248 
       
   249 forget non activated state
       
   250   $ hg init beta
       
   251   $ cd beta
       
   252   $ hg states draft
       
   253   $ mkcommit a
       
   254   $ mkcommit b
       
   255   $ mkcommit c
       
   256   $ mkcommit d
       
   257   $ mkcommit e
       
   258   $ mkcommit f
       
   259   $ hg published 5
       
   260   $ hg draft --exact 3
       
   261   $ hglog
       
   262   f 5 draft
       
   263   e 4 draft
       
   264   d 3 draft
       
   265   c 2 published
       
   266   b 1 published
       
   267   a 0 published
       
   268   $ hg states
       
   269   published
       
   270   draft
       
   271   $ hg ready 3
       
   272   abort: state ready is not activated
       
   273   (try ``hg states ready`` before)
       
   274   [255]
       
   275   $ hglog
       
   276   f 5 draft
       
   277   e 4 draft
       
   278   d 3 draft
       
   279   c 2 published
       
   280   b 1 published
       
   281   a 0 published
       
   282