tests/test-stack-branch.t
changeset 2669 b933a8068c17
child 2670 f5d52fa1cd55
equal deleted inserted replaced
2668:1d2c66dc4ee3 2669:b933a8068c17
       
     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   ### topic: None
       
    59   ### branch: other
       
    60   b2@ c_b (current)
       
    61   b1: c_a
       
    62   $ hg phase --public 'branch("other")'
       
    63   $ hg up foo
       
    64   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    65 
       
    66 Simple test
       
    67 -----------
       
    68 
       
    69 'hg stack' list all changeset in the topic
       
    70 
       
    71   $ hg branch
       
    72   foo
       
    73   $ hg stack
       
    74   ### topic: None
       
    75   ### branch: foo
       
    76   b4@ c_f (current)
       
    77   b3: c_e
       
    78   b2: c_d
       
    79   b1: c_c
       
    80     ^ c_b
       
    81 
       
    82 Test "t#" reference
       
    83 -------------------
       
    84 
       
    85   $ hg up b2
       
    86   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    87   $ hg up foo
       
    88   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    89   $ hg up b42
       
    90   abort: cannot resolve "b42": branch "foo" has only 4 changesets
       
    91   [255]
       
    92   $ hg up b2
       
    93   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    94   $ hg summary
       
    95   parent: 3:f61adbacd17a 
       
    96    c_d
       
    97   branch: foo
       
    98   commit: (clean)
       
    99   update: 2 new changesets (update)
       
   100   phases: 4 draft
       
   101 
       
   102 Case with some of the branch unstable
       
   103 ------------------------------------
       
   104 
       
   105   $ echo bbb > ddd
       
   106   $ hg commit --amend
       
   107   $ hg log -G
       
   108   @  7 foo {} draft c_d
       
   109   |
       
   110   | o  5 foo {} draft c_f
       
   111   | |
       
   112   | o  4 foo {} draft c_e
       
   113   | |
       
   114   | x  3 foo {} draft c_d
       
   115   |/
       
   116   o  2 foo {} draft c_c
       
   117   |
       
   118   o  1 other {} public c_b
       
   119   |
       
   120   o  0 other {} public c_a
       
   121   
       
   122   $ hg stack
       
   123   ### topic: None
       
   124   ### branch: foo
       
   125   b4$ c_f (unstable)
       
   126   b3$ c_e (unstable)
       
   127   b2@ c_d (current)
       
   128   b1: c_c
       
   129     ^ c_b
       
   130   $ hg up b3
       
   131   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   132   $ hg stack
       
   133   ### topic: None
       
   134   ### branch: foo
       
   135   b4$ c_f (unstable)
       
   136   b3$ c_e (current unstable)
       
   137   b2: c_d
       
   138   b1: c_c
       
   139     ^ c_b
       
   140   $ hg up b2
       
   141   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
       
   142 
       
   143 Also test the revset:
       
   144 
       
   145   $ hg log -r 'stack()'
       
   146   abort: no active topic to list
       
   147   [255]
       
   148 
       
   149 Case with multiple heads on the topic
       
   150 -------------------------------------
       
   151 
       
   152 Make things linear again
       
   153 
       
   154   $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()'
       
   155   rebasing 4:4f2a69f6d380 "c_e"
       
   156   rebasing 5:913c298d8b0a "c_f"
       
   157   $ hg log -G
       
   158   o  9 foo {} draft c_f
       
   159   |
       
   160   o  8 foo {} draft c_e
       
   161   |
       
   162   @  7 foo {} draft c_d
       
   163   |
       
   164   o  2 foo {} draft c_c
       
   165   |
       
   166   o  1 other {} public c_b
       
   167   |
       
   168   o  0 other {} public c_a
       
   169   
       
   170 
       
   171 Create the second branch
       
   172 
       
   173   $ hg up 'desc(c_d)'
       
   174   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   175   $ echo aaa > ggg
       
   176   $ hg add ggg
       
   177   $ hg commit -m c_g
       
   178   created new head
       
   179   $ echo aaa > hhh
       
   180   $ hg add hhh
       
   181   $ hg commit -m c_h
       
   182   $ hg log -G
       
   183   @  11 foo {} draft c_h
       
   184   |
       
   185   o  10 foo {} draft c_g
       
   186   |
       
   187   | o  9 foo {} draft c_f
       
   188   | |
       
   189   | o  8 foo {} draft c_e
       
   190   |/
       
   191   o  7 foo {} draft c_d
       
   192   |
       
   193   o  2 foo {} draft c_c
       
   194   |
       
   195   o  1 other {} public c_b
       
   196   |
       
   197   o  0 other {} public c_a
       
   198   
       
   199 
       
   200 Test output
       
   201 
       
   202   $ hg stack
       
   203   ### topic: None (2 heads)
       
   204   ### branch: foo
       
   205   b6: c_f
       
   206   b5: c_e
       
   207   b2^ c_d (base)
       
   208   b4@ c_h (current)
       
   209   b3: c_g
       
   210   b2: c_d
       
   211   b1: c_c
       
   212     ^ c_b
       
   213 
       
   214 Case with multiple heads on the topic with unstability involved
       
   215 ---------------------------------------------------------------
       
   216 
       
   217 We amend the message to make sure the display base pick the right changeset
       
   218 
       
   219   $ hg up 'desc(c_d)'
       
   220   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
   221   $ echo ccc > ddd
       
   222   $ hg commit --amend -m 'c_D' 
       
   223   $ hg rebase -d . -s 'desc(c_g)'
       
   224   rebasing 10:2ebb6e48ab8a "c_g"
       
   225   rebasing 11:634f38e27a1d "c_h"
       
   226   $ hg log -G
       
   227   o  15 foo {} draft c_h
       
   228   |
       
   229   o  14 foo {} draft c_g
       
   230   |
       
   231   @  13 foo {} draft c_D
       
   232   |
       
   233   | o  9 foo {} draft c_f
       
   234   | |
       
   235   | o  8 foo {} draft c_e
       
   236   | |
       
   237   | x  7 foo {} draft c_d
       
   238   |/
       
   239   o  2 foo {} draft c_c
       
   240   |
       
   241   o  1 other {} public c_b
       
   242   |
       
   243   o  0 other {} public c_a
       
   244   
       
   245 
       
   246   $ hg stack
       
   247   ### topic: None (2 heads)
       
   248   ### branch: foo
       
   249   b6$ c_f (unstable)
       
   250   b5$ c_e (unstable)
       
   251   b2^ c_D (base)
       
   252   b4: c_h
       
   253   b3: c_g
       
   254   b2@ c_D (current)
       
   255   b1: c_c
       
   256     ^ c_b
       
   257