##// END OF EJS Templates
graphmod: allow edges to end early...
Martijn Pieters -
r28601:cd10171d default
parent child Browse files
Show More
@@ -2227,6 +2227,8 b' def displaygraph(ui, repo, dag, displaye'
2227 for name, key in edgetypes.items():
2227 for name, key in edgetypes.items():
2228 # experimental config: ui.graphstyle.*
2228 # experimental config: ui.graphstyle.*
2229 styles[key] = ui.config('ui', 'graphstyle.%s' % name, styles[key])
2229 styles[key] = ui.config('ui', 'graphstyle.%s' % name, styles[key])
2230 if not styles[key]:
2231 styles[key] = None
2230 for rev, type, ctx, parents in dag:
2232 for rev, type, ctx, parents in dag:
2231 char = formatnode(repo, ctx)
2233 char = formatnode(repo, ctx)
2232 copies = None
2234 copies = None
@@ -31,6 +31,8 b" CHANGESET = 'C'"
31 PARENT = 'P'
31 PARENT = 'P'
32 GRANDPARENT = 'G'
32 GRANDPARENT = 'G'
33 MISSINGPARENT = 'M'
33 MISSINGPARENT = 'M'
34 # Style of line to draw. None signals a line that ends and is removed at this
35 # point.
34 EDGES = {PARENT: '|', GRANDPARENT: '|', MISSINGPARENT: '|'}
36 EDGES = {PARENT: '|', GRANDPARENT: '|', MISSINGPARENT: '|'}
35
37
36 def groupbranchiter(revs, parentsfunc, firstbranch=()):
38 def groupbranchiter(revs, parentsfunc, firstbranch=()):
@@ -483,6 +485,56 b' def _getpaddingline(echars, idx, ncols, '
483 line.extend(echars[-(remainder * 2):])
485 line.extend(echars[-(remainder * 2):])
484 return line
486 return line
485
487
488 def _drawendinglines(lines, extra, edgemap, seen):
489 """Draw ending lines for missing parent edges
490
491 None indicates an edge that ends at between this node and the next
492 Replace with a short line ending in ~ and add / lines to any edges to
493 the right.
494
495 """
496 if None not in edgemap.values():
497 return
498
499 # Check for more edges to the right of our ending edges.
500 # We need enough space to draw adjustment lines for these.
501 edgechars = extra[::2]
502 while edgechars and edgechars[-1] is None:
503 edgechars.pop()
504 shift_size = max((edgechars.count(None) * 2) - 1, 0)
505 while len(lines) < 3 + shift_size:
506 lines.append(extra[:])
507
508 if shift_size:
509 empties = []
510 toshift = []
511 first_empty = extra.index(None)
512 for i, c in enumerate(extra[first_empty::2], first_empty // 2):
513 if c is None:
514 empties.append(i * 2)
515 else:
516 toshift.append(i * 2)
517 targets = list(range(first_empty, first_empty + len(toshift) * 2, 2))
518 positions = toshift[:]
519 for line in lines[-shift_size:]:
520 line[first_empty:] = [' '] * (len(line) - first_empty)
521 for i in range(len(positions)):
522 pos = positions[i] - 1
523 positions[i] = max(pos, targets[i])
524 line[pos] = '/' if pos > targets[i] else extra[toshift[i]]
525
526 map = {1: '|', 2: '~'}
527 for i, line in enumerate(lines):
528 if None not in line:
529 continue
530 line[:] = [c or map.get(i, ' ') for c in line]
531
532 # remove edges that ended
533 remove = [p for p, c in edgemap.items() if c is None]
534 for parent in remove:
535 del edgemap[parent]
536 seen.remove(parent)
537
486 def asciistate():
538 def asciistate():
487 """returns the initial value for the "state" argument to ascii()"""
539 """returns the initial value for the "state" argument to ascii()"""
488 return {
540 return {
@@ -582,12 +634,15 b' def ascii(ui, state, type, char, text, c'
582
634
583 # make sure that there are as many graph lines as there are
635 # make sure that there are as many graph lines as there are
584 # log strings
636 # log strings
637 extra_interline = echars[:(ncols + coldiff) * 2]
638 if len(lines) < len(text):
639 while len(lines) < len(text):
640 lines.append(extra_interline[:])
641
642 _drawendinglines(lines, extra_interline, edgemap, seen)
643
585 while len(text) < len(lines):
644 while len(text) < len(lines):
586 text.append("")
645 text.append("")
587 if len(lines) < len(text):
588 extra_interline = echars[:(ncols + coldiff) * 2]
589 while len(lines) < len(text):
590 lines.append(extra_interline)
591
646
592 # print lines
647 # print lines
593 indentation_level = max(ncols, ncols + coldiff)
648 indentation_level = max(ncols, ncols + coldiff)
@@ -2423,7 +2423,7 b' change graph edge styling'
2423 > [ui]
2423 > [ui]
2424 > graphstyle.parent = |
2424 > graphstyle.parent = |
2425 > graphstyle.grandparent = :
2425 > graphstyle.grandparent = :
2426 > graphstyle.missing = .
2426 > graphstyle.missing =
2427 > EOF
2427 > EOF
2428 $ hg log -G -r 'file("a")' -m
2428 $ hg log -G -r 'file("a")' -m
2429 @ changeset: 36:08a19a744424
2429 @ changeset: 36:08a19a744424
@@ -2451,178 +2451,178 b' change graph edge styling'
2451 | :
2451 | :
2452 o : changeset: 30:6e11cd4b648f
2452 o : changeset: 30:6e11cd4b648f
2453 |\ \ parent: 28:44ecd0b9ae99
2453 |\ \ parent: 28:44ecd0b9ae99
2454 | . : parent: 29:cd9bb2be7593
2454 | ~ : parent: 29:cd9bb2be7593
2455 | . : user: test
2455 | : user: test
2456 | . : date: Thu Jan 01 00:00:30 1970 +0000
2456 | : date: Thu Jan 01 00:00:30 1970 +0000
2457 | . : summary: (30) expand
2457 | : summary: (30) expand
2458 | . :
2458 | /
2459 o . : changeset: 28:44ecd0b9ae99
2459 o : changeset: 28:44ecd0b9ae99
2460 |\ \ \ parent: 1:6db2ef61d156
2460 |\ \ parent: 1:6db2ef61d156
2461 | . . : parent: 26:7f25b6c2f0b9
2461 | ~ : parent: 26:7f25b6c2f0b9
2462 | . . : user: test
2462 | : user: test
2463 | . . : date: Thu Jan 01 00:00:28 1970 +0000
2463 | : date: Thu Jan 01 00:00:28 1970 +0000
2464 | . . : summary: (28) merge zero known
2464 | : summary: (28) merge zero known
2465 | . . :
2465 | /
2466 o . . : changeset: 26:7f25b6c2f0b9
2466 o : changeset: 26:7f25b6c2f0b9
2467 |\ \ \ \ parent: 18:1aa84d96232a
2467 |\ \ parent: 18:1aa84d96232a
2468 | | . . : parent: 25:91da8ed57247
2468 | | : parent: 25:91da8ed57247
2469 | | . . : user: test
2469 | | : user: test
2470 | | . . : date: Thu Jan 01 00:00:26 1970 +0000
2470 | | : date: Thu Jan 01 00:00:26 1970 +0000
2471 | | . . : summary: (26) merge one known; far right
2471 | | : summary: (26) merge one known; far right
2472 | | . . :
2472 | | :
2473 | o-----+ changeset: 25:91da8ed57247
2473 | o : changeset: 25:91da8ed57247
2474 | | . . : parent: 21:d42a756af44d
2474 | |\: parent: 21:d42a756af44d
2475 | | . . : parent: 24:a9c19a3d96b7
2475 | | : parent: 24:a9c19a3d96b7
2476 | | . . : user: test
2476 | | : user: test
2477 | | . . : date: Thu Jan 01 00:00:25 1970 +0000
2477 | | : date: Thu Jan 01 00:00:25 1970 +0000
2478 | | . . : summary: (25) merge one known; far left
2478 | | : summary: (25) merge one known; far left
2479 | | . . :
2479 | | :
2480 | o . . : changeset: 24:a9c19a3d96b7
2480 | o : changeset: 24:a9c19a3d96b7
2481 | |\ \ \ \ parent: 0:e6eb3150255d
2481 | |\ \ parent: 0:e6eb3150255d
2482 | | . . . : parent: 23:a01cddf0766d
2482 | | ~ : parent: 23:a01cddf0766d
2483 | | . . . : user: test
2483 | | : user: test
2484 | | . . . : date: Thu Jan 01 00:00:24 1970 +0000
2484 | | : date: Thu Jan 01 00:00:24 1970 +0000
2485 | | . . . : summary: (24) merge one known; immediate right
2485 | | : summary: (24) merge one known; immediate right
2486 | | . . . :
2486 | | /
2487 | o---+ . : changeset: 23:a01cddf0766d
2487 | o : changeset: 23:a01cddf0766d
2488 | | . . . : parent: 1:6db2ef61d156
2488 | |\ \ parent: 1:6db2ef61d156
2489 | | . . . : parent: 22:e0d9cccacb5d
2489 | | ~ : parent: 22:e0d9cccacb5d
2490 | | . . . : user: test
2490 | | : user: test
2491 | | . . . : date: Thu Jan 01 00:00:23 1970 +0000
2491 | | : date: Thu Jan 01 00:00:23 1970 +0000
2492 | | . . . : summary: (23) merge one known; immediate left
2492 | | : summary: (23) merge one known; immediate left
2493 | | . . . :
2493 | | /
2494 | o-------+ changeset: 22:e0d9cccacb5d
2494 | o : changeset: 22:e0d9cccacb5d
2495 | . . . . : parent: 18:1aa84d96232a
2495 |/:/ parent: 18:1aa84d96232a
2496 |/ / / / / parent: 21:d42a756af44d
2496 | : parent: 21:d42a756af44d
2497 | . . . : user: test
2497 | : user: test
2498 | . . . : date: Thu Jan 01 00:00:22 1970 +0000
2498 | : date: Thu Jan 01 00:00:22 1970 +0000
2499 | . . . : summary: (22) merge two known; one far left, one far right
2499 | : summary: (22) merge two known; one far left, one far right
2500 | . . . :
2500 | :
2501 | . . . o changeset: 21:d42a756af44d
2501 | o changeset: 21:d42a756af44d
2502 | . . . |\ parent: 19:31ddc2c1573b
2502 | |\ parent: 19:31ddc2c1573b
2503 | . . . | | parent: 20:d30ed6450e32
2503 | | | parent: 20:d30ed6450e32
2504 | . . . | | user: test
2504 | | | user: test
2505 | . . . | | date: Thu Jan 01 00:00:21 1970 +0000
2505 | | | date: Thu Jan 01 00:00:21 1970 +0000
2506 | . . . | | summary: (21) expand
2506 | | | summary: (21) expand
2507 | . . . | |
2507 | | |
2508 +-+-------o changeset: 20:d30ed6450e32
2508 +---o changeset: 20:d30ed6450e32
2509 | . . . | parent: 0:e6eb3150255d
2509 | | | parent: 0:e6eb3150255d
2510 | . . . | parent: 18:1aa84d96232a
2510 | | ~ parent: 18:1aa84d96232a
2511 | . . . | user: test
2511 | | user: test
2512 | . . . | date: Thu Jan 01 00:00:20 1970 +0000
2512 | | date: Thu Jan 01 00:00:20 1970 +0000
2513 | . . . | summary: (20) merge two known; two far right
2513 | | summary: (20) merge two known; two far right
2514 | . . . |
2514 | |
2515 | . . . o changeset: 19:31ddc2c1573b
2515 | o changeset: 19:31ddc2c1573b
2516 | . . . |\ parent: 15:1dda3f72782d
2516 | |\ parent: 15:1dda3f72782d
2517 | . . . | | parent: 17:44765d7c06e0
2517 | | | parent: 17:44765d7c06e0
2518 | . . . | | user: test
2518 | | | user: test
2519 | . . . | | date: Thu Jan 01 00:00:19 1970 +0000
2519 | | | date: Thu Jan 01 00:00:19 1970 +0000
2520 | . . . | | summary: (19) expand
2520 | | | summary: (19) expand
2521 | . . . | |
2521 | | |
2522 o---+---+ | changeset: 18:1aa84d96232a
2522 o | | changeset: 18:1aa84d96232a
2523 . . . | | parent: 1:6db2ef61d156
2523 |\| | parent: 1:6db2ef61d156
2524 / / / / / parent: 15:1dda3f72782d
2524 ~ | | parent: 15:1dda3f72782d
2525 . . . | | user: test
2525 | | user: test
2526 . . . | | date: Thu Jan 01 00:00:18 1970 +0000
2526 | | date: Thu Jan 01 00:00:18 1970 +0000
2527 . . . | | summary: (18) merge two known; two far left
2527 | | summary: (18) merge two known; two far left
2528 . . . | |
2528 / /
2529 . . . | o changeset: 17:44765d7c06e0
2529 | o changeset: 17:44765d7c06e0
2530 . . . | |\ parent: 12:86b91144a6e9
2530 | |\ parent: 12:86b91144a6e9
2531 . . . | | | parent: 16:3677d192927d
2531 | | | parent: 16:3677d192927d
2532 . . . | | | user: test
2532 | | | user: test
2533 . . . | | | date: Thu Jan 01 00:00:17 1970 +0000
2533 | | | date: Thu Jan 01 00:00:17 1970 +0000
2534 . . . | | | summary: (17) expand
2534 | | | summary: (17) expand
2535 . . . | | |
2535 | | |
2536 +-+-------o changeset: 16:3677d192927d
2536 | | o changeset: 16:3677d192927d
2537 . . . | | parent: 0:e6eb3150255d
2537 | | |\ parent: 0:e6eb3150255d
2538 . . . | | parent: 1:6db2ef61d156
2538 | | ~ ~ parent: 1:6db2ef61d156
2539 . . . | | user: test
2539 | | user: test
2540 . . . | | date: Thu Jan 01 00:00:16 1970 +0000
2540 | | date: Thu Jan 01 00:00:16 1970 +0000
2541 . . . | | summary: (16) merge two known; one immediate right, one near right
2541 | | summary: (16) merge two known; one immediate right, one near right
2542 . . . | |
2542 | |
2543 . . . o | changeset: 15:1dda3f72782d
2543 o | changeset: 15:1dda3f72782d
2544 . . . |\ \ parent: 13:22d8966a97e3
2544 |\ \ parent: 13:22d8966a97e3
2545 . . . | | | parent: 14:8eac370358ef
2545 | | | parent: 14:8eac370358ef
2546 . . . | | | user: test
2546 | | | user: test
2547 . . . | | | date: Thu Jan 01 00:00:15 1970 +0000
2547 | | | date: Thu Jan 01 00:00:15 1970 +0000
2548 . . . | | | summary: (15) expand
2548 | | | summary: (15) expand
2549 . . . | | |
2549 | | |
2550 +-------o | changeset: 14:8eac370358ef
2550 | o | changeset: 14:8eac370358ef
2551 . . . | |/ parent: 0:e6eb3150255d
2551 | |\| parent: 0:e6eb3150255d
2552 . . . | | parent: 12:86b91144a6e9
2552 | ~ | parent: 12:86b91144a6e9
2553 . . . | | user: test
2553 | | user: test
2554 . . . | | date: Thu Jan 01 00:00:14 1970 +0000
2554 | | date: Thu Jan 01 00:00:14 1970 +0000
2555 . . . | | summary: (14) merge two known; one immediate right, one far right
2555 | | summary: (14) merge two known; one immediate right, one far right
2556 . . . | |
2556 | /
2557 . . . o | changeset: 13:22d8966a97e3
2557 o | changeset: 13:22d8966a97e3
2558 . . . |\ \ parent: 9:7010c0af0a35
2558 |\ \ parent: 9:7010c0af0a35
2559 . . . | | | parent: 11:832d76e6bdf2
2559 | | | parent: 11:832d76e6bdf2
2560 . . . | | | user: test
2560 | | | user: test
2561 . . . | | | date: Thu Jan 01 00:00:13 1970 +0000
2561 | | | date: Thu Jan 01 00:00:13 1970 +0000
2562 . . . | | | summary: (13) expand
2562 | | | summary: (13) expand
2563 . . . | | |
2563 | | |
2564 . +---+---o changeset: 12:86b91144a6e9
2564 +---o changeset: 12:86b91144a6e9
2565 . . . | | parent: 1:6db2ef61d156
2565 | | | parent: 1:6db2ef61d156
2566 . . . | | parent: 9:7010c0af0a35
2566 | | ~ parent: 9:7010c0af0a35
2567 . . . | | user: test
2567 | | user: test
2568 . . . | | date: Thu Jan 01 00:00:12 1970 +0000
2568 | | date: Thu Jan 01 00:00:12 1970 +0000
2569 . . . | | summary: (12) merge two known; one immediate right, one far left
2569 | | summary: (12) merge two known; one immediate right, one far left
2570 . . . | |
2570 | |
2571 . . . | o changeset: 11:832d76e6bdf2
2571 | o changeset: 11:832d76e6bdf2
2572 . . . | |\ parent: 6:b105a072e251
2572 | |\ parent: 6:b105a072e251
2573 . . . | | | parent: 10:74c64d036d72
2573 | | | parent: 10:74c64d036d72
2574 . . . | | | user: test
2574 | | | user: test
2575 . . . | | | date: Thu Jan 01 00:00:11 1970 +0000
2575 | | | date: Thu Jan 01 00:00:11 1970 +0000
2576 . . . | | | summary: (11) expand
2576 | | | summary: (11) expand
2577 . . . | | |
2577 | | |
2578 +---------o changeset: 10:74c64d036d72
2578 | | o changeset: 10:74c64d036d72
2579 . . . | |/ parent: 0:e6eb3150255d
2579 | |/| parent: 0:e6eb3150255d
2580 . . . | | parent: 6:b105a072e251
2580 | | ~ parent: 6:b105a072e251
2581 . . . | | user: test
2581 | | user: test
2582 . . . | | date: Thu Jan 01 00:00:10 1970 +0000
2582 | | date: Thu Jan 01 00:00:10 1970 +0000
2583 . . . | | summary: (10) merge two known; one immediate left, one near right
2583 | | summary: (10) merge two known; one immediate left, one near right
2584 . . . | |
2584 | |
2585 . . . o | changeset: 9:7010c0af0a35
2585 o | changeset: 9:7010c0af0a35
2586 . . . |\ \ parent: 7:b632bb1b1224
2586 |\ \ parent: 7:b632bb1b1224
2587 . . . | | | parent: 8:7a0b11f71937
2587 | | | parent: 8:7a0b11f71937
2588 . . . | | | user: test
2588 | | | user: test
2589 . . . | | | date: Thu Jan 01 00:00:09 1970 +0000
2589 | | | date: Thu Jan 01 00:00:09 1970 +0000
2590 . . . | | | summary: (9) expand
2590 | | | summary: (9) expand
2591 . . . | | |
2591 | | |
2592 +-------o | changeset: 8:7a0b11f71937
2592 | o | changeset: 8:7a0b11f71937
2593 . . . |/ / parent: 0:e6eb3150255d
2593 |/| | parent: 0:e6eb3150255d
2594 . . . | | parent: 7:b632bb1b1224
2594 | ~ | parent: 7:b632bb1b1224
2595 . . . | | user: test
2595 | | user: test
2596 . . . | | date: Thu Jan 01 00:00:08 1970 +0000
2596 | | date: Thu Jan 01 00:00:08 1970 +0000
2597 . . . | | summary: (8) merge two known; one immediate left, one far right
2597 | | summary: (8) merge two known; one immediate left, one far right
2598 . . . | |
2598 | /
2599 . . . o | changeset: 7:b632bb1b1224
2599 o | changeset: 7:b632bb1b1224
2600 . . . |\ \ parent: 2:3d9a33b8d1e1
2600 |\ \ parent: 2:3d9a33b8d1e1
2601 . . . | . | parent: 5:4409d547b708
2601 | ~ | parent: 5:4409d547b708
2602 . . . | . | user: test
2602 | | user: test
2603 . . . | . | date: Thu Jan 01 00:00:07 1970 +0000
2603 | | date: Thu Jan 01 00:00:07 1970 +0000
2604 . . . | . | summary: (7) expand
2604 | | summary: (7) expand
2605 . . . | . |
2605 | /
2606 . . . +---o changeset: 6:b105a072e251
2606 | o changeset: 6:b105a072e251
2607 . . . | ./ parent: 2:3d9a33b8d1e1
2607 |/| parent: 2:3d9a33b8d1e1
2608 . . . | . parent: 5:4409d547b708
2608 | ~ parent: 5:4409d547b708
2609 . . . | . user: test
2609 | user: test
2610 . . . | . date: Thu Jan 01 00:00:06 1970 +0000
2610 | date: Thu Jan 01 00:00:06 1970 +0000
2611 . . . | . summary: (6) merge two known; one immediate left, one far left
2611 | summary: (6) merge two known; one immediate left, one far left
2612 . . . | .
2612 |
2613 . . . o . changeset: 5:4409d547b708
2613 o changeset: 5:4409d547b708
2614 . . . |\ \ parent: 3:27eef8ed80b4
2614 |\ parent: 3:27eef8ed80b4
2615 . . . | . . parent: 4:26a8bac39d9f
2615 | ~ parent: 4:26a8bac39d9f
2616 . . . | . . user: test
2616 | user: test
2617 . . . | . . date: Thu Jan 01 00:00:05 1970 +0000
2617 | date: Thu Jan 01 00:00:05 1970 +0000
2618 . . . | . . summary: (5) expand
2618 | summary: (5) expand
2619 . . . | . .
2619 |
2620 . +---o . . changeset: 4:26a8bac39d9f
2620 o changeset: 4:26a8bac39d9f
2621 . . . ./ / parent: 1:6db2ef61d156
2621 |\ parent: 1:6db2ef61d156
2622 . . . . . parent: 3:27eef8ed80b4
2622 ~ ~ parent: 3:27eef8ed80b4
2623 . . . . . user: test
2623 user: test
2624 . . . . . date: Thu Jan 01 00:00:04 1970 +0000
2624 date: Thu Jan 01 00:00:04 1970 +0000
2625 . . . . . summary: (4) merge two known; one immediate left, one immediate right
2625 summary: (4) merge two known; one immediate left, one immediate right
2626 . . . . .
2626
2627
2627
2628 $ cd ..
2628 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now