tests/test-stack-branch.t
branchmercurial-3.9
changeset 2702 167567795f6c
parent 2701 26ec0839865b
parent 2617 da0d3d4171cb
child 2703 8f199a2b87e9
child 2801 49494d0155b7
equal deleted inserted replaced
2701:26ec0839865b 2702:167567795f6c
     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     ^ c_b
       
    79 
       
    80 Test "t#" reference
       
    81 -------------------
       
    82 
       
    83   $ hg up b2
       
    84   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    85   $ hg up foo
       
    86   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    87   $ hg up b42
       
    88   abort: cannot resolve "b42": branch "foo" has only 4 changesets
       
    89   [255]
       
    90   $ hg up b2
       
    91   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    92   $ hg summary
       
    93   parent: 3:f61adbacd17a 
       
    94    c_d
       
    95   branch: foo
       
    96   commit: (clean)
       
    97   update: 2 new changesets (update)
       
    98   phases: 4 draft
       
    99 
       
   100 Case with some of the branch unstable
       
   101 ------------------------------------
       
   102 
       
   103   $ echo bbb > ddd
       
   104   $ hg commit --amend
       
   105   $ hg log -G
       
   106   @  7 foo {} draft c_d
       
   107   |
       
   108   | o  5 foo {} draft c_f
       
   109   | |
       
   110   | o  4 foo {} draft c_e
       
   111   | |
       
   112   | x  3 foo {} draft c_d
       
   113   |/
       
   114   o  2 foo {} draft c_c
       
   115   |
       
   116   o  1 other {} public c_b
       
   117   |
       
   118   o  0 other {} public c_a
       
   119   
       
   120   $ hg stack
       
   121   ### branch: foo
       
   122   b4$ c_f (unstable)
       
   123   b3$ c_e (unstable)
       
   124   b2@ c_d (current)
       
   125   b1: c_c
       
   126     ^ c_b
       
   127   $ hg up b3
       
   128   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   129   $ hg stack
       
   130   ### branch: foo
       
   131   b4$ c_f (unstable)
       
   132   b3$ c_e (current unstable)
       
   133   b2: c_d
       
   134   b1: c_c
       
   135     ^ c_b
       
   136   $ hg up b2
       
   137   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   138 
       
   139 Also test the revset:
       
   140 
       
   141   $ hg log -r 'stack()'
       
   142   2 foo {} draft c_c
       
   143   7 foo {} draft c_d
       
   144   4 foo {} draft c_e
       
   145   5 foo {} draft c_f
       
   146 
       
   147 Case with multiple heads on the topic
       
   148 -------------------------------------
       
   149 
       
   150 Make things linear again
       
   151 
       
   152   $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
       
   153   rebasing 4:4f2a69f6d380 "c_e"
       
   154   rebasing 5:913c298d8b0a "c_f"
       
   155   $ hg log -G
       
   156   o  9 foo {} draft c_f
       
   157   |
       
   158   o  8 foo {} draft c_e
       
   159   |
       
   160   @  7 foo {} draft c_d
       
   161   |
       
   162   o  2 foo {} draft c_c
       
   163   |
       
   164   o  1 other {} public c_b
       
   165   |
       
   166   o  0 other {} public c_a
       
   167   
       
   168 
       
   169 Create the second branch
       
   170 
       
   171   $ hg up 'desc(c_d)'
       
   172   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   173   $ echo aaa > ggg
       
   174   $ hg add ggg
       
   175   $ hg commit -m c_g
       
   176   created new head
       
   177   $ echo aaa > hhh
       
   178   $ hg add hhh
       
   179   $ hg commit -m c_h
       
   180   $ hg log -G
       
   181   @  11 foo {} draft c_h
       
   182   |
       
   183   o  10 foo {} draft c_g
       
   184   |
       
   185   | o  9 foo {} draft c_f
       
   186   | |
       
   187   | o  8 foo {} draft c_e
       
   188   |/
       
   189   o  7 foo {} draft c_d
       
   190   |
       
   191   o  2 foo {} draft c_c
       
   192   |
       
   193   o  1 other {} public c_b
       
   194   |
       
   195   o  0 other {} public c_a
       
   196   
       
   197 
       
   198 Test output
       
   199 
       
   200   $ hg stack
       
   201   ### branch: foo (2 heads)
       
   202   b6: c_f
       
   203   b5: c_e
       
   204   b2^ c_d (base)
       
   205   b4@ c_h (current)
       
   206   b3: c_g
       
   207   b2: c_d
       
   208   b1: c_c
       
   209     ^ c_b
       
   210 
       
   211 Case with multiple heads on the topic with unstability involved
       
   212 ---------------------------------------------------------------
       
   213 
       
   214 We amend the message to make sure the display base pick the right changeset
       
   215 
       
   216   $ hg up 'desc(c_d)'
       
   217   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   218   $ echo ccc > ddd
       
   219   $ hg commit --amend -m 'c_D' 
       
   220   $ hg rebase -d . -s 'desc(c_g)'
       
   221   rebasing 10:2ebb6e48ab8a "c_g"
       
   222   rebasing 11:634f38e27a1d "c_h"
       
   223   $ hg log -G
       
   224   o  15 foo {} draft c_h
       
   225   |
       
   226   o  14 foo {} draft c_g
       
   227   |
       
   228   @  13 foo {} draft c_D
       
   229   |
       
   230   | o  9 foo {} draft c_f
       
   231   | |
       
   232   | o  8 foo {} draft c_e
       
   233   | |
       
   234   | x  7 foo {} draft c_d
       
   235   |/
       
   236   o  2 foo {} draft c_c
       
   237   |
       
   238   o  1 other {} public c_b
       
   239   |
       
   240   o  0 other {} public c_a
       
   241   
       
   242 
       
   243   $ hg stack
       
   244   ### branch: foo (2 heads)
       
   245   b6$ c_f (unstable)
       
   246   b5$ c_e (unstable)
       
   247   b2^ c_D (base)
       
   248   b4: c_h
       
   249   b3: c_g
       
   250   b2@ c_D (current)
       
   251   b1: c_c
       
   252     ^ c_b
       
   253 
       
   254 Check that stack doesn't show draft changesets on a branch
       
   255 ----------------------------------------------------------
       
   256 
       
   257   $ hg stack
       
   258   ### branch: foo (2 heads)
       
   259   b6$ c_f (unstable)
       
   260   b5$ c_e (unstable)
       
   261   b2^ c_D (base)
       
   262   b4: c_h
       
   263   b3: c_g
       
   264   b2@ c_D (current)
       
   265   b1: c_c
       
   266     ^ c_b
       
   267   $ hg phase --public b1
       
   268   $ hg stack
       
   269   ### branch: foo (2 heads)
       
   270   b5$ c_f (unstable)
       
   271   b4$ c_e (unstable)
       
   272   b1^ c_D (base)
       
   273   b3: c_h
       
   274   b2: c_g
       
   275   b1@ c_D (current)
       
   276     ^ c_c
       
   277 
       
   278 Check that stack doesn't show changeset with a topic
       
   279 ----------------------------------------------------
       
   280 
       
   281   $ hg topic --rev b4::b5 sometopic
       
   282   changed topic on 2 changes
       
   283   $ hg stack
       
   284   ### branch: foo
       
   285   b3: c_h
       
   286   b2: c_g
       
   287   b1@ c_D (current)
       
   288     ^ c_c