tests/test-topic-stack.t
author Pierre-Yves David <pierre-yves.david@fb.com>
Mon, 14 Mar 2016 18:39:19 +0000
changeset 1904 f52c02bf47b7
parent 1898 2b65c5a6591c
child 1905 3b42478ef017
permissions -rw-r--r--
stack: allow to refer to changeset using "t2" form hg up "t0" is seen as "update to the first changeset of my current topic". Eventually we'll drop the "t2" form in favor of the planned generic indexing operator '.{t2}'.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1895
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     1
  $ . "$TESTDIR/testlib"
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     2
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     3
Initial setup
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     4
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     5
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     6
  $ cat << EOF >> $HGRCPATH
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     7
  > [ui]
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     8
  > logtemplate = {rev} {branch} \{{get(namespaces, "topics")}} {phase} {desc|firstline}\n
1896
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
     9
  > [experimental]
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    10
  > evolution=createmarkers,exchange,allowunstable
1895
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    11
  > EOF
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    12
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    13
(new head warning seems buggy)
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    14
  $ hg init main
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    15
  $ cd main
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    16
  $ echo aaa > aaa
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    17
  $ hg add aaa
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    18
  $ hg commit -m c_a
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    19
  $ echo aaa > bbb
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    20
  $ hg add bbb
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    21
  $ hg commit -m c_b
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    22
  $ hg topic foo
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    23
  $ echo aaa > ccc
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    24
  $ hg add ccc
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    25
  $ hg commit -m c_c
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    26
  $ echo aaa > ddd
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    27
  $ hg add ddd
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    28
  $ hg commit -m c_d
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    29
  created new head
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    30
  $ echo aaa > eee
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    31
  $ hg add eee
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    32
  $ hg commit -m c_e
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    33
  created new head
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    34
  $ echo aaa > fff
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    35
  $ hg add fff
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    36
  $ hg commit -m c_f
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    37
  created new head
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    38
  $ hg log -G
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    39
  @  5 default {foo} draft c_f
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    40
  |
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    41
  o  4 default {foo} draft c_e
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    42
  |
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    43
  o  3 default {foo} draft c_d
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    44
  |
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    45
  o  2 default {foo} draft c_c
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    46
  |
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    47
  o  1 default {} draft c_b
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    48
  |
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    49
  o  0 default {} draft c_a
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    50
  
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    51
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    52
Simple test
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    53
-----------
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    54
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    55
hg topic -l list all changeset in the topic
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    56
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    57
  $ hg topic
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    58
   * foo
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    59
  $ hg topic --list
1898
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
    60
  0: c_c
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
    61
  1: c_d
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
    62
  2: c_e
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
    63
  3: c_f
1895
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    64
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    65
error case, nothing to list
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    66
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    67
  $ hg topic --clear
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    68
  $ hg topic --list
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    69
  abort: no active topic to list
c8e4c6e03957 stack: add a very first version of stack display with 'hg topic --list'
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    70
  [255]
1896
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    71
1904
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    72
Test "t#" reference
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    73
-------------------
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    74
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    75
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    76
  $ hg up t1
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    77
  abort: cannot resolve "t1": no active topic
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    78
  [255]
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    79
  $ hg topic foo
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    80
  $ hg up t42
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    81
  abort: cannot resolve "t42": topic "foo" has only 4 changesets
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    82
  [255]
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    83
  $ hg up t1
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    84
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
f52c02bf47b7 stack: allow to refer to changeset using "t2" form
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1898
diff changeset
    85
1896
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    86
Case with some of the topic unstable
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    87
------------------------------------
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    88
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    89
  $ echo bbb > ddd
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    90
  $ hg commit --amend
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    91
  $ hg log -G
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    92
  @  7 default {foo} draft c_d
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    93
  |
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    94
  | o  5 default {foo} draft c_f
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    95
  | |
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    96
  | o  4 default {foo} draft c_e
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    97
  | |
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    98
  | x  3 default {foo} draft c_d
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
    99
  |/
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   100
  o  2 default {foo} draft c_c
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   101
  |
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   102
  o  1 default {} draft c_b
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   103
  |
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   104
  o  0 default {} draft c_a
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   105
  
4ae421cbb07c stack: exclude obsolete changeset from the set
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1895
diff changeset
   106
  $ hg topic --list
1898
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
   107
  0: c_c
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
   108
  1: c_d
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
   109
  2: c_e
2b65c5a6591c task: add index number to the output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1897
diff changeset
   110
  3: c_f