tests/test-stack-branch.t
branchmercurial-3.9
changeset 2801 49494d0155b7
parent 2800 13c4d518327a
parent 2702 167567795f6c
child 2802 41c9a4df628e
child 2811 35d053d7bd87
equal deleted inserted replaced
2800:13c4d518327a 2801:49494d0155b7
     1 
       
     2   $ . "$TESTDIR/testlib/topic_setup.sh"
       
     3 
       
     4 Initial setup
       
     5 
       
     6   $ cat << EOF >> $HGRCPATH
       
     7   > [ui]
       
     8   > logtemplate = {rev} {branch} \{{get(namespaces, "topics")}} {phase} {desc|firstline}\n
       
     9   > [experimental]
       
    10   > evolution=createmarkers,exchange,allowunstable
       
    11   > EOF
       
    12 
       
    13   $ hg init main
       
    14   $ cd main
       
    15   $ hg branch other
       
    16   marked working directory as branch other
       
    17   (branches are permanent and global, did you want a bookmark?)
       
    18   $ echo aaa > aaa
       
    19   $ hg add aaa
       
    20   $ hg commit -m c_a
       
    21   $ echo aaa > bbb
       
    22   $ hg add bbb
       
    23   $ hg commit -m c_b
       
    24   $ hg branch foo
       
    25   marked working directory as branch foo
       
    26   $ echo aaa > ccc
       
    27   $ hg add ccc
       
    28   $ hg commit -m c_c
       
    29   $ echo aaa > ddd
       
    30   $ hg add ddd
       
    31   $ hg commit -m c_d
       
    32   $ echo aaa > eee
       
    33   $ hg add eee
       
    34   $ hg commit -m c_e
       
    35   $ echo aaa > fff
       
    36   $ hg add fff
       
    37   $ hg commit -m c_f
       
    38   $ hg log -G
       
    39   @  5 foo {} draft c_f
       
    40   |
       
    41   o  4 foo {} draft c_e
       
    42   |
       
    43   o  3 foo {} draft c_d
       
    44   |
       
    45   o  2 foo {} draft c_c
       
    46   |
       
    47   o  1 other {} draft c_b
       
    48   |
       
    49   o  0 other {} draft c_a
       
    50   
       
    51 
       
    52 Check that topic without any parent does not crash --list
       
    53 ---------------------------------------------------------
       
    54 
       
    55   $ hg up other
       
    56   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
       
    57   $ hg stack
       
    58   ### branch: other
       
    59   b2@ c_b (current)
       
    60   b1: c_a
       
    61   $ hg phase --public 'branch("other")'
       
    62   $ hg up foo
       
    63   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    64 
       
    65 Simple test
       
    66 -----------
       
    67 
       
    68 'hg stack' list all changeset in the topic
       
    69 
       
    70   $ hg branch
       
    71   foo
       
    72   $ hg stack
       
    73   ### branch: foo
       
    74   b4@ c_f (current)
       
    75   b3: c_e
       
    76   b2: c_d
       
    77   b1: c_c
       
    78   b0^ c_b (base)
       
    79   $ hg stack -v
       
    80   ### branch: foo
       
    81   b4(913c298d8b0a)@ c_f (current)
       
    82   b3(4f2a69f6d380): c_e
       
    83   b2(f61adbacd17a): c_d
       
    84   b1(3e9313bc4b71): c_c
       
    85   b0(4a04f1104a27)^ c_b (base)
       
    86 
       
    87 Test "t#" reference
       
    88 -------------------
       
    89 
       
    90   $ hg up b2
       
    91   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    92   $ hg up foo
       
    93   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    94   $ hg up b42
       
    95   abort: cannot resolve "b42": branch "foo" has only 4 changesets
       
    96   [255]
       
    97   $ hg up b2
       
    98   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    99   $ hg summary
       
   100   parent: 3:f61adbacd17a 
       
   101    c_d
       
   102   branch: foo
       
   103   commit: (clean)
       
   104   update: 2 new changesets (update)
       
   105   phases: 4 draft
       
   106 
       
   107 Case with some of the branch unstable
       
   108 ------------------------------------
       
   109 
       
   110   $ echo bbb > ddd
       
   111   $ hg commit --amend
       
   112   $ hg log -G
       
   113   @  7 foo {} draft c_d
       
   114   |
       
   115   | o  5 foo {} draft c_f
       
   116   | |
       
   117   | o  4 foo {} draft c_e
       
   118   | |
       
   119   | x  3 foo {} draft c_d
       
   120   |/
       
   121   o  2 foo {} draft c_c
       
   122   |
       
   123   o  1 other {} public c_b
       
   124   |
       
   125   o  0 other {} public c_a
       
   126   
       
   127   $ hg stack
       
   128   ### branch: foo
       
   129   b4$ c_f (unstable)
       
   130   b3$ c_e (unstable)
       
   131   b2@ c_d (current)
       
   132   b1: c_c
       
   133   b0^ c_b (base)
       
   134   $ hg up b3
       
   135   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   136   $ hg stack
       
   137   ### branch: foo
       
   138   b4$ c_f (unstable)
       
   139   b3$ c_e (current unstable)
       
   140   b2: c_d
       
   141   b1: c_c
       
   142   b0^ c_b (base)
       
   143   $ hg up b2
       
   144   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   145 
       
   146 Also test the revset:
       
   147 
       
   148   $ hg log -r 'stack()'
       
   149   2 foo {} draft c_c
       
   150   7 foo {} draft c_d
       
   151   4 foo {} draft c_e
       
   152   5 foo {} draft c_f
       
   153 
       
   154 Case with multiple heads on the topic
       
   155 -------------------------------------
       
   156 
       
   157 Make things linear again
       
   158 
       
   159   $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
       
   160   rebasing 4:4f2a69f6d380 "c_e"
       
   161   rebasing 5:913c298d8b0a "c_f"
       
   162   $ hg log -G
       
   163   o  9 foo {} draft c_f
       
   164   |
       
   165   o  8 foo {} draft c_e
       
   166   |
       
   167   @  7 foo {} draft c_d
       
   168   |
       
   169   o  2 foo {} draft c_c
       
   170   |
       
   171   o  1 other {} public c_b
       
   172   |
       
   173   o  0 other {} public c_a
       
   174   
       
   175 
       
   176 Create the second branch
       
   177 
       
   178   $ hg up 'desc(c_d)'
       
   179   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   180   $ echo aaa > ggg
       
   181   $ hg add ggg
       
   182   $ hg commit -m c_g
       
   183   created new head
       
   184   $ echo aaa > hhh
       
   185   $ hg add hhh
       
   186   $ hg commit -m c_h
       
   187   $ hg log -G
       
   188   @  11 foo {} draft c_h
       
   189   |
       
   190   o  10 foo {} draft c_g
       
   191   |
       
   192   | o  9 foo {} draft c_f
       
   193   | |
       
   194   | o  8 foo {} draft c_e
       
   195   |/
       
   196   o  7 foo {} draft c_d
       
   197   |
       
   198   o  2 foo {} draft c_c
       
   199   |
       
   200   o  1 other {} public c_b
       
   201   |
       
   202   o  0 other {} public c_a
       
   203   
       
   204 
       
   205 Test output
       
   206 
       
   207   $ hg stack
       
   208   ### branch: foo (2 heads)
       
   209   b6: c_f
       
   210   b5: c_e
       
   211   b2^ c_d (base)
       
   212   b4@ c_h (current)
       
   213   b3: c_g
       
   214   b2: c_d
       
   215   b1: c_c
       
   216   b0^ c_b (base)
       
   217 
       
   218 Case with multiple heads on the topic with unstability involved
       
   219 ---------------------------------------------------------------
       
   220 
       
   221 We amend the message to make sure the display base pick the right changeset
       
   222 
       
   223   $ hg up 'desc(c_d)'
       
   224   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   225   $ echo ccc > ddd
       
   226   $ hg commit --amend -m 'c_D' 
       
   227   $ hg rebase -d . -s 'desc(c_g)'
       
   228   rebasing 10:2ebb6e48ab8a "c_g"
       
   229   rebasing 11:634f38e27a1d "c_h"
       
   230   $ hg log -G
       
   231   o  15 foo {} draft c_h
       
   232   |
       
   233   o  14 foo {} draft c_g
       
   234   |
       
   235   @  13 foo {} draft c_D
       
   236   |
       
   237   | o  9 foo {} draft c_f
       
   238   | |
       
   239   | o  8 foo {} draft c_e
       
   240   | |
       
   241   | x  7 foo {} draft c_d
       
   242   |/
       
   243   o  2 foo {} draft c_c
       
   244   |
       
   245   o  1 other {} public c_b
       
   246   |
       
   247   o  0 other {} public c_a
       
   248   
       
   249 
       
   250   $ hg stack
       
   251   ### branch: foo (2 heads)
       
   252   b6$ c_f (unstable)
       
   253   b5$ c_e (unstable)
       
   254   b2^ c_D (base)
       
   255   b4: c_h
       
   256   b3: c_g
       
   257   b2@ c_D (current)
       
   258   b1: c_c
       
   259   b0^ c_b (base)
       
   260 
       
   261 Check that stack doesn't show draft changesets on a branch
       
   262 ----------------------------------------------------------
       
   263 
       
   264   $ hg stack
       
   265   ### branch: foo (2 heads)
       
   266   b6$ c_f (unstable)
       
   267   b5$ c_e (unstable)
       
   268   b2^ c_D (base)
       
   269   b4: c_h
       
   270   b3: c_g
       
   271   b2@ c_D (current)
       
   272   b1: c_c
       
   273   b0^ c_b (base)
       
   274   $ hg phase --public b1
       
   275   $ hg stack
       
   276   ### branch: foo (2 heads)
       
   277   b5$ c_f (unstable)
       
   278   b4$ c_e (unstable)
       
   279   b1^ c_D (base)
       
   280   b3: c_h
       
   281   b2: c_g
       
   282   b1@ c_D (current)
       
   283   b0^ c_c (base)
       
   284 
       
   285 Check that stack doesn't show changeset with a topic
       
   286 ----------------------------------------------------
       
   287 
       
   288   $ hg topic --rev b4::b5 sometopic
       
   289   changed topic on 2 changes
       
   290   $ hg stack
       
   291   ### branch: foo
       
   292   b3: c_h
       
   293   b2: c_g
       
   294   b1@ c_D (current)
       
   295   b0^ c_c (base)