tests/test-show-stack.t
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
Mon, 18 Nov 2024 15:42:09 +0100
changeset 52314 33d8cb64e9da
parent 34191 e6b5e7329ff2
permissions -rw-r--r--
rust: fix darwin build
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    20
    @  9f17 commit 0
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    33
    @  2737 commit 4
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    34
    o  d1a6 commit 3
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    35
    o  128c commit 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    36
    o  181c commit 1
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    37
    o  9f17 commit 0
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    43
    @  2737 commit 4
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    44
    o  d1a6 commit 3
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    45
    o  128c commit 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    46
    o  181c commit 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    47
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    48
  o  9f17 commit 0
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    52
    @  2737 commit 4
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    53
    o  d1a6 commit 3
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    54
    o  128c commit 2
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    56
  o  181c commit 1
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    62
    o  2737 commit 4
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    63
    o  d1a6 commit 3
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    64
    @  128c commit 2
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    66
  o  181c commit 1
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    70
    o  2737 commit 4
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    71
    @  d1a6 commit 3
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    72
    o  128c commit 2
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    74
  o  181c commit 1
33197
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
    |
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    92
    o  d1a6 commit 3
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    93
    @  128c commit 2
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    94
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
    95
  o  181c commit 1
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   120
    @  8ee9 merge heads
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   121
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   122
  o  5947 head 1
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   130
    @  430d draft 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   131
    o  787b draft 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   132
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   133
  o  8ee9 merge heads
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   159
    @  eaff draft 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   160
    o  2b21 draft 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   161
   /   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   162
  o  b66b base
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   169
    o  baa4 new 2
33197
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)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   173
  : @  eaff draft 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   174
  : o  2b21 draft 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   175
  :/   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   176
  o  b66b base
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   181
    o  baa4 new 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   182
   /    (2 commits ahead; hg rebase --source 2b21 --dest baa4)
33197
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)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   185
  : @  eaff draft 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   186
  : o  2b21 draft 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   187
  :/   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   188
  o  b66b base
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   199
    o  baa4 new 2
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   200
   /    (2 commits ahead)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   201
  : o  9a84 new head 2
33197
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)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   205
  : @  eaff draft 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   206
  : o  2b21 draft 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   207
  :/   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   208
  o  b66b base
33197
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
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   211
    o  baa4 new 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   212
   /    (2 commits ahead; hg rebase --source 2b21 --dest baa4)
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   213
  : o  9a84 new head 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   214
  :/    (1 commits ahead; hg rebase --source 2b21 --dest 9a84)
33197
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)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   217
  : @  eaff draft 2
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   218
  : o  2b21 draft 1
33197
c5a07a3abe7d show: implement "stack" view
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   219
  :/   (stack base)
34191
e6b5e7329ff2 show: use consistent (and possibly shorter) node lengths
Gregory Szorc <gregory.szorc@gmail.com>
parents: 33208
diff changeset
   220
  o  b66b base