Debian Codegraph @

tests/test-show-stack.t

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