tests/test-show-stack.t
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 03 Jul 2017 21:10:48 -0700
changeset 33208 9e7efe421395
parent 33197 c5a07a3abe7d
child 34191 e6b5e7329ff2
permissions -rw-r--r--
show: tweak warning message '.' is "working directory parent" not "working directory."
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH << EOF
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
  > [extensions]
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  > show =
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  > EOF
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ hg init repo0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  $ cd repo0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
Empty repo / no checkout results in error
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  abort: stack view only available when there is a working directory
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  [255]
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
Stack displays single draft changeset as root revision
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  $ echo 0 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
  $ hg -q commit -A -m 'commit 0'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
    @  9f171 commit 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
Stack displays multiple draft changesets
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
  $ echo 1 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  $ hg commit -m 'commit 1'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
  $ echo 2 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  $ hg commit -m 'commit 2'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  $ echo 3 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  $ hg commit -m 'commit 3'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
  $ echo 4 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  $ hg commit -m 'commit 4'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
    @  2737b commit 4
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
    o  d1a69 commit 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
    o  128c8 commit 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
    o  181cc commit 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
    o  9f171 commit 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
Public parent of draft base is displayed, separated from stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    41
  $ hg phase --public -r 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
    @  2737b commit 4
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
    o  d1a69 commit 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
    o  128c8 commit 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    46
    o  181cc commit 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    47
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
  o  9f171 commit 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    49
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
  $ hg phase --public -r 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    52
    @  2737b commit 4
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
    o  d1a69 commit 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    54
    o  128c8 commit 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
  o  181cc commit 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    57
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
Draft descendants are shown
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    59
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
  $ hg -q up 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
    o  2737b commit 4
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
    o  d1a69 commit 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    64
    @  128c8 commit 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    66
  o  181cc commit 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    67
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
  $ hg -q up 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    69
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    70
    o  2737b commit 4
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
    @  d1a69 commit 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
    o  128c8 commit 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
  o  181cc commit 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    75
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
working dir on public changeset should display special message
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
  $ hg -q up 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
  $ hg show stack
33208
9e7efe421395 show: tweak warning message
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33197
diff changeset
    80
  (empty stack; working directory parent is a published changeset)
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    81
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    82
Branch point in descendants displayed at top of graph
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    83
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    84
  $ hg -q up 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    85
  $ echo b > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    86
  $ hg commit -m 'commit 5 (new dag branch)'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    87
  created new head
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    88
  $ hg -q up 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    89
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    90
   \ /  (multiple children)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    91
    |
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    92
    o  d1a69 commit 3
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    93
    @  128c8 commit 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    94
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    95
  o  181cc commit 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    96
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    97
  $ cd ..
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    98
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    99
Base is stopped at merges
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   100
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   101
  $ hg init merge-base
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   102
  $ cd merge-base
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   103
  $ echo 0 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   104
  $ hg -q commit -A -m initial
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   105
  $ echo h1 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   106
  $ hg commit -m 'head 1'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   107
  $ hg -q up 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   108
  $ echo h2 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   109
  $ hg -q commit -m 'head 2'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   110
  $ hg phase --public -r 0:tip
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   111
  $ hg -q up 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   112
  $ hg merge -t :local 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   113
  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   114
  (branch merge, don't forget to commit)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   115
  $ hg commit -m 'merge heads'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   116
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   117
TODO doesn't yet handle case where wdir is a draft merge
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   118
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   119
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   120
    @  8ee90 merge heads
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   121
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   122
  o  59478 head 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   123
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   124
  $ echo d1 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   125
  $ hg commit -m 'draft 1'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   126
  $ echo d2 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   127
  $ hg commit -m 'draft 2'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   128
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   129
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   130
    @  430d5 draft 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   131
    o  787b1 draft 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   132
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   133
  o  8ee90 merge heads
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   134
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   135
  $ cd ..
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   136
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   137
Now move on to stacks when there are more commits after the base branchpoint
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   138
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   139
  $ hg init public-rebase
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   140
  $ cd public-rebase
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   141
  $ echo 0 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   142
  $ hg -q commit -A -m 'base'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   143
  $ hg phase --public -r .
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   144
  $ echo d1 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   145
  $ hg commit -m 'draft 1'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   146
  $ echo d2 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   147
  $ hg commit -m 'draft 2'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   148
  $ hg -q up 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   149
  $ echo 1 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   150
  $ hg commit -m 'new 1'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   151
  created new head
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   152
  $ echo 2 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   153
  $ hg commit -m 'new 2'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   154
  $ hg -q up 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   155
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   156
Newer draft heads don't impact output
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   157
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   158
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   159
    @  eaffc draft 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   160
    o  2b218 draft 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   161
   /   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   162
  o  b66bb base
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   163
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   164
Newer public heads are rendered
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   165
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   166
  $ hg phase --public -r '::tip'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   167
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   168
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   169
    o  baa4b new 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   170
   /    (2 commits ahead)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   171
  :
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   172
  :    (stack head)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   173
  : @  eaffc draft 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   174
  : o  2b218 draft 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   175
  :/   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   176
  o  b66bb base
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   177
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   178
If rebase is available, we show a hint how to rebase to that head
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   179
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   180
  $ hg --config extensions.rebase= show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   181
    o  baa4b new 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   182
   /    (2 commits ahead; hg rebase --source 2b218 --dest baa4b)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   183
  :
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   184
  :    (stack head)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   185
  : @  eaffc draft 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   186
  : o  2b218 draft 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   187
  :/   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   188
  o  b66bb base
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   189
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   190
Similar tests but for multiple heads
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   191
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   192
  $ hg -q up 0
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   193
  $ echo h2 > foo
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   194
  $ hg -q commit -m 'new head 2'
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   195
  $ hg phase --public -r .
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   196
  $ hg -q up 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   198
  $ hg show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   199
    o  baa4b new 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   200
   /    (2 commits ahead)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   201
  : o  9a848 new head 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   202
  :/    (1 commits ahead)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   203
  :
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   204
  :    (stack head)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   205
  : @  eaffc draft 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   206
  : o  2b218 draft 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   207
  :/   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   208
  o  b66bb base
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   209
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   210
  $ hg --config extensions.rebase= show stack
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   211
    o  baa4b new 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   212
   /    (2 commits ahead; hg rebase --source 2b218 --dest baa4b)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   213
  : o  9a848 new head 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   214
  :/    (1 commits ahead; hg rebase --source 2b218 --dest 9a848)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   215
  :
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   216
  :    (stack head)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   217
  : @  eaffc draft 2
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   218
  : o  2b218 draft 1
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   219
  :/   (stack base)
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   220
  o  b66bb base