tg.sh: handle help -h
[topgit/pro.git] / t / t1390-awk-topgit_navigate.sh
blobc869e694bd3d63c3228b0acfd8c6a8f2fa1177d7
1 #!/bin/sh
3 test_description='topgit_navigate.awk functionality'
5 TEST_NO_CREATE_REPO=1
7 . ./test-lib.sh
9 ap="$(tg --awk-path)" && test -n "$ap" && test -d "$ap" || die
10 aptn="$ap/topgit_navigate"
11 test -f "$aptn" && test -r "$aptn" && test -x "$aptn" || die
13 # Final output of topgit_deps looks like:
15 # t/top t/sub1
16 # t/top t/sub2
17 # t/top t/top (only when withbr=1)
19 # In other words, the output from topgit_deps is simply
20 # a list of TopGit Directed Acyclic Graph edges pointing
21 # from the branch name in the first field (via its .topdeps
22 # file) to the branch name in the second field.
24 # Of course, if the rev=1 was passed to topgit_deps it's
25 # all output backwards, but that's really irrelevant to
26 # the testing performed by this test.
28 test_plan 37
30 # first arg is passed as `-v startb="$1"`
31 tgnav_() { awk -f "$aptn" "$@"; }
32 tgnav() { tgnav_ -v startb="$@"; }
33 tgnavmt() { tgnav none -v steps=0 "$@"; }
35 test_expect_success 'topgit_navigate runs' '
36 # some stupid awks might not even compile it
37 >expected &&
38 awk -f "$aptn" -v steps=0 -v startb="none" </dev/null >actual &&
39 test_cmp actual expected &&
40 # and make sure the helper works too
41 </dev/null tgnavmt >actual &&
42 test_cmp actual expected
45 test_expect_success 'invalid brfile fails if read' '
46 rm -f no-such-file &&
47 test ! -e no-such-file &&
48 >expected &&
49 </dev/null tgnavmt -v brfile=no-such-file >actual &&
50 test_cmp actual expected &&
51 echo "..." | tgnavmt -v brfile=no-such-file >actual &&
52 test_cmp actual expected &&
53 </dev/null tgnavmt -v tgonly=1 -v brfile=no-such-file >actual &&
54 test_cmp actual expected &&
55 echo "..." | test_must_fail tgnavmt -v tgonly=1 -v brfile=no-such-file >actual &&
56 test_cmp actual expected &&
57 test ! -e no-such-file
60 test_expect_success 'invalid anfile fails if read' '
61 rm -f no-such-file &&
62 test ! -e no-such-file &&
63 >expected &&
64 </dev/null tgnavmt -v withan=1 -v anfile=no-such-file >actual &&
65 test_cmp actual expected &&
66 echo "..." | test_must_fail tgnavmt -v withan=1 -v anfile=no-such-file >actual &&
67 test_cmp actual expected &&
68 </dev/null tgnavmt -v anfile=no-such-file >actual &&
69 test_cmp actual expected &&
70 echo "..." | test_must_fail tgnavmt -v anfile=no-such-file >actual &&
71 test_cmp actual expected &&
72 test ! -e no-such-file
75 test_expect_success 'brfile unperturbed without rmbr' '
76 echo "br file here" >brorig &&
77 cat brorig >brfile &&
78 >expected &&
79 </dev/null tgnavmt -v brfile=brfile >actual &&
80 test_cmp actual expected &&
81 test_cmp brfile brorig &&
82 echo "..." | tgnavmt -v brfile=brfile >actual &&
83 test_cmp actual expected &&
84 test_cmp brfile brorig &&
85 </dev/null tgnavmt -v tgonly=1 -v brfile=brfile >actual &&
86 test_cmp actual expected &&
87 test_cmp brfile brorig &&
88 echo "..." | tgnavmt -v tgonly=1 -v brfile=brfile >actual &&
89 test_cmp actual expected &&
90 test_cmp brfile brorig
93 test_expect_success 'anfile unperturbed without rman' '
94 echo "an file here" >anorig &&
95 cat anorig >anfile &&
96 >expected &&
97 </dev/null tgnavmt -v withan=1 -v anfile=anfile >actual &&
98 test_cmp actual expected &&
99 test_cmp anfile anorig &&
100 echo "..." | tgnavmt -v withan=1 -v anfile=anfile >actual &&
101 test_cmp actual expected &&
102 test_cmp anfile anorig &&
103 </dev/null tgnavmt -v anfile=anfile >actual &&
104 test_cmp actual expected &&
105 test_cmp anfile anorig &&
106 echo "..." | tgnavmt -v anfile=anfile >actual &&
107 test_cmp actual expected &&
108 test_cmp anfile anorig
111 test_expect_success 'brfile removed with rmbr' '
112 echo "br file here" >brorig &&
113 cat brorig >brfile &&
114 >expected &&
115 </dev/null tgnavmt -v brfile=brfile -v rmbr=1 >actual &&
116 test_cmp actual expected &&
117 test ! -e brfile &&
118 cat brorig >brfile &&
119 echo "..." | tgnavmt -v brfile=brfile -v rmbr=1 >actual &&
120 test_cmp actual expected &&
121 test ! -e brfile &&
122 cat brorig >brfile &&
123 </dev/null tgnavmt -v tgonly=1 -v brfile=brfile -v rmbr=1 >actual &&
124 test_cmp actual expected &&
125 test ! -e brfile &&
126 cat brorig >brfile &&
127 echo "..." | tgnavmt -v tgonly=1 -v brfile=brfile -v rmbr=1 >actual &&
128 test_cmp actual expected &&
129 test ! -e brfile
132 test_expect_success 'anfile removed with rman' '
133 echo "an file here" >anorig &&
134 cat anorig >anfile &&
135 >expected &&
136 </dev/null tgnavmt -v withan=1 -v anfile=anfile -v rman=1 >actual &&
137 test_cmp actual expected &&
138 test ! -e anfile &&
139 cat anorig >anfile &&
140 echo "..." | tgnavmt -v withan=1 -v anfile=anfile -v rman=1 >actual &&
141 test_cmp actual expected &&
142 test ! -e anfile &&
143 cat anorig >anfile &&
144 </dev/null tgnavmt -v anfile=anfile -v rman=1 >actual &&
145 test_cmp actual expected &&
146 test ! -e anfile &&
147 cat anorig >anfile &&
148 echo "..." | tgnavmt -v anfile=anfile -v rman=1 >actual &&
149 test_cmp actual expected &&
150 test ! -e anfile
153 test_expect_success 'brfile works' '
154 printf "%s\n" "last" >brlist &&
155 printf "%s\n" "last mid" "mid first" >graph &&
156 echo "mid last" >expected &&
157 <graph tgnav "first" -v steps=1 >actual &&
158 test_cmp actual expected &&
159 <graph tgnav "first" -v steps=1 -v brfile=brlist >actual &&
160 test_cmp actual expected &&
161 echo "last last" >expected &&
162 <graph tgnav "first" -v steps=1 -v brfile=brlist -v tgonly=1 >actual &&
163 test_cmp actual expected &&
164 echo "first last" >expected &&
165 <graph tgnav "first" -v steps=0 >actual &&
166 test_cmp actual expected &&
167 <graph tgnav "first" -v steps=0 -v brfile=brlist >actual &&
168 test_cmp actual expected &&
169 >expected &&
170 <graph tgnav "first" -v steps=0 -v brfile=brlist -v tgonly=1 >actual &&
171 test_cmp actual expected &&
172 <graph tgnav "first" -v steps=0 -v tgonly=1 >actual &&
173 test_cmp actual expected
176 test_expect_success 'anfile works' '
177 printf "%s\n" "mid1b" >anlist &&
178 cat <<-EOT >graph &&
179 top mid1
180 mid1 mid1a
181 mid1 mid1b
182 mid1 mid1c
184 echo "mid1b top" >expected &&
185 <graph tgnav "mid1a" -v steps=1 >actual &&
186 test_cmp actual expected &&
187 <graph tgnav "mid1a" -v steps=1 -v anfile=anlist -v withan=1 >actual &&
188 test_cmp actual expected &&
189 echo "mid1c top" >expected &&
190 <graph tgnav "mid1a" -v steps=1 -v anfile=anlist >actual &&
191 test_cmp actual expected &&
192 echo "mid1b top" >expected &&
193 <graph tgnav "mid1b" -v steps=0 >actual &&
194 test_cmp actual expected &&
195 <graph tgnav "mid1b" -v steps=0 -v anfile=anlist -v withan=1 >actual &&
196 test_cmp actual expected &&
197 <graph tgnav "mid1b" -v steps=0 -v withan=1 >actual &&
198 test_cmp actual expected &&
199 >expected &&
200 <graph tgnav "mid1b" -v steps=0 -v anfile=anlist >actual &&
201 test_cmp actual expected
204 test_expect_success 'anfile works redux' '
205 printf "%s\n" "mid1" >anlist &&
206 cat <<-EOT >graph &&
207 top mid1
208 mid1 mid1a
209 mid1 mid1b
210 mid1 mid1c
212 echo "mid1b top" >expected &&
213 <graph tgnav "mid1b" -v steps=0 >actual &&
214 test_cmp actual expected &&
215 echo "mid1c top" >expected &&
216 <graph tgnav "mid1b" -v steps=1 >actual &&
217 test_cmp actual expected &&
218 echo "mid1c mid1c" >expected &&
219 <graph tgnav "mid1c" -v steps=1 -v pin=1 -v anfile=anlist >actual &&
220 test_cmp actual expected &&
221 <graph tgnav "mid1c" -v steps=1 -v pin=1 -v anfile=anlist -v withan=1 >actual &&
222 test_cmp actual expected
225 test_expect_success 'brfile + anfile works' '
226 printf "%s\n" "top" "mid1" "mid2" >brlist &&
227 printf "%s\n" "mid1" "mid2b" >anlist &&
228 cat <<-EOT >graph &&
229 top mid1
230 top mid2
231 mid1 mid1a
232 mid1 mid1b
233 mid1 mid1c
234 mid2 mid2a
235 mid2 mid2b
236 mid2 mid2c
238 echo "mid2b top" >expected &&
239 <graph tgnav "mid1b" -v steps=4 >actual &&
240 test_cmp actual expected &&
241 <graph tgnav "mid1b" -v steps=4 -v brfile=brlist >actual &&
242 test_cmp actual expected &&
243 >expected &&
244 <graph tgnav "mid1b" -v steps=4 -v tgonly=1 >actual &&
245 test_cmp actual expected &&
246 echo "mid2 top" >expected &&
247 <graph tgnav "mid1b" -v steps=2 -v brfile=brlist -v tgonly=1 >actual &&
248 test_cmp actual expected &&
249 echo "mid1b top" >expected &&
250 <graph tgnav "mid2b" -v steps=4 -v rev=1 >actual &&
251 test_cmp actual expected &&
252 echo "mid2b top" >expected &&
253 <graph tgnav "mid2b" -v steps=0 -v rev=1 >actual &&
254 test_cmp actual expected &&
255 <graph tgnav "mid2b" -v steps=0 -v rev=1 -v withan=1 >actual &&
256 test_cmp actual expected &&
257 <graph tgnav "mid2b" -v steps=0 -v rev=1 -v anfile=anlist -v withan=1 >actual &&
258 test_cmp actual expected &&
259 >expected &&
260 <graph tgnav "mid2b" -v steps=0 -v rev=1 -v anfile=anlist >actual &&
261 test_cmp actual expected &&
262 echo "mid2a top" >expected &&
263 <graph tgnav "mid2c" -v steps=1 -v rev=1 -v anfile=anlist >actual &&
264 test_cmp actual expected &&
265 echo "mid1 top" >expected &&
266 <graph tgnav "mid2c" -v steps=3 -v rev=1 -v withan=1 -v anfile=anlist >actual &&
267 test_cmp actual expected &&
268 echo "mid2b top" >expected &&
269 <graph tgnav "top" -v steps=3 -v rev=1 -v anfile=anlist -v withan=1 -v brfile=brlist >actual &&
270 test_cmp actual expected &&
271 echo "mid2a top" >expected &&
272 <graph tgnav "top" -v steps=3 -v rev=1 -v anfile=anlist -v brfile=brlist >actual &&
273 test_cmp actual expected &&
274 echo "mid1 top" >expected &&
275 <graph tgnav "top" -v steps=2 -v rev=1 -v anfile=anlist -v withan=1 -v brfile=brlist -v tgonly=1 >actual &&
276 test_cmp actual expected &&
277 echo "mid2 top" >expected &&
278 <graph tgnav "top" -v steps=1 -v rev=1 -v anfile=anlist -v brfile=brlist -v tgonly=1 >actual &&
279 test_cmp actual expected
282 test_expect_success 'tgonly works' '
283 printf "%s\n" top mid1 mid1b mid2 mid2c >brlist &&
284 cat <<-EOT >graph &&
285 top mid1
286 top mid2
287 mid1 mid1a
288 mid1 mid1b
289 mid1 mid1c
290 mid2 mid2a
291 mid2 mid2b
292 mid2 mid2c
294 printf "%s\n" mid1a mid1b mid1c mid2a mid2b mid2c >expected &&
295 <graph tgnav "" -v steps=1 >actual &&
296 test_cmp actual expected &&
297 >expected &&
298 <graph tgnav "" -v steps=1 -v tgonly=1 >actual &&
299 test_cmp actual expected &&
300 printf "%s\n" mid1b mid2c >expected &&
301 <graph tgnav "" -v steps=1 -v brfile=brlist -v tgonly=1 >actual &&
302 test_cmp actual expected &&
303 echo top >expected &&
304 <graph tgnav "" -v steps=-1 >actual &&
305 test_cmp actual expected &&
306 >expected &&
307 <graph tgnav "" -v steps=-1 -v tgonly=1 >actual &&
308 test_cmp actual expected &&
309 echo top >expected &&
310 <graph tgnav "" -v steps=-1 -v brfile=brlist -v tgonly=1 >actual &&
311 test_cmp actual expected
314 test_expect_success 'withan works' '
315 printf "%s\n" mid1 mid1c mid2a mid2b >anlist &&
316 cat <<-EOT >graph &&
317 top mid1
318 top mid2
319 mid1 mid1a
320 mid1 mid1b
321 mid1 mid1c
322 mid2 mid2a
323 mid2 mid2b
324 mid2 mid2c
326 printf "%s\n" mid1a mid1b mid1c mid2a mid2b mid2c >expected &&
327 <graph tgnav "" -v steps=1 >actual &&
328 test_cmp actual expected &&
329 <graph tgnav "" -v steps=1 -v withan=1 >actual &&
330 test_cmp actual expected &&
331 <graph tgnav "" -v steps=1 -v withan=1 -v anfile=anlist >actual &&
332 printf "%s\n" mid1 mid1a mid1b mid1c mid2a mid2b mid2c >expected &&
333 test_cmp actual expected &&
334 printf "%s\n" mid1a mid1b mid2c >expected &&
335 <graph tgnav "" -v steps=1 -v withan=0 -v anfile=anlist >actual &&
336 test_cmp actual expected &&
337 echo top >expected &&
338 <graph tgnav "" -v steps=-1 >actual &&
339 test_cmp actual expected &&
340 <graph tgnav "" -v steps=-1 -v withan=1 >actual &&
341 test_cmp actual expected &&
342 printf "%s\n" top mid1a mid1b mid1c >expected &&
343 <graph tgnav "" -v steps=-1 -v withan=1 -v anfile=anlist >actual &&
344 test_cmp actual expected &&
345 printf "%s\n" top mid1a mid1b >expected &&
346 <graph tgnav "" -v steps=-1 -v withan=0 -v anfile=anlist >actual &&
347 test_cmp actual expected
350 test_expect_success 'integer steps only' '
351 echo "a b" >graph &&
352 echo "a a" >expected &&
353 <graph tgnav "a" -v steps=0 >actual &&
354 test_cmp actual expected &&
355 >expected &&
356 <graph test_must_fail tgnav "a" -v steps="" >actual &&
357 test_cmp actual expected &&
358 <graph test_must_fail tgnav "" -v steps="" >actual &&
359 test_cmp actual expected &&
360 <graph test_must_fail tgnav "a" -v steps="-1.0" >actual &&
361 test_cmp actual expected &&
362 <graph test_must_fail tgnav "a" -v steps="1.0" >actual &&
363 test_cmp actual expected &&
364 <graph test_must_fail tgnav "a" -v steps="1." >actual &&
365 test_cmp actual expected &&
366 <graph test_must_fail tgnav "a" -v steps=".0" >actual &&
367 test_cmp actual expected &&
368 <graph test_must_fail tgnav "a" -v steps="." >actual &&
369 test_cmp actual expected &&
370 <graph test_must_fail tgnav "a" -v steps="1/2" >actual &&
371 test_cmp actual expected &&
372 <graph test_must_fail tgnav "a" -v steps=" 1" >actual &&
373 test_cmp actual expected &&
374 <graph test_must_fail tgnav "a" -v steps=" -1" >actual &&
375 test_cmp actual expected &&
376 <graph test_must_fail tgnav "a" -v steps="1 " >actual &&
377 test_cmp actual expected &&
378 <graph test_must_fail tgnav "a" -v steps="-1 " >actual &&
379 test_cmp actual expected &&
380 <graph test_must_fail tgnav "a" -v steps=" 1 " >actual &&
381 test_cmp actual expected &&
382 <graph test_must_fail tgnav "a" -v steps=" -1 " >actual &&
383 test_cmp actual expected &&
384 echo "a a" >expected &&
385 <graph tgnav "a" -v steps="-1" >actual &&
386 test_cmp actual expected &&
387 <graph tgnav "a" -v steps="-2" >actual &&
388 test_cmp actual expected &&
389 <graph tgnav "a" -v steps="-9999" >actual &&
390 test_cmp actual expected &&
391 <graph tgnav "b" -v steps="1" >actual &&
392 test_cmp actual expected &&
393 >expected &&
394 <graph tgnav "b" -v steps="2" >actual &&
395 test_cmp actual expected &&
396 <graph tgnav "b" -v steps="3" >actual &&
397 test_cmp actual expected &&
398 <graph tgnav "b" -v steps="99" >actual &&
399 test_cmp actual expected &&
400 <graph tgnav "b" -v steps="9999" >actual &&
401 test_cmp actual expected
404 test_expect_success 'zero steps requires non-empty start' '
405 printf "%s\n" "a b" "c d" >graph &&
406 echo "a a" >expected &&
407 <graph tgnav "a" -v steps=0 >actual &&
408 test_cmp actual expected &&
409 echo "b a" >expected &&
410 <graph tgnav "b" -v steps=0 >actual &&
411 test_cmp actual expected &&
412 echo "c c" >expected &&
413 <graph tgnav "c" -v steps=0 >actual &&
414 test_cmp actual expected &&
415 echo "d c" >expected &&
416 <graph tgnav "d" -v steps=0 >actual &&
417 test_cmp actual expected &&
418 >expected &&
419 <graph test_must_fail tgnav "" -v steps=0 >actual &&
420 test_cmp actual expected &&
421 <graph test_must_fail tgnav "" -v steps=0 -v rev=1 >actual &&
422 test_cmp actual expected &&
423 <graph test_must_fail tgnav "" -v steps=0 -v pin=1 >actual &&
424 test_cmp actual expected &&
425 <graph test_must_fail tgnav "" -v steps=0 -v rev=1 -v pin=1 >actual &&
426 test_cmp actual expected &&
427 <graph test_must_fail tgnav " " -v steps=0 >actual &&
428 test_cmp actual expected &&
429 <graph test_must_fail tgnav " " -v steps=0 >actual &&
430 test_cmp actual expected &&
431 <graph test_must_fail tgnav " " -v steps=0 >actual &&
432 test_cmp actual expected
435 test_expect_success 'zero steps works' '
436 cat <<-EOT >graph &&
447 echo "e a" >expected &&
448 <graph tgnav "e" -v steps=0 >actual &&
449 test_cmp actual expected &&
450 echo "p m" >expected &&
451 <graph tgnav "p" -v steps=0 >actual &&
452 test_cmp actual expected &&
453 echo "w a m" >expected &&
454 <graph tgnav "w" -v steps=0 >actual &&
455 test_cmp actual expected &&
456 echo "z a m" >expected &&
457 <graph tgnav "z" -v steps=0 >actual &&
458 test_cmp actual expected &&
459 echo "w" >anlist &&
460 echo "z z" >expected &&
461 <graph tgnav "z" -v steps=0 -v anfile=anlist >actual &&
462 test_cmp actual expected &&
463 >expected &&
464 <graph tgnav "w" -v steps=0 -v anfile=anlist >actual &&
465 test_cmp actual expected &&
466 echo "w a m" >expected &&
467 <graph tgnav "w" -v steps=0 -v anfile=anlist -v withan=1 >actual &&
468 test_cmp actual expected &&
469 printf "%s\n" w a m >brlist &&
470 <graph tgnav "w" -v steps=0 -v brfile=brlist -v tgonly=1 >actual &&
471 test_cmp actual expected &&
472 printf "%s\n" w a m >brlist &&
473 echo "z a m" >expected &&
474 <graph tgnav "z" -v steps=0 -v brfile=brlist -v tgonly=0 >actual &&
475 test_cmp actual expected &&
476 >expected &&
477 <graph tgnav "z" -v steps=0 -v brfile=brlist -v tgonly=1 >actual &&
478 test_cmp actual expected
481 test_expect_success 'step nil to heads' '
482 cat <<-EOT >graph &&
491 printf "%s\n" a d g >expected &&
492 <graph tgnav "" -v steps=-1 >actual &&
493 test_cmp actual expected &&
494 <graph tgnav "" -v steps=1 -v rev=1 >actual &&
495 test_cmp actual expected &&
496 echo b >anlist &&
497 printf "%s\n" a c d g >expected &&
498 <graph tgnav "" -v steps=1 -v rev=1 -v anfile=anlist >actual &&
499 test_cmp actual expected &&
500 echo d >anlist &&
501 <graph tgnav "" -v steps=1 -v rev=1 -v anfile=anlist >actual &&
502 printf "%s\n" a e g >expected &&
503 test_cmp actual expected &&
504 printf "%s\n" a e d g >expected &&
505 <graph tgnav "" -v steps=1 -v rev=1 -v anfile=anlist -v withan=1 >actual &&
506 test_cmp actual expected &&
507 >expected &&
508 <graph tgnav "" -v steps=-1 -v tgonly=1 >actual &&
509 test_cmp actual expected &&
510 printf "%s\n" a g >brlist &&
511 printf "%s\n" a g >expected &&
512 <graph tgnav "" -v steps=-1 -v tgonly=1 -v brfile=brlist >actual &&
513 test_cmp actual expected
516 test_expect_success 'step nil to roots' '
517 cat <<-EOT >graph &&
526 printf "%s\n" c x >expected &&
527 <graph tgnav "" -v steps=1 >actual &&
528 test_cmp actual expected &&
529 <graph tgnav "" -v steps=-1 -v rev=1 >actual &&
530 test_cmp actual expected &&
531 printf "%s\n" a b d e f g h >brlist &&
532 >expected &&
533 <graph tgnav "" -v steps=1 -v tgonly=1 >actual &&
534 test_cmp actual expected &&
535 <graph tgnav "" -v steps=1 -v tgonly=1 -v brfile=brlist >actual &&
536 test_cmp actual expected &&
537 echo x >>brlist &&
538 echo x >expected &&
539 <graph tgnav "" -v steps=1 -v tgonly=1 -v brfile=brlist >actual &&
540 test_cmp actual expected &&
541 echo f >anlist &&
542 printf "%s\n" c f x >expected &&
543 <graph tgnav "" -v steps=1 -v anfile=anlist -v withan=1 >actual &&
544 test_cmp actual expected &&
545 echo x >anlist &&
546 echo c >expected &&
547 <graph tgnav "" -v steps=1 -v anfile=anlist -v xwithan=1 >actual &&
548 test_cmp actual expected
551 test_expect_success 'step nil to firsts' '
552 cat <<-EOT >graph &&
561 printf "%s\n" a b c d f g h >expected &&
562 <graph tgnav "" -v steps=1 >actual &&
563 test_cmp actual expected &&
564 printf "%s\n" a f >expected &&
565 <graph tgnav "" -v steps=-1 -v rev=1 >actual &&
566 test_cmp actual expected
569 test_expect_success 'step forward' '
570 cat <<-EOT >graph &&
579 echo "b a r w" >expected &&
580 <graph tgnav "c" -v steps=1 >actual &&
581 test_cmp actual expected &&
582 cat <<-EOT >expected &&
587 <graph tgnav "c" -v steps=2 >actual &&
588 test_cmp actual expected &&
589 cat <<-EOT >expected &&
593 <graph tgnav "c" -v steps=3 >actual &&
594 test_cmp actual expected &&
595 echo "r r" >expected &&
596 <graph tgnav "c" -v steps=4 >actual &&
597 test_cmp actual expected &&
598 >expected &&
599 <graph tgnav "c" -v steps=5 >actual &&
600 test_cmp actual expected &&
601 cat <<-EOT >expected &&
606 <graph tgnav "c" -v steps=-1 >actual &&
607 test_cmp actual expected
610 test_expect_success 'step backward' '
611 cat <<-EOT >graph &&
620 echo "b a" >expected &&
621 <graph tgnav "a" -v steps=1 -v rev=1 >actual &&
622 test_cmp actual expected &&
623 echo "c a" >expected &&
624 <graph tgnav "a" -v steps=2 -v rev=1 >actual &&
625 test_cmp actual expected &&
626 <graph tgnav "a" -v steps=-1 -v rev=1 >actual &&
627 test_cmp actual expected &&
628 >expected &&
629 <graph tgnav "a" -v steps=3 -v rev=1 >actual &&
630 test_cmp actual expected &&
631 echo "c a r w" >expected &&
632 <graph tgnav "b" -v steps=1 -v rev=1 >actual &&
633 test_cmp actual expected &&
634 <graph tgnav "b" -v steps=-1 -v rev=1 >actual &&
635 test_cmp actual expected &&
636 >expected &&
637 <graph tgnav "b" -v steps=2 -v rev=1 >actual &&
638 test_cmp actual expected &&
640 echo "s r" >expected &&
641 <graph tgnav "r" -v steps=1 -v rev=1 >actual &&
642 test_cmp actual expected &&
643 echo "b r" >expected &&
644 <graph tgnav "r" -v steps=2 -v rev=1 >actual &&
645 test_cmp actual expected &&
646 <graph tgnav "s" -v steps=1 -v rev=1 >actual &&
647 test_cmp actual expected &&
648 echo "c r" >expected &&
649 <graph tgnav "r" -v steps=3 -v rev=1 >actual &&
650 test_cmp actual expected &&
651 <graph tgnav "s" -v steps=2 -v rev=1 >actual &&
652 test_cmp actual expected &&
653 <graph tgnav "r" -v steps=-1 -v rev=1 >actual &&
654 test_cmp actual expected &&
655 <graph tgnav "s" -v steps=-1 -v rev=1 >actual &&
656 test_cmp actual expected &&
657 >expected &&
658 <graph tgnav "r" -v steps=4 -v rev=1 >actual &&
659 test_cmp actual expected &&
660 <graph tgnav "s" -v steps=3 -v rev=1 >actual &&
661 test_cmp actual expected &&
663 echo "x w" >expected &&
664 <graph tgnav "w" -v steps=1 -v rev=1 >actual &&
665 test_cmp actual expected &&
666 echo "y w" >expected &&
667 <graph tgnav "w" -v steps=2 -v rev=1 >actual &&
668 test_cmp actual expected &&
669 <graph tgnav "x" -v steps=1 -v rev=1 >actual &&
670 test_cmp actual expected &&
671 echo "b w" >expected &&
672 <graph tgnav "w" -v steps=3 -v rev=1 >actual &&
673 test_cmp actual expected &&
674 <graph tgnav "x" -v steps=2 -v rev=1 >actual &&
675 test_cmp actual expected &&
676 <graph tgnav "y" -v steps=1 -v rev=1 >actual &&
677 test_cmp actual expected &&
678 echo "c w" >expected &&
679 <graph tgnav "w" -v steps=4 -v rev=1 >actual &&
680 test_cmp actual expected &&
681 <graph tgnav "x" -v steps=3 -v rev=1 >actual &&
682 test_cmp actual expected &&
683 <graph tgnav "y" -v steps=2 -v rev=1 >actual &&
684 test_cmp actual expected &&
685 <graph tgnav "w" -v steps=-1 -v rev=1 >actual &&
686 test_cmp actual expected &&
687 <graph tgnav "x" -v steps=-1 -v rev=1 >actual &&
688 test_cmp actual expected &&
689 <graph tgnav "y" -v steps=-1 -v rev=1 >actual &&
690 test_cmp actual expected &&
691 >expected &&
692 <graph tgnav "w" -v steps=5 -v rev=1 >actual &&
693 test_cmp actual expected &&
694 <graph tgnav "x" -v steps=4 -v rev=1 >actual &&
695 test_cmp actual expected &&
696 <graph tgnav "y" -v steps=3 -v rev=1 >actual &&
697 test_cmp actual expected
700 test_expect_success 'step nil forward' '
701 cat <<-EOT >graph &&
710 echo "b a r w" >expected &&
711 <graph tgnav "" -v steps=2 >actual &&
712 test_cmp actual expected &&
713 cat <<-EOT >expected &&
718 <graph tgnav "" -v steps=3 >actual &&
719 test_cmp actual expected &&
720 cat <<-EOT >expected &&
724 <graph tgnav "" -v steps=4 >actual &&
725 test_cmp actual expected &&
726 echo "r r" >expected &&
727 <graph tgnav "" -v steps=5 >actual &&
728 test_cmp actual expected &&
729 >expected &&
730 <graph tgnav "" -v steps=6 >actual &&
731 test_cmp actual expected
734 test_expect_success 'step nil backward' '
735 cat <<-EOT >graph &&
744 cat <<-EOT >expected &&
749 <graph tgnav "" -v steps=2 -v rev=1 >actual &&
750 test_cmp actual expected &&
751 cat <<-EOT >expected &&
756 <graph tgnav "" -v steps=3 -v rev=1 >actual &&
757 test_cmp actual expected &&
758 cat <<-EOT >expected &&
762 <graph tgnav "" -v steps=4 -v rev=1 >actual &&
763 test_cmp actual expected &&
764 echo "c w" >expected &&
765 <graph tgnav "" -v steps=5 -v rev=1 >actual &&
766 test_cmp actual expected &&
767 >expected &&
768 <graph tgnav "" -v steps=6 -v rev=1 >actual &&
769 test_cmp actual expected
772 test_expect_success 'pin works' '
773 cat <<-EOT >graph &&
781 >expected &&
782 <graph tgnav "a" -v steps=1 >actual &&
783 test_cmp actual expected &&
784 <graph tgnav "a" -v steps=2 -v rev=1 >actual &&
785 test_cmp actual expected &&
786 echo "a a" >expected &&
787 <graph tgnav "a" -v steps=1 -v pin=1 >actual &&
788 test_cmp actual expected &&
789 <graph tgnav "a" -v steps=99 -v pin=1 >actual &&
790 test_cmp actual expected &&
791 echo "b a" >expected &&
792 <graph tgnav "a" -v steps=1 -v rev=1 >actual &&
793 test_cmp actual expected &&
794 cat <<-EOT >expected &&
799 <graph tgnav "b" -v steps=1 >actual &&
800 test_cmp actual expected &&
801 cat <<-EOT >expected &&
805 <graph tgnav "b" -v steps=2 >actual &&
806 test_cmp actual expected &&
807 cat <<-EOT >expected &&
812 <graph tgnav "b" -v steps=2 -v pin=1 >actual &&
813 test_cmp actual expected &&
814 echo "r r" >expected &&
815 <graph tgnav "b" -v steps=3 >actual &&
816 test_cmp actual expected &&
817 cat <<-EOT >expected &&
822 <graph tgnav "b" -v steps=3 -v pin=1 >actual &&
823 test_cmp actual expected &&
824 <graph tgnav "b" -v steps=99 -v pin=1 >actual &&
825 test_cmp actual expected &&
826 >expected &&
827 <graph tgnav "b" -v steps=4 >actual &&
828 test_cmp actual expected &&
830 echo "b c" >>graph &&
831 echo "c a r w" >expected &&
832 <graph tgnav "b" -v steps=1 -v rev=1 >actual &&
833 test_cmp actual expected &&
834 <graph tgnav "b" -v steps=2 -v rev=1 -v pin=1 >actual &&
835 test_cmp actual expected &&
836 <graph tgnav "b" -v steps=99 -v rev=1 -v pin=1 >actual &&
837 test_cmp actual expected &&
838 >expected &&
839 <graph tgnav "b" -v steps=2 -v rev=1 >actual &&
840 test_cmp actual expected &&
841 <graph tgnav "b" -v steps=2 -v rev=1 -v pin=1 >actual &&
843 echo "r r" >expected &&
844 <graph tgnav "t" -v steps=2 >actual &&
845 test_cmp actual expected &&
846 <graph tgnav "t" -v steps=3 -v pin=1 >actual &&
847 test_cmp actual expected &&
848 <graph tgnav "t" -v steps=99 -v pin=1 >actual &&
849 test_cmp actual expected &&
850 echo "c r" >expected &&
851 <graph tgnav "t" -v steps=2 -v rev=1 >actual &&
852 <graph tgnav "t" -v steps=3 -v rev=1 -v pin=1 >actual &&
853 test_cmp actual expected &&
854 <graph tgnav "t" -v steps=99 -v rev=1 -v pin=1 >actual &&
855 test_cmp actual expected &&
856 <graph tgnav "t" -v steps=99 -v rev=1 -v pin=5 >actual &&
857 test_cmp actual expected &&
858 <graph tgnav "t" -v steps=99 -v rev=1 -v pin=-1 >actual &&
859 test_cmp actual expected &&
860 <graph tgnav "t" -v steps=99 -v rev=1 -v pin="true" >actual &&
861 test_cmp actual expected &&
862 <graph tgnav "t" -v steps=99 -v rev=1 -v pin="is true" >actual &&
863 test_cmp actual expected &&
864 >expected &&
865 <graph tgnav "t" -v steps=3 >actual &&
866 test_cmp actual expected &&
867 <graph tgnav "t" -v steps=3 -v rev=1 >actual &&
868 test_cmp actual expected
871 test_expect_success 'multi startb' '
872 cat <<-EOT >graph &&
880 echo "b a r w" >expected &&
881 <graph tgnav "b" -v steps=0 >actual &&
882 test_cmp actual expected &&
883 <graph tgnav "b b b b" -v steps=0 >actual &&
884 test_cmp actual expected &&
885 <graph tgnav "b x t a" -v steps=1 -v rev=1 -v pin=1 >actual &&
886 test_cmp actual expected &&
887 echo "b w r a" >expected &&
888 <graph tgnav "b x t a" -v steps=1 -v rev=1 -v pin=0 >actual &&
889 test_cmp actual expected &&
890 cat <<-EOT >expected &&
894 b a r w
896 <graph tgnav "r s t b" -v steps=0 >actual &&
897 test_cmp actual expected &&
898 <graph tgnav "r s t b" -v steps=0 -v pin=1 >actual &&
899 test_cmp actual expected &&
900 cat <<-EOT >expected &&
907 <graph tgnav "r s t b" -v steps=1 >actual &&
908 test_cmp actual expected &&
909 <graph tgnav "r s t b" -v steps=1 -v pin=1 >actual &&
910 test_cmp actual expected &&
911 cat <<-EOT >expected &&
916 <graph tgnav "r s t b" -v steps=2 >actual &&
917 test_cmp actual expected &&
918 cat <<-EOT >expected &&
924 <graph tgnav "r s t b" -v steps=2 -v pin=1 >actual &&
925 test_cmp actual expected &&
926 echo "r r" >expected &&
927 <graph tgnav "r s t b" -v steps=3 >actual &&
928 test_cmp actual expected &&
929 cat <<-EOT >expected &&
934 <graph tgnav "r s t b" -v steps=3 -v pin=1 >actual &&
935 test_cmp actual expected &&
936 <graph tgnav "r s t b" -v steps=99 -v pin=1 >actual &&
937 test_cmp actual expected &&
938 >expected &&
939 <graph tgnav "r s t b" -v steps=4 >actual &&
940 test_cmp actual expected &&
942 cat <<-EOT >expected &&
947 <graph tgnav "r s t b" -v steps=1 -v rev=1 >actual &&
948 test_cmp actual expected &&
949 cat <<-EOT >expected &&
952 b r a w
954 <graph tgnav "r s t b" -v steps=1 -v rev=1 -v pin=1 >actual &&
955 test_cmp actual expected &&
956 cat <<-EOT >expected &&
960 <graph tgnav "r s t b" -v steps=2 -v rev=1 >actual &&
961 test_cmp actual expected &&
962 cat <<-EOT >expected &&
964 b r a w
966 <graph tgnav "r s t b" -v steps=2 -v rev=1 -v pin=1 >actual &&
967 test_cmp actual expected &&
968 echo "b r" >expected &&
969 <graph tgnav "r s t b" -v steps=3 -v rev=1 >actual &&
970 test_cmp actual expected &&
971 echo "b r a w" >expected &&
972 <graph tgnav "r s t b" -v steps=3 -v rev=1 -v pin=1 >actual &&
973 test_cmp actual expected &&
974 <graph tgnav "r s t b" -v steps=4 -v rev=1 -v pin=1 >actual &&
975 test_cmp actual expected &&
976 <graph tgnav "r s t b" -v steps=99 -v rev=1 -v pin=1 >actual &&
977 test_cmp actual expected &&
978 >expected &&
979 <graph tgnav "r s t b" -v steps=4 -v rev=1 >actual &&
980 test_cmp actual expected &&
981 <graph tgnav "r s t b" -v steps=99 -v rev=1 >actual &&
982 test_cmp actual expected
985 test_expect_success 'fldone works' '
986 cat <<-EOT >graph &&
994 printf "%s\n" a r w >expected &&
995 <graph tgnav "" -v steps=-1 >actual &&
996 test_cmp actual expected &&
997 <graph tgnav "" -v steps=-1 -v fldone=1 >actual &&
998 test_cmp actual expected &&
999 echo b >expected &&
1000 <graph tgnav "" -v steps=1 >actual &&
1001 test_cmp actual expected &&
1002 <graph tgnav "" -v steps=1 -v fldone=1 >actual &&
1003 test_cmp actual expected &&
1004 cat <<-EOT >expected &&
1008 b a r w
1010 <graph tgnav "r s t b" -v steps=0 >actual &&
1011 test_cmp actual expected &&
1012 printf "%s\n" r s t b >expected &&
1013 <graph tgnav "r s t b" -v steps=0 -v fldone=1 >actual &&
1014 test_cmp actual expected &&
1015 <graph tgnav "r s t b" -v steps=0 -v fldone=true >actual &&
1016 test_cmp actual expected &&
1017 cat <<-EOT >expected &&
1019 b r a w
1021 <graph tgnav "r s t b" -v steps=2 -v rev=1 -v pin=1 >actual &&
1022 test_cmp actual expected &&
1023 printf "%s\n" t b >expected &&
1024 <graph tgnav "r s t b" -v steps=2 -v rev=1 -v pin=1 -v fldone=1 >actual &&
1025 test_cmp actual expected &&
1026 printf "%s\n" r s w >expected &&
1027 <graph tgnav "r s t b" -v steps=2 -v fldone=true >actual &&
1028 test_cmp actual expected
1031 test_expect_success 'input order maintained on output' '
1032 # only relevant for heads/roots shortcut
1033 # the heads or roots are to be output in the same
1034 # order they occurred in the input stream
1035 printf "%s\n" a b c >expected &&
1036 printf "%s\n" "a a" "b b" "c c" |
1037 tgnav "" -v steps=1 >actual &&
1038 test_cmp actual expected &&
1039 printf "%s\n" "a a" "b b" "c c" |
1040 tgnav "" -v steps=-1 >actual &&
1041 test_cmp actual expected &&
1042 printf "%s\n" a c b >expected &&
1043 printf "%s\n" "a a" "c c" "b b" |
1044 tgnav "" -v steps=1 >actual &&
1045 test_cmp actual expected &&
1046 printf "%s\n" "a a" "c c" "b b" |
1047 tgnav "" -v steps=-1 >actual &&
1048 test_cmp actual expected &&
1049 printf "%s\n" b a c >expected &&
1050 printf "%s\n" "b b" "a a" "c c" |
1051 tgnav "" -v steps=1 >actual &&
1052 test_cmp actual expected &&
1053 printf "%s\n" "b b" "a a" "c c" |
1054 tgnav "" -v steps=-1 >actual &&
1055 test_cmp actual expected &&
1056 printf "%s\n" b c a >expected &&
1057 printf "%s\n" "b b" "c c" "a a" |
1058 tgnav "" -v steps=1 >actual &&
1059 test_cmp actual expected &&
1060 printf "%s\n" "b b" "c c" "a a" |
1061 tgnav "" -v steps=-1 >actual &&
1062 test_cmp actual expected &&
1063 printf "%s\n" c a b >expected &&
1064 printf "%s\n" "c c" "a a" "b b" |
1065 tgnav "" -v steps=1 >actual &&
1066 test_cmp actual expected &&
1067 printf "%s\n" "c c" "a a" "b b" |
1068 tgnav "" -v steps=-1 >actual &&
1069 test_cmp actual expected &&
1070 printf "%s\n" c b a >expected &&
1071 printf "%s\n" "c c" "b b" "a a" |
1072 tgnav "" -v steps=1 >actual &&
1073 test_cmp actual expected &&
1074 printf "%s\n" "c c" "b b" "a a" |
1075 tgnav "" -v steps=-1 >actual &&
1076 test_cmp actual expected
1079 test_expect_success 'no default loop check for heads/roots' '
1080 cat <<-EOT >graph &&
1086 printf "%s\n" "a b" "b a" >graph2 &&
1087 >expected &&
1088 <graph test_must_fail tgnav "a" -v steps=0 >actual &&
1089 test_cmp actual expected &&
1090 <graph2 test_must_fail tgnav "a" -v steps=0 >actual &&
1091 test_cmp actual expected &&
1092 echo d >expected &&
1093 <graph tgnav "" -v steps=1 >actual &&
1094 test_cmp actual expected &&
1095 echo a >expected &&
1096 <graph tgnav "" -v steps=-1 >actual &&
1097 test_cmp actual expected &&
1098 <graph tgnav "" -v steps=1 -v rev=1 >actual &&
1099 test_cmp actual expected &&
1100 >expected &&
1101 <graph2 tgnav "" -v steps=1 >actual &&
1102 test_cmp actual expected &&
1103 <graph2 tgnav "" -v steps=-1 >actual &&
1104 test_cmp actual expected &&
1105 <graph2 tgnav "" -v steps=1 -v rev=1 >actual &&
1106 test_cmp actual expected
1109 test_expect_success 'default loop check' '
1110 cat <<-EOT >graph &&
1116 printf "%s\n" "a b" "b a" >graph2 &&
1117 >expected &&
1118 <graph test_expect_code 65 tgnav "" -v steps=-1 -v rev=1 >actual &&
1119 test_cmp actual expected &&
1120 <graph test_expect_code 65 tgnav "" -v steps=2 >actual &&
1121 test_cmp actual expected &&
1122 <graph test_expect_code 65 tgnav "a" -v steps=0 >actual &&
1123 test_cmp actual expected &&
1124 <graph test_expect_code 65 tgnav "a" -v steps=1 >actual &&
1125 test_cmp actual expected &&
1126 <graph test_expect_code 65 tgnav "a" -v steps=2 >actual &&
1127 test_cmp actual expected &&
1128 <graph test_expect_code 65 tgnav "a" -v steps=2 -v chklps=1 >actual &&
1129 test_cmp actual expected &&
1130 <graph test_expect_code 65 tgnav "a" -v steps=-1 >actual &&
1131 test_cmp actual expected &&
1132 <graph test_expect_code 65 tgnav "b" -v steps=0 >actual &&
1133 test_cmp actual expected &&
1134 <graph test_expect_code 65 tgnav "b" -v steps=1 >actual &&
1135 test_cmp actual expected &&
1136 <graph test_expect_code 65 tgnav "b" -v steps=2 >actual &&
1137 test_cmp actual expected &&
1138 <graph test_expect_code 65 tgnav "b" -v steps=-1 >actual &&
1139 test_cmp actual expected &&
1140 <graph test_expect_code 65 tgnav "b" -v steps=0 -v rev=1 >actual &&
1141 test_cmp actual expected &&
1142 <graph test_expect_code 65 tgnav "b" -v steps=1 -v rev=1 >actual &&
1143 test_cmp actual expected &&
1144 <graph test_expect_code 65 tgnav "b" -v steps=2 -v rev=1 >actual &&
1145 test_cmp actual expected &&
1146 <graph test_expect_code 65 tgnav "b" -v steps=-1 -v rev=1 >actual &&
1147 test_cmp actual expected &&
1148 <graph test_expect_code 65 tgnav "c" -v steps=0 >actual &&
1149 test_cmp actual expected &&
1150 <graph test_expect_code 65 tgnav "c" -v steps=0 -v chklps=1 >actual &&
1151 test_cmp actual expected &&
1152 <graph test_expect_code 65 tgnav "d" -v steps=0 >actual &&
1153 test_cmp actual expected &&
1154 <graph test_expect_code 65 tgnav "d" -v steps=0 -v chklps=1 >actual &&
1155 test_cmp actual expected &&
1156 <graph2 test_expect_code 65 tgnav "a" -v steps=0 >actual &&
1157 test_cmp actual expected &&
1158 <graph2 test_expect_code 65 tgnav "a" -v steps=1 >actual &&
1159 test_cmp actual expected &&
1160 <graph2 test_expect_code 65 tgnav "a" -v steps=1 -v chklps=1 >actual &&
1161 test_cmp actual expected &&
1162 <graph2 test_expect_code 65 tgnav "a" -v steps=2 >actual &&
1163 test_cmp actual expected &&
1164 <graph2 test_expect_code 65 tgnav "a" -v steps=2 -v chklps=1 >actual &&
1165 test_cmp actual expected &&
1166 <graph2 test_expect_code 65 tgnav "a" -v steps=-1 >actual &&
1167 test_cmp actual expected &&
1168 <graph2 test_expect_code 65 tgnav "b" -v steps=0 >actual &&
1169 test_cmp actual expected &&
1170 <graph2 test_expect_code 65 tgnav "b" -v steps=1 >actual &&
1171 test_cmp actual expected &&
1172 <graph2 test_expect_code 65 tgnav "b" -v steps=2 >actual &&
1173 test_cmp actual expected &&
1174 <graph2 test_expect_code 65 tgnav "b" -v steps=-1 >actual &&
1175 test_cmp actual expected &&
1176 <graph2 test_expect_code 65 tgnav "b" -v steps=-1 -v chklps=1 >actual &&
1177 test_cmp actual expected &&
1178 <graph2 test_expect_code 65 tgnav "none" -v steps=0 >actual &&
1179 test_cmp actual expected &&
1180 <graph2 test_expect_code 65 tgnav "none" -v steps=0 -v chklps=1 >actual &&
1181 test_cmp actual expected
1184 test_expect_success 'forced loop check' '
1185 cat <<-EOT >graph &&
1191 printf "%s\n" "a b" "b a" >graph2 &&
1192 >expected &&
1193 <graph test_expect_code 65 tgnav "" -v steps=1 -v chklps=1 >actual &&
1194 test_cmp actual expected &&
1195 <graph test_expect_code 65 tgnav "" -v steps=-1 -v chklps=1 >actual &&
1196 test_cmp actual expected &&
1197 <graph2 test_expect_code 65 tgnav "" -v steps=1 -v chklps=1 >actual &&
1198 test_cmp actual expected &&
1199 <graph2 test_expect_code 65 tgnav "" -v steps=-1 -v chklps=1 >actual &&
1200 test_cmp actual expected &&
1201 <graph test_expect_code 65 tgnav "" -v steps=1 -v rev=1 -v chklps=1 >actual &&
1202 test_cmp actual expected &&
1203 <graph test_expect_code 65 tgnav "" -v steps=-1 -v rev=1 -v chklps=1 >actual &&
1204 test_cmp actual expected &&
1205 <graph2 test_expect_code 65 tgnav "" -v steps=1 -v rev=1 -v chklps=1 >actual &&
1206 test_cmp actual expected &&
1207 <graph2 test_expect_code 65 tgnav "" -v steps=-1 -v rev=1 -v chklps=1 >actual &&
1208 test_cmp actual expected
1211 test_expect_success 'inclbr' '
1212 cat <<-EOT >graph &&
1218 echo e >expected &&
1219 <graph tgnav "" -v steps=1 >actual &&
1220 test_cmp actual expected &&
1221 <graph tgnav "" -v steps=1 -v inclbr="b d" >actual &&
1222 test_cmp actual expected &&
1223 echo a >expected &&
1224 <graph tgnav "" -v steps=-1 >actual &&
1225 test_cmp actual expected &&
1226 <graph tgnav "" -v steps=-1 -v inclbr="b d" >actual &&
1227 test_cmp actual expected &&
1228 echo d >expected &&
1229 <graph tgnav "" -v steps=1 -v inclbr=c >actual &&
1230 test_cmp actual expected &&
1231 echo b >expected &&
1232 <graph tgnav "" -v steps=-1 -v inclbr=c >actual &&
1233 test_cmp actual expected &&
1234 printf "%s\n" b e >expected &&
1235 <graph tgnav "" -v steps=1 -v inclbr="e a" >actual &&
1236 test_cmp actual expected &&
1237 printf "%s\n" a d >expected &&
1238 <graph tgnav "" -v steps=-1 -v inclbr="e a" >actual &&
1239 test_cmp actual expected &&
1240 echo "b b" >expected &&
1241 <graph tgnav "c" -v steps=1 -v inclbr=c >actual &&
1242 test_cmp actual expected &&
1243 echo "d b" >expected &&
1244 <graph tgnav "c" -v steps=1 -v rev=1 -v inclbr=c >actual &&
1245 test_cmp actual expected &&
1246 >expected &&
1247 <graph tgnav "c" -v steps=2 -v inclbr=c >actual &&
1248 test_cmp actual expected &&
1249 <graph tgnav "c" -v steps=2 -v rev=1 -v inclbr=c >actual &&
1250 test_cmp actual expected
1253 test_expect_success 'exclbr' '
1254 cat <<-EOT >graph &&
1260 printf "%s\n" b e >expected &&
1261 <graph tgnav "" -v steps=1 -v exclbr="c" >actual &&
1262 test_cmp actual expected &&
1263 <graph tgnav "" -v steps=-1 -v rev=1 -v exclbr="c" >actual &&
1264 test_cmp actual expected &&
1265 printf "%s\n" a d >expected &&
1266 <graph tgnav "" -v steps=-1 -v exclbr="c" >actual &&
1267 test_cmp actual expected &&
1268 <graph tgnav "" -v steps=1 -v rev=1 -v exclbr="c" >actual &&
1269 test_cmp actual expected &&
1270 >expected &&
1271 <graph tgnav "" -v steps=1 -v exclbr="b d" >actual &&
1272 test_cmp actual expected &&
1273 <graph tgnav "" -v steps=-1 -v exclbr="b d" >actual &&
1274 test_cmp actual expected &&
1275 echo "c b" >expected &&
1276 <graph tgnav "e" -v steps=2 -v exclbr="a" >actual &&
1277 test_cmp actual expected &&
1278 echo "d b" >expected &&
1279 <graph tgnav "b" -v steps=2 -v rev=1 -v exclbr="a" >actual &&
1280 test_cmp actual expected
1283 test_expect_success 'inclbr + exclbr' '
1284 cat <<-EOT >graph &&
1306 printf "%s\n" e g h i 1 2 3 4 5 >expected &&
1307 <graph tgnav "" -v steps=1 >actual &&
1308 test_cmp actual expected &&
1309 printf "%s\n" a m w >expected &&
1310 <graph tgnav "" -v steps=-1 >actual &&
1311 test_cmp actual expected &&
1312 printf "%s\n" d 1 5 >expected &&
1313 <graph tgnav "" -v steps=1 -v inclbr="c z" >actual &&
1314 test_cmp actual expected &&
1315 printf "%s\n" b o w >expected &&
1316 <graph tgnav "" -v steps=-1 -v inclbr="c z" >actual &&
1317 test_cmp actual expected &&
1318 printf "%s\n" c h i 1 2 3 4 5 >expected &&
1319 <graph tgnav "" -v steps=1 -v exclbr="d w" >actual &&
1320 test_cmp actual expected &&
1321 printf "%s\n" a m f x y z >expected &&
1322 <graph tgnav "" -v steps=-1 -v exclbr="d w" >actual &&
1323 test_cmp actual expected &&
1324 printf "%s\n" c 1 5 >expected &&
1325 <graph tgnav "" -v steps=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1326 test_cmp actual expected &&
1327 printf "%s\n" b o z >expected &&
1328 <graph tgnav "" -v steps=-1 -v inclbr="c z" -v exclbr="d w" >actual &&
1329 test_cmp actual expected &&
1330 cat <<-EOT >expected &&
1336 <graph tgnav "" -v steps=2 -v inclbr="c z" -v exclbr="d w" >actual &&
1337 test_cmp actual expected &&
1338 cat <<-EOT >expected &&
1339 c b o
1342 <graph tgnav "" -v steps=2 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1343 test_cmp actual expected &&
1344 echo "z z" >expected &&
1345 <graph tgnav "" -v steps=3 -v inclbr="c z" -v exclbr="d w" >actual &&
1346 test_cmp actual expected &&
1347 echo "1 z" >expected &&
1348 <graph tgnav "" -v steps=3 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1349 test_cmp actual expected &&
1350 >expected &&
1351 <graph tgnav "" -v steps=4 -v inclbr="c z" -v exclbr="d w" >actual &&
1352 test_cmp actual expected &&
1353 <graph tgnav "" -v steps=4 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1354 test_cmp actual expected &&
1355 <graph tgnav "c" -v steps=2 -v inclbr="c z" -v exclbr="d w" >actual &&
1356 test_cmp actual expected &&
1357 <graph tgnav "b" -v steps=2 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1358 test_cmp actual expected &&
1359 <graph tgnav "o" -v steps=2 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1360 test_cmp actual expected &&
1361 <graph tgnav "5" -v steps=2 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1362 test_cmp actual expected &&
1363 <graph tgnav "5" -v steps=2 -v inclbr="c z" -v exclbr="d w" >actual &&
1364 test_cmp actual expected &&
1365 <graph tgnav "1" -v steps=1 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1366 test_cmp actual expected &&
1367 <graph tgnav "1" -v steps=3 -v inclbr="c z" -v exclbr="d w" >actual &&
1368 test_cmp actual expected &&
1369 <graph tgnav "z" -v steps=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1370 test_cmp actual expected &&
1371 <graph tgnav "z" -v steps=3 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1372 test_cmp actual expected &&
1373 echo "c b o" >expected &&
1374 <graph tgnav "c" -v steps=0 -v inclbr="c z" -v exclbr="d w" >actual &&
1375 test_cmp actual expected &&
1376 <graph tgnav "c" -v steps=0 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1377 test_cmp actual expected &&
1378 cat <<-EOT >expected &&
1382 <graph tgnav "c" -v steps=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1383 test_cmp actual expected &&
1384 echo "b b" >expected &&
1385 <graph tgnav "b" -v steps=0 -v inclbr="c z" -v exclbr="d w" >actual &&
1386 test_cmp actual expected &&
1387 <graph tgnav "b" -v steps=0 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1388 test_cmp actual expected &&
1389 echo "c b" >expected &&
1390 <graph tgnav "b" -v steps=1 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1391 test_cmp actual expected &&
1392 echo "o o" >expected &&
1393 <graph tgnav "o" -v steps=0 -v inclbr="c z" -v exclbr="d w" >actual &&
1394 test_cmp actual expected &&
1395 <graph tgnav "o" -v steps=0 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1396 test_cmp actual expected &&
1397 echo "c o" >expected &&
1398 <graph tgnav "o" -v steps=1 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1399 test_cmp actual expected &&
1400 echo "5 z" >expected &&
1401 <graph tgnav "5" -v steps=0 -v inclbr="c z" -v exclbr="d w" >actual &&
1402 test_cmp actual expected &&
1403 <graph tgnav "5" -v steps=0 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1404 test_cmp actual expected &&
1405 echo "1 z" >expected &&
1406 <graph tgnav "5" -v steps=1 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1407 test_cmp actual expected &&
1408 echo "z z" >expected &&
1409 <graph tgnav "5" -v steps=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1410 test_cmp actual expected &&
1411 echo "1 z" >expected &&
1412 <graph tgnav "1" -v steps=0 -v inclbr="c z" -v exclbr="d w" >actual &&
1413 test_cmp actual expected &&
1414 <graph tgnav "1" -v steps=0 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1415 test_cmp actual expected &&
1416 echo "5 z" >expected &&
1417 <graph tgnav "1" -v steps=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1418 test_cmp actual expected &&
1419 echo "z z" >expected &&
1420 <graph tgnav "1" -v steps=2 -v inclbr="c z" -v exclbr="d w" >actual &&
1421 test_cmp actual expected &&
1422 echo "z z" >expected &&
1423 <graph tgnav "z" -v steps=0 -v inclbr="c z" -v exclbr="d w" >actual &&
1424 test_cmp actual expected &&
1425 <graph tgnav "z" -v steps=0 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1426 test_cmp actual expected &&
1427 echo "5 z" >expected &&
1428 <graph tgnav "z" -v steps=1 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1429 test_cmp actual expected &&
1430 echo "1 z" >expected &&
1431 <graph tgnav "z" -v steps=2 -v rev=1 -v inclbr="c z" -v exclbr="d w" >actual &&
1432 test_cmp actual expected
1435 test_expect_success 'pruneb positive refs' '
1436 cat <<-EOT >graph &&
1458 printf "%s\n" e g h i 1 2 3 4 5 >expected &&
1459 <graph tgnav "" -v steps=1 >actual &&
1460 test_cmp actual expected &&
1461 printf "%s\n" 1 2 3 4 5 >expected &&
1462 <graph tgnav "" -v steps=1 -v pruneb="w" >actual &&
1463 test_cmp actual expected &&
1464 <graph tgnav "" -v steps=1 -v pruneb="^ ^w" >actual &&
1465 test_cmp actual expected &&
1466 <graph tgnav "" -v steps=1 -v pruneb="^ ^ w" >actual &&
1467 test_cmp actual expected &&
1468 <graph tgnav "" -v steps=1 -v pruneb="^ ^ ^ ^w" >actual &&
1469 test_cmp actual expected &&
1470 printf "%s\n" 1 3 4 5 >expected &&
1471 <graph tgnav "" -v steps=1 -v pruneb="y z" >actual &&
1472 test_cmp actual expected &&
1473 echo c >expected &&
1474 <graph tgnav "" -v steps=-1 -v pruneb="c" >actual &&
1475 test_cmp actual expected &&
1476 printf "%s\n" e f g >expected &&
1477 <graph tgnav "" -v steps=-1 -v pruneb="e f g" >actual &&
1478 test_cmp actual expected &&
1479 printf "%s\n" e g h i >expected &&
1480 <graph tgnav "" -v steps=1 -v pruneb="c" >actual &&
1481 test_cmp actual expected &&
1482 <graph tgnav "" -v steps=1 -v pruneb="e f g" >actual &&
1483 test_cmp actual expected &&
1484 printf "%s\n" h i >expected &&
1485 <graph tgnav "" -v steps=1 -v pruneb="f" >actual &&
1486 test_cmp actual expected
1489 test_expect_success 'pruneb negative refs' '
1490 cat <<-EOT >graph &&
1512 printf "%s\n" e g h i 1 2 3 4 5 >expected &&
1513 <graph tgnav "" -v steps=1 >actual &&
1514 test_cmp actual expected &&
1515 printf "%s\n" a m w >expected &&
1516 <graph tgnav "" -v steps=-1 -v pruneb="^c ^z" >actual &&
1517 test_cmp actual expected &&
1518 printf "%s\n" b o 2 3 4 >expected &&
1519 <graph tgnav "" -v steps=1 -v pruneb="^c ^z" >actual &&
1520 test_cmp actual expected &&
1521 <graph tgnav "" -v steps=1 -v pruneb="^ c z" >actual &&
1522 test_cmp actual expected &&
1523 <graph tgnav "" -v steps=1 -v pruneb="^ ^ ^c ^z" >actual &&
1524 test_cmp actual expected &&
1525 <graph tgnav "" -v steps=1 -v pruneb="^c ^ z" >actual &&
1526 test_cmp actual expected &&
1527 <graph tgnav "" -v steps=1 -v pruneb="^ c ^ ^z" >actual &&
1528 test_cmp actual expected &&
1529 printf "%s\n" b n 1 2 5 >expected &&
1530 <graph tgnav "" -v steps=1 -v pruneb="^ o y" >actual &&
1531 test_cmp actual expected &&
1532 echo m >expected &&
1533 <graph tgnav "" -v steps=-1 -v pruneb="^ a w" >actual &&
1534 test_cmp actual expected
1537 test_expect_success 'pruneb positive and negative refs' '
1538 cat <<-EOT >graph &&
1560 printf "%s\n" e g h i 1 2 3 4 5 >expected &&
1561 <graph tgnav "" -v steps=1 >actual &&
1562 test_cmp actual expected &&
1563 printf "%s\n" e g >expected &&
1564 <graph tgnav "" -v steps=1 -v pruneb="b n ^ f" >actual &&
1565 test_cmp actual expected &&
1566 printf "%s\n" b n >expected &&
1567 <graph tgnav "" -v steps=-1 -v pruneb="b n ^ f" >actual &&
1568 test_cmp actual expected &&
1569 echo o >expected &&
1570 <graph tgnav "" -v steps=-1 -v pruneb="o ^ e g" >actual &&
1571 test_cmp actual expected &&
1572 printf "%s\n" h i >expected &&
1573 <graph tgnav "" -v steps=1 -v pruneb="o ^ e g" >actual &&
1574 test_cmp actual expected &&
1575 printf "%s\n" 2 3 4 5 >expected &&
1576 <graph tgnav "" -v steps=1 -v pruneb="^1 x y z" >actual &&
1577 test_cmp actual expected &&
1578 printf "%s\n" y 1 2 5 >expected &&
1579 <graph tgnav "" -v steps=1 -v pruneb="^ 3 4 ^x ^y ^z" >actual &&
1580 test_cmp actual expected &&
1581 printf "%s\n" x y z >expected &&
1582 <graph tgnav "" -v steps=-1 -v pruneb="^ 3 4 ^x ^y ^z" >actual &&
1583 test_cmp actual expected
1586 test_expect_success 'pruneb positive and negative refs + inclbr/exclbr' '
1587 cat <<-EOT >graph &&
1609 printf "%s\n" e g h i 1 2 3 4 5 >expected &&
1610 <graph tgnav "" -v steps=1 >actual &&
1611 test_cmp actual expected &&
1612 echo d >expected &&
1613 <graph tgnav "" -v steps=-1 -v inclbr=d -v exclbr=c -v pruneb=^c >actual &&
1614 test_cmp actual expected &&
1615 <graph tgnav "" -v steps=-1 -v inclbr="e f g" -v exclbr=h -v pruneb=^c >actual &&
1616 test_cmp actual expected &&
1617 printf "%s\n" e g i >expected &&
1618 <graph tgnav "" -v steps=1 -v inclbr="e f g" -v exclbr=h -v pruneb=^c >actual &&
1619 test_cmp actual expected &&
1620 printf "%s\n" e f g >expected &&
1621 <graph tgnav "" -v steps=1 -v inclbr=d -v exclbr=c -v pruneb=^c >actual &&
1622 test_cmp actual expected &&
1623 echo n >expected &&
1624 <graph tgnav "" -v steps=-1 -v inclbr="d o" -v exclbr=f -v pruneb=^c >actual &&
1625 test_cmp actual expected &&
1626 echo o >expected &&
1627 <graph tgnav "" -v steps=1 -v inclbr="d o" -v exclbr=f -v pruneb=^c >actual &&
1628 test_cmp actual expected &&
1629 printf "%s\n" h i 1 2 >expected &&
1630 <graph tgnav "" -v steps=1 -v exclbr="c z" -v pruneb="f x" >actual &&
1631 test_cmp actual expected &&
1632 printf "%s\n" f x >expected &&
1633 <graph tgnav "" -v steps=-1 -v exclbr="c z" -v pruneb="f x" >actual &&
1634 test_cmp actual expected
1637 test_done