Show More
@@ -2240,6 +2240,10 b' def displaygraph(ui, repo, dag, displaye' | |||||
2240 | styles[key]) |
|
2240 | styles[key]) | |
2241 | if not styles[key]: |
|
2241 | if not styles[key]: | |
2242 | styles[key] = None |
|
2242 | styles[key] = None | |
|
2243 | ||||
|
2244 | # experimental config: experimental.graphshorten | |||
|
2245 | state['graphshorten'] = ui.configbool('experimental', 'graphshorten') | |||
|
2246 | ||||
2243 | for rev, type, ctx, parents in dag: |
|
2247 | for rev, type, ctx, parents in dag: | |
2244 | char = formatnode(repo, ctx) |
|
2248 | char = formatnode(repo, ctx) | |
2245 | copies = None |
|
2249 | copies = None |
@@ -543,6 +543,7 b' def asciistate():' | |||||
543 | 'lastcoldiff': 0, |
|
543 | 'lastcoldiff': 0, | |
544 | 'lastindex': 0, |
|
544 | 'lastindex': 0, | |
545 | 'styles': EDGES.copy(), |
|
545 | 'styles': EDGES.copy(), | |
|
546 | 'graphshorten': False, | |||
546 | } |
|
547 | } | |
547 |
|
548 | |||
548 | def ascii(ui, state, type, char, text, coldata): |
|
549 | def ascii(ui, state, type, char, text, coldata): | |
@@ -630,7 +631,15 b' def ascii(ui, state, type, char, text, c' | |||||
630 | lines = [nodeline] |
|
631 | lines = [nodeline] | |
631 | if add_padding_line: |
|
632 | if add_padding_line: | |
632 | lines.append(_getpaddingline(echars, idx, ncols, edges)) |
|
633 | lines.append(_getpaddingline(echars, idx, ncols, edges)) | |
633 | lines.append(shift_interline) |
|
634 | ||
|
635 | # If 'graphshorten' config, only draw shift_interline | |||
|
636 | # when there is any non vertical flow in graph. | |||
|
637 | if state['graphshorten']: | |||
|
638 | if any(c in '\/' for c in shift_interline if c): | |||
|
639 | lines.append(shift_interline) | |||
|
640 | # Else, no 'graphshorten' config so draw shift_interline. | |||
|
641 | else: | |||
|
642 | lines.append(shift_interline) | |||
634 |
|
643 | |||
635 | # make sure that there are as many graph lines as there are |
|
644 | # make sure that there are as many graph lines as there are | |
636 | # log strings |
|
645 | # log strings |
@@ -2634,3 +2634,105 b' change graph edge styling' | |||||
2634 |
|
2634 | |||
2635 |
|
2635 | |||
2636 | $ cd .. |
|
2636 | $ cd .. | |
|
2637 | ||||
|
2638 | Change graph shorten, test better with graphstyle.missing not none | |||
|
2639 | ||||
|
2640 | $ cd repo | |||
|
2641 | $ cat << EOF >> $HGRCPATH | |||
|
2642 | > [experimental] | |||
|
2643 | > graphstyle.parent = | | |||
|
2644 | > graphstyle.grandparent = : | |||
|
2645 | > graphstyle.missing = ' | |||
|
2646 | > graphshorten = true | |||
|
2647 | > EOF | |||
|
2648 | $ hg log -G -r 'file("a")' -m -T '{rev} {desc}' | |||
|
2649 | @ 36 (36) buggy merge: identical parents | |||
|
2650 | o 32 (32) expand | |||
|
2651 | |\ | |||
|
2652 | o : 31 (31) expand | |||
|
2653 | |\: | |||
|
2654 | o : 30 (30) expand | |||
|
2655 | |\ \ | |||
|
2656 | o \ \ 28 (28) merge zero known | |||
|
2657 | |\ \ \ | |||
|
2658 | o \ \ \ 26 (26) merge one known; far right | |||
|
2659 | |\ \ \ \ | |||
|
2660 | | o-----+ 25 (25) merge one known; far left | |||
|
2661 | | o ' ' : 24 (24) merge one known; immediate right | |||
|
2662 | | |\ \ \ \ | |||
|
2663 | | o---+ ' : 23 (23) merge one known; immediate left | |||
|
2664 | | o-------+ 22 (22) merge two known; one far left, one far right | |||
|
2665 | |/ / / / / | |||
|
2666 | | ' ' ' o 21 (21) expand | |||
|
2667 | | ' ' ' |\ | |||
|
2668 | +-+-------o 20 (20) merge two known; two far right | |||
|
2669 | | ' ' ' o 19 (19) expand | |||
|
2670 | | ' ' ' |\ | |||
|
2671 | o---+---+ | 18 (18) merge two known; two far left | |||
|
2672 | / / / / / | |||
|
2673 | ' ' ' | o 17 (17) expand | |||
|
2674 | ' ' ' | |\ | |||
|
2675 | +-+-------o 16 (16) merge two known; one immediate right, one near right | |||
|
2676 | ' ' ' o | 15 (15) expand | |||
|
2677 | ' ' ' |\ \ | |||
|
2678 | +-------o | 14 (14) merge two known; one immediate right, one far right | |||
|
2679 | ' ' ' | |/ | |||
|
2680 | ' ' ' o | 13 (13) expand | |||
|
2681 | ' ' ' |\ \ | |||
|
2682 | ' +---+---o 12 (12) merge two known; one immediate right, one far left | |||
|
2683 | ' ' ' | o 11 (11) expand | |||
|
2684 | ' ' ' | |\ | |||
|
2685 | +---------o 10 (10) merge two known; one immediate left, one near right | |||
|
2686 | ' ' ' | |/ | |||
|
2687 | ' ' ' o | 9 (9) expand | |||
|
2688 | ' ' ' |\ \ | |||
|
2689 | +-------o | 8 (8) merge two known; one immediate left, one far right | |||
|
2690 | ' ' ' |/ / | |||
|
2691 | ' ' ' o | 7 (7) expand | |||
|
2692 | ' ' ' |\ \ | |||
|
2693 | ' ' ' +---o 6 (6) merge two known; one immediate left, one far left | |||
|
2694 | ' ' ' | '/ | |||
|
2695 | ' ' ' o ' 5 (5) expand | |||
|
2696 | ' ' ' |\ \ | |||
|
2697 | ' +---o ' ' 4 (4) merge two known; one immediate left, one immediate right | |||
|
2698 | ' ' ' '/ / | |||
|
2699 | ||||
|
2700 | behavior with newlines | |||
|
2701 | ||||
|
2702 | $ hg log -G -r ::2 -T '{rev} {desc}' | |||
|
2703 | o 2 (2) collapse | |||
|
2704 | o 1 (1) collapse | |||
|
2705 | o 0 (0) root | |||
|
2706 | ||||
|
2707 | $ hg log -G -r ::2 -T '{rev} {desc}\n' | |||
|
2708 | o 2 (2) collapse | |||
|
2709 | o 1 (1) collapse | |||
|
2710 | o 0 (0) root | |||
|
2711 | ||||
|
2712 | $ hg log -G -r ::2 -T '{rev} {desc}\n\n' | |||
|
2713 | o 2 (2) collapse | |||
|
2714 | | | |||
|
2715 | o 1 (1) collapse | |||
|
2716 | | | |||
|
2717 | o 0 (0) root | |||
|
2718 | ||||
|
2719 | ||||
|
2720 | $ hg log -G -r ::2 -T '\n{rev} {desc}' | |||
|
2721 | o | |||
|
2722 | | 2 (2) collapse | |||
|
2723 | o | |||
|
2724 | | 1 (1) collapse | |||
|
2725 | o | |||
|
2726 | 0 (0) root | |||
|
2727 | ||||
|
2728 | $ hg log -G -r ::2 -T '{rev} {desc}\n\n\n' | |||
|
2729 | o 2 (2) collapse | |||
|
2730 | | | |||
|
2731 | | | |||
|
2732 | o 1 (1) collapse | |||
|
2733 | | | |||
|
2734 | | | |||
|
2735 | o 0 (0) root | |||
|
2736 | ||||
|
2737 | ||||
|
2738 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now