Fossil SCM
Add the info-changes-menu to the "Uncommitted Changes" section of the /ckout page.
Commit
7cf712af979d10a70a8cf444a32e1d6e63b7cbf1eded16545be2ef5d6f4b8765
Parent
4af5cde63d01fda…
1 file changed
+28
-14
+28
-14
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -622,10 +622,11 @@ | ||
| 622 | 622 | char *zHostname; |
| 623 | 623 | char *zCwd; |
| 624 | 624 | int diffType; /* 0: no diff, 1: unified, 2: side-by-side */ |
| 625 | 625 | DiffConfig DCfg,*pCfg; /* Diff details */ |
| 626 | 626 | const char *zHome; /* Home directory */ |
| 627 | + const char *zW; /* The "w" query parameter */ | |
| 627 | 628 | Stmt q; |
| 628 | 629 | |
| 629 | 630 | if( !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){ |
| 630 | 631 | cgi_redirect("%R/home"); |
| 631 | 632 | return; |
| @@ -655,32 +656,45 @@ | ||
| 655 | 656 | builtin_request_js("accordion.js"); |
| 656 | 657 | @ <div class="section accordion">Context</div> |
| 657 | 658 | @ <div class="accordion_panel"> <!-- ap-001 --> |
| 658 | 659 | render_checkin_context(vid, 0, 0, 0); |
| 659 | 660 | @ </div> <!-- ap-001 --> |
| 660 | - if( pCfg==0 ){ | |
| 661 | - style_finish_page(); | |
| 662 | - return; | |
| 663 | - } | |
| 664 | 661 | db_prepare(&q, |
| 665 | 662 | /* 0 1 2 3 4 5 6 */ |
| 666 | 663 | "SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid" |
| 667 | 664 | " FROM vfile LEFT JOIN blob USING(rid)" |
| 668 | 665 | " WHERE vid=%d" |
| 669 | 666 | " AND (deleted OR chnged OR rid==0)" |
| 670 | 667 | " ORDER BY pathname /*scan*/", |
| 671 | 668 | vid |
| 672 | 669 | ); |
| 673 | - if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){ | |
| 674 | - pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; | |
| 670 | + if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){ | |
| 671 | + DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; | |
| 675 | 672 | }else{ |
| 676 | - pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; | |
| 673 | + DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; | |
| 677 | 674 | } |
| 678 | 675 | @ <div class="section accordion">Uncommitted Changes</div> |
| 679 | 676 | @ <div class="accordion_panel"> <!-- ap-002 --> |
| 680 | 677 | @ <div class="sectionmenu info-changes-menu"> |
| 681 | - /* Filled out by JS */ | |
| 678 | + zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 679 | + if( diffType!=0 ){ | |
| 680 | + @ %z(chref("button","%R?diff=0"))Hide Diffs</a> | |
| 681 | + } | |
| 682 | + if( diffType!=1 ){ | |
| 683 | + @ %z(chref("button","%R?diff=1%s",zW))Unified Diffs</a> | |
| 684 | + } | |
| 685 | + if( diffType!=2 ){ | |
| 686 | + @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side Diffs</a> | |
| 687 | + } | |
| 688 | + if( diffType!=0 ){ | |
| 689 | + if( *zW ){ | |
| 690 | + @ %z(chref("button","%R?diff=%d",diffType))\ | |
| 691 | + @ Show Whitespace Changes</a> | |
| 692 | + }else{ | |
| 693 | + @ %z(chref("button","%R?diff=%d&w",diffType))Ignore Whitespace</a> | |
| 694 | + } | |
| 695 | + } | |
| 682 | 696 | @ </div> |
| 683 | 697 | while( db_step(&q)==SQLITE_ROW ){ |
| 684 | 698 | const char *zTreename = db_column_text(&q,0); |
| 685 | 699 | int isDeleted = db_column_int(&q, 1); |
| 686 | 700 | int isChnged = db_column_int(&q,2); |
| @@ -688,39 +702,39 @@ | ||
| 688 | 702 | int srcid = db_column_int(&q, 4); |
| 689 | 703 | int isLink = db_column_int(&q, 5); |
| 690 | 704 | const char *zUuid = db_column_text(&q, 6); |
| 691 | 705 | int showDiff = 1; |
| 692 | 706 | |
| 693 | - pCfg->diffFlags &= (~DIFF_FILE_MASK); | |
| 707 | + DCfg.diffFlags &= (~DIFF_FILE_MASK); | |
| 694 | 708 | @ <div class='file-change-line'><span> |
| 695 | 709 | if( isDeleted ){ |
| 696 | 710 | @ DELETED %h(zTreename) |
| 697 | - pCfg->diffFlags |= DIFF_FILE_DELETED; | |
| 711 | + DCfg.diffFlags |= DIFF_FILE_DELETED; | |
| 698 | 712 | showDiff = 0; |
| 699 | 713 | }else if( file_access(zTreename, F_OK) ){ |
| 700 | 714 | @ MISSING %h(zTreename) |
| 701 | 715 | showDiff = 0; |
| 702 | 716 | }else if( isNew ){ |
| 703 | 717 | @ ADDED %h(zTreename) |
| 704 | - pCfg->diffFlags |= DIFF_FILE_ADDED; | |
| 718 | + DCfg.diffFlags |= DIFF_FILE_ADDED; | |
| 705 | 719 | srcid = 0; |
| 706 | 720 | showDiff = 0; |
| 707 | 721 | }else if( isChnged==3 ){ |
| 708 | 722 | @ ADDED_BY_MERGE %h(zTreename) |
| 709 | - pCfg->diffFlags |= DIFF_FILE_ADDED; | |
| 723 | + DCfg.diffFlags |= DIFF_FILE_ADDED; | |
| 710 | 724 | srcid = 0; |
| 711 | 725 | showDiff = 0; |
| 712 | 726 | }else if( isChnged==5 ){ |
| 713 | 727 | @ ADDED_BY_INTEGRATE %h(zTreename) |
| 714 | - pCfg->diffFlags |= DIFF_FILE_ADDED; | |
| 728 | + DCfg.diffFlags |= DIFF_FILE_ADDED; | |
| 715 | 729 | srcid = 0; |
| 716 | 730 | showDiff = 0; |
| 717 | 731 | }else{ |
| 718 | 732 | @ CHANGED %h(zTreename) |
| 719 | 733 | } |
| 720 | 734 | @ </span></div> |
| 721 | - if( showDiff ){ | |
| 735 | + if( showDiff && pCfg ){ | |
| 722 | 736 | Blob old, new; |
| 723 | 737 | if( !isLink != !file_islink(zTreename) ){ |
| 724 | 738 | @ %s(DIFF_CANNOT_COMPUTE_SYMLINK) |
| 725 | 739 | continue; |
| 726 | 740 | } |
| 727 | 741 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -622,10 +622,11 @@ | |
| 622 | char *zHostname; |
| 623 | char *zCwd; |
| 624 | int diffType; /* 0: no diff, 1: unified, 2: side-by-side */ |
| 625 | DiffConfig DCfg,*pCfg; /* Diff details */ |
| 626 | const char *zHome; /* Home directory */ |
| 627 | Stmt q; |
| 628 | |
| 629 | if( !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){ |
| 630 | cgi_redirect("%R/home"); |
| 631 | return; |
| @@ -655,32 +656,45 @@ | |
| 655 | builtin_request_js("accordion.js"); |
| 656 | @ <div class="section accordion">Context</div> |
| 657 | @ <div class="accordion_panel"> <!-- ap-001 --> |
| 658 | render_checkin_context(vid, 0, 0, 0); |
| 659 | @ </div> <!-- ap-001 --> |
| 660 | if( pCfg==0 ){ |
| 661 | style_finish_page(); |
| 662 | return; |
| 663 | } |
| 664 | db_prepare(&q, |
| 665 | /* 0 1 2 3 4 5 6 */ |
| 666 | "SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid" |
| 667 | " FROM vfile LEFT JOIN blob USING(rid)" |
| 668 | " WHERE vid=%d" |
| 669 | " AND (deleted OR chnged OR rid==0)" |
| 670 | " ORDER BY pathname /*scan*/", |
| 671 | vid |
| 672 | ); |
| 673 | if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){ |
| 674 | pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; |
| 675 | }else{ |
| 676 | pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 677 | } |
| 678 | @ <div class="section accordion">Uncommitted Changes</div> |
| 679 | @ <div class="accordion_panel"> <!-- ap-002 --> |
| 680 | @ <div class="sectionmenu info-changes-menu"> |
| 681 | /* Filled out by JS */ |
| 682 | @ </div> |
| 683 | while( db_step(&q)==SQLITE_ROW ){ |
| 684 | const char *zTreename = db_column_text(&q,0); |
| 685 | int isDeleted = db_column_int(&q, 1); |
| 686 | int isChnged = db_column_int(&q,2); |
| @@ -688,39 +702,39 @@ | |
| 688 | int srcid = db_column_int(&q, 4); |
| 689 | int isLink = db_column_int(&q, 5); |
| 690 | const char *zUuid = db_column_text(&q, 6); |
| 691 | int showDiff = 1; |
| 692 | |
| 693 | pCfg->diffFlags &= (~DIFF_FILE_MASK); |
| 694 | @ <div class='file-change-line'><span> |
| 695 | if( isDeleted ){ |
| 696 | @ DELETED %h(zTreename) |
| 697 | pCfg->diffFlags |= DIFF_FILE_DELETED; |
| 698 | showDiff = 0; |
| 699 | }else if( file_access(zTreename, F_OK) ){ |
| 700 | @ MISSING %h(zTreename) |
| 701 | showDiff = 0; |
| 702 | }else if( isNew ){ |
| 703 | @ ADDED %h(zTreename) |
| 704 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 705 | srcid = 0; |
| 706 | showDiff = 0; |
| 707 | }else if( isChnged==3 ){ |
| 708 | @ ADDED_BY_MERGE %h(zTreename) |
| 709 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 710 | srcid = 0; |
| 711 | showDiff = 0; |
| 712 | }else if( isChnged==5 ){ |
| 713 | @ ADDED_BY_INTEGRATE %h(zTreename) |
| 714 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 715 | srcid = 0; |
| 716 | showDiff = 0; |
| 717 | }else{ |
| 718 | @ CHANGED %h(zTreename) |
| 719 | } |
| 720 | @ </span></div> |
| 721 | if( showDiff ){ |
| 722 | Blob old, new; |
| 723 | if( !isLink != !file_islink(zTreename) ){ |
| 724 | @ %s(DIFF_CANNOT_COMPUTE_SYMLINK) |
| 725 | continue; |
| 726 | } |
| 727 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -622,10 +622,11 @@ | |
| 622 | char *zHostname; |
| 623 | char *zCwd; |
| 624 | int diffType; /* 0: no diff, 1: unified, 2: side-by-side */ |
| 625 | DiffConfig DCfg,*pCfg; /* Diff details */ |
| 626 | const char *zHome; /* Home directory */ |
| 627 | const char *zW; /* The "w" query parameter */ |
| 628 | Stmt q; |
| 629 | |
| 630 | if( !db_open_local(0) || !cgi_is_loopback(g.zIpAddr) ){ |
| 631 | cgi_redirect("%R/home"); |
| 632 | return; |
| @@ -655,32 +656,45 @@ | |
| 656 | builtin_request_js("accordion.js"); |
| 657 | @ <div class="section accordion">Context</div> |
| 658 | @ <div class="accordion_panel"> <!-- ap-001 --> |
| 659 | render_checkin_context(vid, 0, 0, 0); |
| 660 | @ </div> <!-- ap-001 --> |
| 661 | db_prepare(&q, |
| 662 | /* 0 1 2 3 4 5 6 */ |
| 663 | "SELECT pathname, deleted, chnged , rid==0, rid, islink, uuid" |
| 664 | " FROM vfile LEFT JOIN blob USING(rid)" |
| 665 | " WHERE vid=%d" |
| 666 | " AND (deleted OR chnged OR rid==0)" |
| 667 | " ORDER BY pathname /*scan*/", |
| 668 | vid |
| 669 | ); |
| 670 | if( DCfg.diffFlags & DIFF_SIDEBYSIDE ){ |
| 671 | DCfg.diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; |
| 672 | }else{ |
| 673 | DCfg.diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 674 | } |
| 675 | @ <div class="section accordion">Uncommitted Changes</div> |
| 676 | @ <div class="accordion_panel"> <!-- ap-002 --> |
| 677 | @ <div class="sectionmenu info-changes-menu"> |
| 678 | zW = (DCfg.diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 679 | if( diffType!=0 ){ |
| 680 | @ %z(chref("button","%R?diff=0"))Hide Diffs</a> |
| 681 | } |
| 682 | if( diffType!=1 ){ |
| 683 | @ %z(chref("button","%R?diff=1%s",zW))Unified Diffs</a> |
| 684 | } |
| 685 | if( diffType!=2 ){ |
| 686 | @ %z(chref("button","%R?diff=2%s",zW))Side-by-Side Diffs</a> |
| 687 | } |
| 688 | if( diffType!=0 ){ |
| 689 | if( *zW ){ |
| 690 | @ %z(chref("button","%R?diff=%d",diffType))\ |
| 691 | @ Show Whitespace Changes</a> |
| 692 | }else{ |
| 693 | @ %z(chref("button","%R?diff=%d&w",diffType))Ignore Whitespace</a> |
| 694 | } |
| 695 | } |
| 696 | @ </div> |
| 697 | while( db_step(&q)==SQLITE_ROW ){ |
| 698 | const char *zTreename = db_column_text(&q,0); |
| 699 | int isDeleted = db_column_int(&q, 1); |
| 700 | int isChnged = db_column_int(&q,2); |
| @@ -688,39 +702,39 @@ | |
| 702 | int srcid = db_column_int(&q, 4); |
| 703 | int isLink = db_column_int(&q, 5); |
| 704 | const char *zUuid = db_column_text(&q, 6); |
| 705 | int showDiff = 1; |
| 706 | |
| 707 | DCfg.diffFlags &= (~DIFF_FILE_MASK); |
| 708 | @ <div class='file-change-line'><span> |
| 709 | if( isDeleted ){ |
| 710 | @ DELETED %h(zTreename) |
| 711 | DCfg.diffFlags |= DIFF_FILE_DELETED; |
| 712 | showDiff = 0; |
| 713 | }else if( file_access(zTreename, F_OK) ){ |
| 714 | @ MISSING %h(zTreename) |
| 715 | showDiff = 0; |
| 716 | }else if( isNew ){ |
| 717 | @ ADDED %h(zTreename) |
| 718 | DCfg.diffFlags |= DIFF_FILE_ADDED; |
| 719 | srcid = 0; |
| 720 | showDiff = 0; |
| 721 | }else if( isChnged==3 ){ |
| 722 | @ ADDED_BY_MERGE %h(zTreename) |
| 723 | DCfg.diffFlags |= DIFF_FILE_ADDED; |
| 724 | srcid = 0; |
| 725 | showDiff = 0; |
| 726 | }else if( isChnged==5 ){ |
| 727 | @ ADDED_BY_INTEGRATE %h(zTreename) |
| 728 | DCfg.diffFlags |= DIFF_FILE_ADDED; |
| 729 | srcid = 0; |
| 730 | showDiff = 0; |
| 731 | }else{ |
| 732 | @ CHANGED %h(zTreename) |
| 733 | } |
| 734 | @ </span></div> |
| 735 | if( showDiff && pCfg ){ |
| 736 | Blob old, new; |
| 737 | if( !isLink != !file_islink(zTreename) ){ |
| 738 | @ %s(DIFF_CANNOT_COMPUTE_SYMLINK) |
| 739 | continue; |
| 740 | } |
| 741 |