Fossil SCM
Convert /fdiff and (partially) /vdiff to use checkboxes
Commit
19e896543a1346e7c248925a49ed9bfa3a0a9677596d1dba84e3741305131343
Parent
c203ba902c74721…
1 file changed
+17
-45
+17
-45
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1071,20 +1071,20 @@ | ||
| 1071 | 1071 | ** branch=TAG Show all changes on a particular branch |
| 1072 | 1072 | ** v=BOOLEAN Default true. If false, only list files that have changed |
| 1073 | 1073 | ** sbs=BOOLEAN Side-by-side diff if true. Unified diff if false |
| 1074 | 1074 | ** glob=STRING only diff files matching this glob |
| 1075 | 1075 | ** dc=N show N lines of context around each diff |
| 1076 | -** w ignore whitespace when computing diffs | |
| 1076 | +** w=BOOLEAN ignore whitespace when computing diffs | |
| 1077 | 1077 | ** nohdr omit the description at the top of the page |
| 1078 | 1078 | ** |
| 1079 | 1079 | ** |
| 1080 | 1080 | ** Show all differences between two check-ins. |
| 1081 | 1081 | */ |
| 1082 | 1082 | void vdiff_page(void){ |
| 1083 | 1083 | int ridFrom, ridTo; |
| 1084 | - int verboseFlag = 0; | |
| 1085 | - int sideBySide = 0; | |
| 1084 | + int verboseFlag; | |
| 1085 | + int sideBySide; | |
| 1086 | 1086 | u64 diffFlags = 0; |
| 1087 | 1087 | Manifest *pFrom, *pTo; |
| 1088 | 1088 | ManifestFile *pFileFrom, *pFileTo; |
| 1089 | 1089 | const char *zBranch; |
| 1090 | 1090 | const char *zFrom; |
| @@ -1154,21 +1154,11 @@ | ||
| 1154 | 1154 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); |
| 1155 | 1155 | }else{ |
| 1156 | 1156 | style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); |
| 1157 | 1157 | } |
| 1158 | 1158 | if( sideBySide || verboseFlag ){ |
| 1159 | - if( *zW ){ | |
| 1160 | - style_submenu_element("Show Whitespace Differences", | |
| 1161 | - "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo, | |
| 1162 | - sideBySide, (verboseFlag && !sideBySide)?"&v":"", | |
| 1163 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1164 | - }else{ | |
| 1165 | - style_submenu_element("Ignore Whitespace", | |
| 1166 | - "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo, | |
| 1167 | - sideBySide, (verboseFlag && !sideBySide)?"&v":"", | |
| 1168 | - zGlob ? "&glob=" : "", zGlob ? zGlob : ""); | |
| 1169 | - } | |
| 1159 | + style_submenu_checkbox("w", "Ignore Whitespace", 0); | |
| 1170 | 1160 | } |
| 1171 | 1161 | style_header("Check-in Differences"); |
| 1172 | 1162 | if( P("nohdr")==0 ){ |
| 1173 | 1163 | @ <h2>Difference From:</h2><blockquote> |
| 1174 | 1164 | checkin_description(ridFrom); |
| @@ -1546,25 +1536,25 @@ | ||
| 1546 | 1536 | ** "ci" parameter is omitted, then the most recent check-in ("tip") is |
| 1547 | 1537 | ** used. |
| 1548 | 1538 | ** |
| 1549 | 1539 | ** Additional parameters: |
| 1550 | 1540 | ** |
| 1551 | -** dc=N Show N lines of context around each diff | |
| 1552 | -** patch Use the patch diff format | |
| 1553 | -** regex=REGEX Only show differences that match REGEX | |
| 1554 | -** sbs=BOOLEAN Turn side-by-side diffs on and off (default: on) | |
| 1555 | -** verbose Show more detail when describing artifacts | |
| 1556 | -** w Ignore whitespace | |
| 1541 | +** dc=N Show N lines of context around each diff | |
| 1542 | +** patch Use the patch diff format | |
| 1543 | +** regex=REGEX Only show differences that match REGEX | |
| 1544 | +** sbs=BOOLEAN Turn side-by-side diffs on and off (default: on) | |
| 1545 | +** verbose=BOOLEAN Show more detail when describing artifacts | |
| 1546 | +** w=BOOLEAN Ignore whitespace | |
| 1557 | 1547 | */ |
| 1558 | 1548 | void diff_page(void){ |
| 1559 | 1549 | int v1, v2; |
| 1560 | - int isPatch; | |
| 1561 | - int sideBySide; | |
| 1550 | + int isPatch = P("patch")!=0; | |
| 1551 | + int sideBySide = PB("sbs"); | |
| 1552 | + int verbose = PB("verbose"); | |
| 1562 | 1553 | char *zV1; |
| 1563 | 1554 | char *zV2; |
| 1564 | 1555 | const char *zRe; |
| 1565 | - const char *zW; /* URL param for ignoring whitespace */ | |
| 1566 | 1556 | ReCompiled *pRe = 0; |
| 1567 | 1557 | u64 diffFlags; |
| 1568 | 1558 | u32 objdescFlags = 0; |
| 1569 | 1559 | |
| 1570 | 1560 | login_check_credentials(); |
| @@ -1577,12 +1567,11 @@ | ||
| 1577 | 1567 | v2 = name_to_rid_www("v2"); |
| 1578 | 1568 | } |
| 1579 | 1569 | if( v1==0 || v2==0 ) fossil_redirect_home(); |
| 1580 | 1570 | zRe = P("regex"); |
| 1581 | 1571 | if( zRe ) re_compile(&pRe, zRe, 0); |
| 1582 | - if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL; | |
| 1583 | - isPatch = P("patch")!=0; | |
| 1572 | + if( verbose ) objdescFlags |= OBJDESC_DETAIL; | |
| 1584 | 1573 | if( isPatch ){ |
| 1585 | 1574 | Blob c1, c2, *pOut; |
| 1586 | 1575 | pOut = cgi_output_blob(); |
| 1587 | 1576 | cgi_set_content_type("text/plain"); |
| 1588 | 1577 | diffFlags = 4; |
| @@ -1592,37 +1581,20 @@ | ||
| 1592 | 1581 | blob_reset(&c1); |
| 1593 | 1582 | blob_reset(&c2); |
| 1594 | 1583 | return; |
| 1595 | 1584 | } |
| 1596 | 1585 | |
| 1597 | - sideBySide = !is_false(PD("sbs","1")); | |
| 1598 | 1586 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1599 | 1587 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1600 | 1588 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1601 | 1589 | |
| 1602 | 1590 | style_header("Diff"); |
| 1603 | - zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; | |
| 1604 | - if( *zW ){ | |
| 1605 | - style_submenu_element("Show Whitespace Changes", | |
| 1606 | - "%s/fdiff?v1=%T&v2=%T&sbs=%d", | |
| 1607 | - g.zTop, P("v1"), P("v2"), sideBySide); | |
| 1608 | - }else{ | |
| 1609 | - style_submenu_element("Ignore Whitespace", | |
| 1610 | - "%s/fdiff?v1=%T&v2=%T&sbs=%d&w", | |
| 1611 | - g.zTop, P("v1"), P("v2"), sideBySide); | |
| 1612 | - } | |
| 1591 | + style_submenu_checkbox("w", "Ignore Whitespace", 0); | |
| 1592 | + style_submenu_checkbox("sbs", "Side-by-Side Diff", 0); | |
| 1593 | + style_submenu_checkbox("verbose", "Verbose", 0); | |
| 1613 | 1594 | style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1614 | 1595 | g.zTop, P("v1"), P("v2")); |
| 1615 | - if( !sideBySide ){ | |
| 1616 | - style_submenu_element("Side-by-Side Diff", | |
| 1617 | - "%s/fdiff?v1=%T&v2=%T&sbs=1%s", | |
| 1618 | - g.zTop, P("v1"), P("v2"), zW); | |
| 1619 | - }else{ | |
| 1620 | - style_submenu_element("Unified Diff", | |
| 1621 | - "%s/fdiff?v1=%T&v2=%T&sbs=0%s", | |
| 1622 | - g.zTop, P("v1"), P("v2"), zW); | |
| 1623 | - } | |
| 1624 | 1596 | |
| 1625 | 1597 | if( P("smhdr")!=0 ){ |
| 1626 | 1598 | @ <h2>Differences From Artifact |
| 1627 | 1599 | @ %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a> To |
| 1628 | 1600 | @ %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>.</h2> |
| 1629 | 1601 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1071,20 +1071,20 @@ | |
| 1071 | ** branch=TAG Show all changes on a particular branch |
| 1072 | ** v=BOOLEAN Default true. If false, only list files that have changed |
| 1073 | ** sbs=BOOLEAN Side-by-side diff if true. Unified diff if false |
| 1074 | ** glob=STRING only diff files matching this glob |
| 1075 | ** dc=N show N lines of context around each diff |
| 1076 | ** w ignore whitespace when computing diffs |
| 1077 | ** nohdr omit the description at the top of the page |
| 1078 | ** |
| 1079 | ** |
| 1080 | ** Show all differences between two check-ins. |
| 1081 | */ |
| 1082 | void vdiff_page(void){ |
| 1083 | int ridFrom, ridTo; |
| 1084 | int verboseFlag = 0; |
| 1085 | int sideBySide = 0; |
| 1086 | u64 diffFlags = 0; |
| 1087 | Manifest *pFrom, *pTo; |
| 1088 | ManifestFile *pFileFrom, *pFileTo; |
| 1089 | const char *zBranch; |
| 1090 | const char *zFrom; |
| @@ -1154,21 +1154,11 @@ | |
| 1154 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); |
| 1155 | }else{ |
| 1156 | style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); |
| 1157 | } |
| 1158 | if( sideBySide || verboseFlag ){ |
| 1159 | if( *zW ){ |
| 1160 | style_submenu_element("Show Whitespace Differences", |
| 1161 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T", zFrom, zTo, |
| 1162 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1163 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1164 | }else{ |
| 1165 | style_submenu_element("Ignore Whitespace", |
| 1166 | "%R/vdiff?from=%T&to=%T&sbs=%d%s%s%T&w", zFrom, zTo, |
| 1167 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", |
| 1168 | zGlob ? "&glob=" : "", zGlob ? zGlob : ""); |
| 1169 | } |
| 1170 | } |
| 1171 | style_header("Check-in Differences"); |
| 1172 | if( P("nohdr")==0 ){ |
| 1173 | @ <h2>Difference From:</h2><blockquote> |
| 1174 | checkin_description(ridFrom); |
| @@ -1546,25 +1536,25 @@ | |
| 1546 | ** "ci" parameter is omitted, then the most recent check-in ("tip") is |
| 1547 | ** used. |
| 1548 | ** |
| 1549 | ** Additional parameters: |
| 1550 | ** |
| 1551 | ** dc=N Show N lines of context around each diff |
| 1552 | ** patch Use the patch diff format |
| 1553 | ** regex=REGEX Only show differences that match REGEX |
| 1554 | ** sbs=BOOLEAN Turn side-by-side diffs on and off (default: on) |
| 1555 | ** verbose Show more detail when describing artifacts |
| 1556 | ** w Ignore whitespace |
| 1557 | */ |
| 1558 | void diff_page(void){ |
| 1559 | int v1, v2; |
| 1560 | int isPatch; |
| 1561 | int sideBySide; |
| 1562 | char *zV1; |
| 1563 | char *zV2; |
| 1564 | const char *zRe; |
| 1565 | const char *zW; /* URL param for ignoring whitespace */ |
| 1566 | ReCompiled *pRe = 0; |
| 1567 | u64 diffFlags; |
| 1568 | u32 objdescFlags = 0; |
| 1569 | |
| 1570 | login_check_credentials(); |
| @@ -1577,12 +1567,11 @@ | |
| 1577 | v2 = name_to_rid_www("v2"); |
| 1578 | } |
| 1579 | if( v1==0 || v2==0 ) fossil_redirect_home(); |
| 1580 | zRe = P("regex"); |
| 1581 | if( zRe ) re_compile(&pRe, zRe, 0); |
| 1582 | if( P("verbose")!=0 ) objdescFlags |= OBJDESC_DETAIL; |
| 1583 | isPatch = P("patch")!=0; |
| 1584 | if( isPatch ){ |
| 1585 | Blob c1, c2, *pOut; |
| 1586 | pOut = cgi_output_blob(); |
| 1587 | cgi_set_content_type("text/plain"); |
| 1588 | diffFlags = 4; |
| @@ -1592,37 +1581,20 @@ | |
| 1592 | blob_reset(&c1); |
| 1593 | blob_reset(&c2); |
| 1594 | return; |
| 1595 | } |
| 1596 | |
| 1597 | sideBySide = !is_false(PD("sbs","1")); |
| 1598 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1599 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1600 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1601 | |
| 1602 | style_header("Diff"); |
| 1603 | zW = (diffFlags&DIFF_IGNORE_ALLWS)?"&w":""; |
| 1604 | if( *zW ){ |
| 1605 | style_submenu_element("Show Whitespace Changes", |
| 1606 | "%s/fdiff?v1=%T&v2=%T&sbs=%d", |
| 1607 | g.zTop, P("v1"), P("v2"), sideBySide); |
| 1608 | }else{ |
| 1609 | style_submenu_element("Ignore Whitespace", |
| 1610 | "%s/fdiff?v1=%T&v2=%T&sbs=%d&w", |
| 1611 | g.zTop, P("v1"), P("v2"), sideBySide); |
| 1612 | } |
| 1613 | style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1614 | g.zTop, P("v1"), P("v2")); |
| 1615 | if( !sideBySide ){ |
| 1616 | style_submenu_element("Side-by-Side Diff", |
| 1617 | "%s/fdiff?v1=%T&v2=%T&sbs=1%s", |
| 1618 | g.zTop, P("v1"), P("v2"), zW); |
| 1619 | }else{ |
| 1620 | style_submenu_element("Unified Diff", |
| 1621 | "%s/fdiff?v1=%T&v2=%T&sbs=0%s", |
| 1622 | g.zTop, P("v1"), P("v2"), zW); |
| 1623 | } |
| 1624 | |
| 1625 | if( P("smhdr")!=0 ){ |
| 1626 | @ <h2>Differences From Artifact |
| 1627 | @ %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a> To |
| 1628 | @ %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>.</h2> |
| 1629 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1071,20 +1071,20 @@ | |
| 1071 | ** branch=TAG Show all changes on a particular branch |
| 1072 | ** v=BOOLEAN Default true. If false, only list files that have changed |
| 1073 | ** sbs=BOOLEAN Side-by-side diff if true. Unified diff if false |
| 1074 | ** glob=STRING only diff files matching this glob |
| 1075 | ** dc=N show N lines of context around each diff |
| 1076 | ** w=BOOLEAN ignore whitespace when computing diffs |
| 1077 | ** nohdr omit the description at the top of the page |
| 1078 | ** |
| 1079 | ** |
| 1080 | ** Show all differences between two check-ins. |
| 1081 | */ |
| 1082 | void vdiff_page(void){ |
| 1083 | int ridFrom, ridTo; |
| 1084 | int verboseFlag; |
| 1085 | int sideBySide; |
| 1086 | u64 diffFlags = 0; |
| 1087 | Manifest *pFrom, *pTo; |
| 1088 | ManifestFile *pFileFrom, *pFileTo; |
| 1089 | const char *zBranch; |
| 1090 | const char *zFrom; |
| @@ -1154,21 +1154,11 @@ | |
| 1154 | sideBySide, (verboseFlag && !sideBySide)?"&v":"", zW); |
| 1155 | }else{ |
| 1156 | style_submenu_element("Patch", "%R/vpatch?from=%T&to=%T%s", zFrom, zTo, zW); |
| 1157 | } |
| 1158 | if( sideBySide || verboseFlag ){ |
| 1159 | style_submenu_checkbox("w", "Ignore Whitespace", 0); |
| 1160 | } |
| 1161 | style_header("Check-in Differences"); |
| 1162 | if( P("nohdr")==0 ){ |
| 1163 | @ <h2>Difference From:</h2><blockquote> |
| 1164 | checkin_description(ridFrom); |
| @@ -1546,25 +1536,25 @@ | |
| 1536 | ** "ci" parameter is omitted, then the most recent check-in ("tip") is |
| 1537 | ** used. |
| 1538 | ** |
| 1539 | ** Additional parameters: |
| 1540 | ** |
| 1541 | ** dc=N Show N lines of context around each diff |
| 1542 | ** patch Use the patch diff format |
| 1543 | ** regex=REGEX Only show differences that match REGEX |
| 1544 | ** sbs=BOOLEAN Turn side-by-side diffs on and off (default: on) |
| 1545 | ** verbose=BOOLEAN Show more detail when describing artifacts |
| 1546 | ** w=BOOLEAN Ignore whitespace |
| 1547 | */ |
| 1548 | void diff_page(void){ |
| 1549 | int v1, v2; |
| 1550 | int isPatch = P("patch")!=0; |
| 1551 | int sideBySide = PB("sbs"); |
| 1552 | int verbose = PB("verbose"); |
| 1553 | char *zV1; |
| 1554 | char *zV2; |
| 1555 | const char *zRe; |
| 1556 | ReCompiled *pRe = 0; |
| 1557 | u64 diffFlags; |
| 1558 | u32 objdescFlags = 0; |
| 1559 | |
| 1560 | login_check_credentials(); |
| @@ -1577,12 +1567,11 @@ | |
| 1567 | v2 = name_to_rid_www("v2"); |
| 1568 | } |
| 1569 | if( v1==0 || v2==0 ) fossil_redirect_home(); |
| 1570 | zRe = P("regex"); |
| 1571 | if( zRe ) re_compile(&pRe, zRe, 0); |
| 1572 | if( verbose ) objdescFlags |= OBJDESC_DETAIL; |
| 1573 | if( isPatch ){ |
| 1574 | Blob c1, c2, *pOut; |
| 1575 | pOut = cgi_output_blob(); |
| 1576 | cgi_set_content_type("text/plain"); |
| 1577 | diffFlags = 4; |
| @@ -1592,37 +1581,20 @@ | |
| 1581 | blob_reset(&c1); |
| 1582 | blob_reset(&c2); |
| 1583 | return; |
| 1584 | } |
| 1585 | |
| 1586 | zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1); |
| 1587 | zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2); |
| 1588 | diffFlags = construct_diff_flags(1, sideBySide) | DIFF_HTML; |
| 1589 | |
| 1590 | style_header("Diff"); |
| 1591 | style_submenu_checkbox("w", "Ignore Whitespace", 0); |
| 1592 | style_submenu_checkbox("sbs", "Side-by-Side Diff", 0); |
| 1593 | style_submenu_checkbox("verbose", "Verbose", 0); |
| 1594 | style_submenu_element("Patch", "%s/fdiff?v1=%T&v2=%T&patch", |
| 1595 | g.zTop, P("v1"), P("v2")); |
| 1596 | |
| 1597 | if( P("smhdr")!=0 ){ |
| 1598 | @ <h2>Differences From Artifact |
| 1599 | @ %z(href("%R/artifact/%!S",zV1))[%S(zV1)]</a> To |
| 1600 | @ %z(href("%R/artifact/%!S",zV2))[%S(zV2)]</a>.</h2> |
| 1601 |