tests/test-state-strip.t
changeset 110 6d461c2143a0
parent 109 a2e8057117d3
child 111 ab4cef4fbd03
equal deleted inserted replaced
109:a2e8057117d3 110:6d461c2143a0
     1 
       
     2 
       
     3   $ cat >> $HGRCPATH <<EOF
       
     4   > [web]
       
     5   > push_ssl = false
       
     6   > allow_push = *
       
     7   > [extensions]
       
     8   > hgext.mq=
       
     9   > hgext.graphlog=
       
    10   > EOF
       
    11   $ echo "states=$(echo $(dirname $TESTDIR))/hgext/states.py" >> $HGRCPATH
       
    12 
       
    13   $ mkcommit() {
       
    14   >    echo "$1" > "$1"
       
    15   >    hg add "$1"
       
    16   >    hg ci -m "$1"
       
    17   > }
       
    18   $ alias hglog='hg glog --template "{desc} {state} {node}\n"'
       
    19 
       
    20   $ hg init alpha
       
    21   $ cd alpha
       
    22   $ hg states draft ready
       
    23   $ mkcommit 0
       
    24   $ mkcommit 1
       
    25   $ hg up 0
       
    26   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    27   $ mkcommit 2
       
    28   created new head
       
    29   $ mkcommit 3
       
    30   $ mkcommit 4
       
    31   $ hg up 3
       
    32   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    33   $ mkcommit 5
       
    34   created new head
       
    35   $ hg up 1
       
    36   1 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
    37   $ mkcommit 6
       
    38   $ hg published 6
       
    39   $ hg ready 4
       
    40   $ hglog
       
    41   @  6 published 2a653cad66937648173a936140f09a0e780afd76
       
    42   |
       
    43   | o  5 draft ffe7eb8acef3efeceaa566b85a1ac419b0ecb856
       
    44   | |
       
    45   | | o  4 ready 138777f75ddeb6ee0b527cfdb0eebbd1e0037bf6
       
    46   | |/
       
    47   | o  3 ready 0915e256b0ca7f81dace67bc6fd512bfd1bcab85
       
    48   | |
       
    49   | o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
    50   | |
       
    51   o |  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
    52   |/
       
    53   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
    54   
       
    55 
       
    56 We strip a published heads, so published heads 6 -> 1
       
    57   $ hg strip -n 6
       
    58   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    59   $ hglog
       
    60   o  5 draft ffe7eb8acef3efeceaa566b85a1ac419b0ecb856
       
    61   |
       
    62   | o  4 ready 138777f75ddeb6ee0b527cfdb0eebbd1e0037bf6
       
    63   |/
       
    64   o  3 ready 0915e256b0ca7f81dace67bc6fd512bfd1bcab85
       
    65   |
       
    66   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
    67   |
       
    68   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
    69   |/
       
    70   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
    71   
       
    72 
       
    73 Back to the previous configuration.
       
    74 Then strip accros branches and remove draft changesets completly, and cut in
       
    75 the middle of ready changesets
       
    76   $ hg up 1
       
    77   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    78   $ mkcommit 6
       
    79   $ hg strip -n 3:6
       
    80   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    81   $ hglog
       
    82   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
    83   |
       
    84   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
    85   |/
       
    86   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
    87   
       
    88 Now merge 1 & 2 then strip merging changeset
       
    89   $ hg up 1
       
    90   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    91   $ hg merge 2
       
    92   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    93   (branch merge, don't forget to commit)
       
    94   $ hg commit -m Merge
       
    95   $ hg strip -n 3
       
    96   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
    97   $ hglog
       
    98   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
    99   |
       
   100   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   101   |/
       
   102   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   103   
       
   104 Do the same but with merge changeset as ready
       
   105   $ hg up 1
       
   106   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   107   $ hg merge 2
       
   108   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   109   (branch merge, don't forget to commit)
       
   110   $ hg commit -m Merge
       
   111   $ hg ready 3
       
   112   $ hg strip -n 3
       
   113   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   114   $ hglog
       
   115   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   116   |
       
   117   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   118   |/
       
   119   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   120   
       
   121   $ hg log --template "{rev} {node}\n" -r 'readyheads()'
       
   122   2 a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   123 
       
   124 More complecated case: a merging changeset inheritate a ready state of one of
       
   125 its child and have another child in draft. And We strip the ready child
       
   126   $ hg up 1
       
   127   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   128   $ hg merge 2
       
   129   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   130   (branch merge, don't forget to commit)
       
   131   $ hg ci -m 3
       
   132   $ mkcommit 4
       
   133   $ hg up 3
       
   134   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   135   $ mkcommit 5
       
   136   created new head
       
   137   $ mkcommit 6
       
   138   $ hg ready 6
       
   139   $ hglog
       
   140   @  6 ready bfd1096b3dd69e57c184e9f43646a9b7e0dd5927
       
   141   |
       
   142   o  5 ready 8195da2a3c382a4acd7ce796b4bc74092f1875eb
       
   143   |
       
   144   | o  4 draft 6aaadc67da669af964adabe681c0a78f46b7ce58
       
   145   |/
       
   146   o    3 ready e7cd12398be70c568cefab9b4ad86a8a2a728a09
       
   147   |\
       
   148   | o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   149   | |
       
   150   o |  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   151   |/
       
   152   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   153   
       
   154   $ hg strip -n 3
       
   155   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
   156   $ hglog
       
   157   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   158   |
       
   159   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   160   |/
       
   161   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   162   
       
   163 Quitelly the same as before but we strip before the merging node, from another
       
   164 branch than the ready changeset, so this changeset is not a parent of the
       
   165 the explicitly stripped node.
       
   166   $ hg up 1
       
   167   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   168   $ mkcommit 3
       
   169   $ hg up 2
       
   170   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   171   $ hg merge 3
       
   172   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   173   (branch merge, don't forget to commit)
       
   174   $ hg ci -m '4'
       
   175   $ mkcommit 5
       
   176   $ hg published 3
       
   177   $ hg ready 4
       
   178   $ hglog
       
   179   @  5 draft 0777a3135ec5396c57db4402c71ab8cba2a0ef7e
       
   180   |
       
   181   o    4 ready 667667458ecc8cf7763dee1ae172a5a9ebf115f3
       
   182   |\
       
   183   | o  3 published 03fc50a1c0074093104ff6c5357c486781742b64
       
   184   | |
       
   185   o |  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   186   | |
       
   187   | o  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   188   |/
       
   189   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   190   
       
   191   $ hg strip -n 3
       
   192   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
       
   193   $ hglog
       
   194   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   195   |
       
   196   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   197   |/
       
   198   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   199   
       
   200 
       
   201 pathologic case
       
   202   $ hg up 1
       
   203   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   204   $ mkcommit 3
       
   205   $ hg up 2
       
   206   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   207   $ hg merge 3
       
   208   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   209   (branch merge, don't forget to commit)
       
   210   $ hg ci -m '4'
       
   211   $ mkcommit 5
       
   212   $ hg up 3
       
   213   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   214   $ mkcommit 6
       
   215   created new head
       
   216   $ hg published 3
       
   217   $ hg ready 4
       
   218   $ hglog
       
   219   @  6 draft aeb74c71311d9305498bbf371746d095b80ff51f
       
   220   |
       
   221   | o  5 draft 0777a3135ec5396c57db4402c71ab8cba2a0ef7e
       
   222   | |
       
   223   | o  4 ready 667667458ecc8cf7763dee1ae172a5a9ebf115f3
       
   224   |/|
       
   225   o |  3 published 03fc50a1c0074093104ff6c5357c486781742b64
       
   226   | |
       
   227   | o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   228   | |
       
   229   o |  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   230   |/
       
   231   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   232   
       
   233   $ hg strip -n 3
       
   234   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   235   $ hglog
       
   236   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   237   |
       
   238   | @  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   239   |/
       
   240   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   241   
       
   242 pathologic case
       
   243   $ hg up 1
       
   244   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   245   $ hg merge 2
       
   246   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   247   (branch merge, don't forget to commit)
       
   248   $ hg ci -m 3
       
   249   $ hg up 2
       
   250   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   251   $ mkcommit 4
       
   252   created new head
       
   253   $ hg merge 3
       
   254   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   255   (branch merge, don't forget to commit)
       
   256   $ hg ci -m 5
       
   257   $ hg up 4
       
   258   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   259   $ mkcommit 6
       
   260   created new head
       
   261   $ hg ready 4
       
   262   $ hglog
       
   263   @  6 draft 036d507f2b771a3b7cc88580c93d5037bf4bf1bf
       
   264   |
       
   265   | o  5 draft 19788060dab104e9385a14c4be2fc5678b9433f0
       
   266   |/|
       
   267   o |  4 ready 0fc8455e844047eab375a1f51816f697551e34cf
       
   268   | |
       
   269   | o  3 draft e7cd12398be70c568cefab9b4ad86a8a2a728a09
       
   270   |/|
       
   271   o |  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   272   | |
       
   273   | o  1 published e8342c9a2ed18fb27f9fdfc48a3105d164a06e77
       
   274   |/
       
   275   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   276   
       
   277   $ hg strip -n 1
       
   278   $ hglog
       
   279   @  6 draft 036d507f2b771a3b7cc88580c93d5037bf4bf1bf
       
   280   |
       
   281   o  4 ready 0fc8455e844047eab375a1f51816f697551e34cf
       
   282   |
       
   283   o  2 ready a00ba83de58390cbbdae1fc580df0bb0db2e8e88
       
   284   |
       
   285   o  0 published 06254b90631198c9b9e426be9886af92fedc9a2d
       
   286   
       
   287   $ hg log --template '{desc} {state} {node}\n' -r 'readyheads()'
       
   288   4 ready 0fc8455e844047eab375a1f51816f697551e34cf