Fossil SCM
For the "version information" web pages, change the default behavior to only show the list of files that changed, not the diffs. But there is a link to get diffs of all files or of individual files. The default behavior can be changed using a Setup/Timeline configuration option to show diffs by default.
Commit
0f4f6c032587c3bb2ba4c15cabe80226635a04f7
Parent
74534cc91ecf73f…
2 files changed
+38
-6
+9
-1
+38
-6
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -245,20 +245,31 @@ | ||
| 245 | 245 | /* |
| 246 | 246 | ** WEBPAGE: vinfo |
| 247 | 247 | ** WEBPAGE: ci |
| 248 | 248 | ** URL: /ci?name=RID|ARTIFACTID |
| 249 | 249 | ** |
| 250 | -** Display information about a particular check-in. | |
| 250 | +** Display information about a particular check-in. | |
| 251 | +** | |
| 252 | +** We also jump here from /info if the name is a version. | |
| 253 | +** | |
| 254 | +** If the /ci page is used (instead of /vinfo or /info) then the | |
| 255 | +** default behavior is to show unified diffs of all file changes. | |
| 256 | +** With /vinfo and /info, only a list of the changed files are | |
| 257 | +** shown, without diffs. This behavior is inverted if the | |
| 258 | +** "show-version-diffs" setting is turned on. | |
| 251 | 259 | */ |
| 252 | 260 | void ci_page(void){ |
| 253 | 261 | Stmt q; |
| 254 | 262 | int rid; |
| 255 | 263 | int isLeaf; |
| 264 | + int showDiff; | |
| 265 | + const char *zName; | |
| 256 | 266 | |
| 257 | 267 | login_check_credentials(); |
| 258 | 268 | if( !g.okRead ){ login_needed(); return; } |
| 259 | - rid = name_to_rid(PD("name","0")); | |
| 269 | + zName = PD("name","0"); | |
| 270 | + rid = name_to_rid(zName); | |
| 260 | 271 | if( rid==0 ){ |
| 261 | 272 | style_header("Check-in Information Error"); |
| 262 | 273 | @ No such object: %h(g.argv[2]) |
| 263 | 274 | style_footer(); |
| 264 | 275 | return; |
| @@ -368,10 +379,25 @@ | ||
| 368 | 379 | login_anonymous_available(); |
| 369 | 380 | } |
| 370 | 381 | db_finalize(&q); |
| 371 | 382 | showTags(rid, ""); |
| 372 | 383 | @ <div class="section">Changes</div> |
| 384 | + showDiff = g.zPath[0]!='c'; | |
| 385 | + if( db_get_boolean("show-version-diffs", 0)==0 ){ | |
| 386 | + showDiff = !showDiff; | |
| 387 | + if( showDiff ){ | |
| 388 | + @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[hide diffs]</a><br/> | |
| 389 | + }else{ | |
| 390 | + @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[show diffs]</a><br/> | |
| 391 | + } | |
| 392 | + }else{ | |
| 393 | + if( showDiff ){ | |
| 394 | + @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide diffs]</a><br/> | |
| 395 | + }else{ | |
| 396 | + @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show diffs]</a><br/> | |
| 397 | + } | |
| 398 | + } | |
| 373 | 399 | db_prepare(&q, |
| 374 | 400 | "SELECT pid, fid, name, substr(a.uuid,1,10), substr(b.uuid,1,10)" |
| 375 | 401 | " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" |
| 376 | 402 | " LEFT JOIN blob a ON a.rid=pid" |
| 377 | 403 | " LEFT JOIN blob b ON b.rid=fid" |
| @@ -393,22 +419,28 @@ | ||
| 393 | 419 | @ <p>Changes to %h(zName)</p> |
| 394 | 420 | } |
| 395 | 421 | }else if( zOld && zNew ){ |
| 396 | 422 | @ <p>Modified <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 397 | 423 | @ from <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a> |
| 398 | - @ to <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p> | |
| 424 | + @ to <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)].</a> | |
| 425 | + if( !showDiff ){ | |
| 426 | + @ | |
| 427 | + @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(pid)&v2=%d(fid)">[diff]</a> | |
| 428 | + } | |
| 399 | 429 | }else if( zOld ){ |
| 400 | 430 | @ <p>Deleted <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 401 | 431 | @ version <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a></p> |
| 402 | 432 | continue; |
| 403 | 433 | }else{ |
| 404 | 434 | @ <p>Added <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 405 | 435 | @ version <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p> |
| 406 | 436 | } |
| 407 | - @ <blockquote><pre> | |
| 408 | - append_diff(pid, fid); | |
| 409 | - @ </pre></blockquote> | |
| 437 | + if( showDiff ){ | |
| 438 | + @ <blockquote><pre> | |
| 439 | + append_diff(pid, fid); | |
| 440 | + @ </pre></blockquote> | |
| 441 | + } | |
| 410 | 442 | } |
| 411 | 443 | db_finalize(&q); |
| 412 | 444 | style_footer(); |
| 413 | 445 | } |
| 414 | 446 | |
| 415 | 447 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -245,20 +245,31 @@ | |
| 245 | /* |
| 246 | ** WEBPAGE: vinfo |
| 247 | ** WEBPAGE: ci |
| 248 | ** URL: /ci?name=RID|ARTIFACTID |
| 249 | ** |
| 250 | ** Display information about a particular check-in. |
| 251 | */ |
| 252 | void ci_page(void){ |
| 253 | Stmt q; |
| 254 | int rid; |
| 255 | int isLeaf; |
| 256 | |
| 257 | login_check_credentials(); |
| 258 | if( !g.okRead ){ login_needed(); return; } |
| 259 | rid = name_to_rid(PD("name","0")); |
| 260 | if( rid==0 ){ |
| 261 | style_header("Check-in Information Error"); |
| 262 | @ No such object: %h(g.argv[2]) |
| 263 | style_footer(); |
| 264 | return; |
| @@ -368,10 +379,25 @@ | |
| 368 | login_anonymous_available(); |
| 369 | } |
| 370 | db_finalize(&q); |
| 371 | showTags(rid, ""); |
| 372 | @ <div class="section">Changes</div> |
| 373 | db_prepare(&q, |
| 374 | "SELECT pid, fid, name, substr(a.uuid,1,10), substr(b.uuid,1,10)" |
| 375 | " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" |
| 376 | " LEFT JOIN blob a ON a.rid=pid" |
| 377 | " LEFT JOIN blob b ON b.rid=fid" |
| @@ -393,22 +419,28 @@ | |
| 393 | @ <p>Changes to %h(zName)</p> |
| 394 | } |
| 395 | }else if( zOld && zNew ){ |
| 396 | @ <p>Modified <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 397 | @ from <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a> |
| 398 | @ to <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p> |
| 399 | }else if( zOld ){ |
| 400 | @ <p>Deleted <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 401 | @ version <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a></p> |
| 402 | continue; |
| 403 | }else{ |
| 404 | @ <p>Added <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 405 | @ version <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p> |
| 406 | } |
| 407 | @ <blockquote><pre> |
| 408 | append_diff(pid, fid); |
| 409 | @ </pre></blockquote> |
| 410 | } |
| 411 | db_finalize(&q); |
| 412 | style_footer(); |
| 413 | } |
| 414 | |
| 415 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -245,20 +245,31 @@ | |
| 245 | /* |
| 246 | ** WEBPAGE: vinfo |
| 247 | ** WEBPAGE: ci |
| 248 | ** URL: /ci?name=RID|ARTIFACTID |
| 249 | ** |
| 250 | ** Display information about a particular check-in. |
| 251 | ** |
| 252 | ** We also jump here from /info if the name is a version. |
| 253 | ** |
| 254 | ** If the /ci page is used (instead of /vinfo or /info) then the |
| 255 | ** default behavior is to show unified diffs of all file changes. |
| 256 | ** With /vinfo and /info, only a list of the changed files are |
| 257 | ** shown, without diffs. This behavior is inverted if the |
| 258 | ** "show-version-diffs" setting is turned on. |
| 259 | */ |
| 260 | void ci_page(void){ |
| 261 | Stmt q; |
| 262 | int rid; |
| 263 | int isLeaf; |
| 264 | int showDiff; |
| 265 | const char *zName; |
| 266 | |
| 267 | login_check_credentials(); |
| 268 | if( !g.okRead ){ login_needed(); return; } |
| 269 | zName = PD("name","0"); |
| 270 | rid = name_to_rid(zName); |
| 271 | if( rid==0 ){ |
| 272 | style_header("Check-in Information Error"); |
| 273 | @ No such object: %h(g.argv[2]) |
| 274 | style_footer(); |
| 275 | return; |
| @@ -368,10 +379,25 @@ | |
| 379 | login_anonymous_available(); |
| 380 | } |
| 381 | db_finalize(&q); |
| 382 | showTags(rid, ""); |
| 383 | @ <div class="section">Changes</div> |
| 384 | showDiff = g.zPath[0]!='c'; |
| 385 | if( db_get_boolean("show-version-diffs", 0)==0 ){ |
| 386 | showDiff = !showDiff; |
| 387 | if( showDiff ){ |
| 388 | @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[hide diffs]</a><br/> |
| 389 | }else{ |
| 390 | @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[show diffs]</a><br/> |
| 391 | } |
| 392 | }else{ |
| 393 | if( showDiff ){ |
| 394 | @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide diffs]</a><br/> |
| 395 | }else{ |
| 396 | @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show diffs]</a><br/> |
| 397 | } |
| 398 | } |
| 399 | db_prepare(&q, |
| 400 | "SELECT pid, fid, name, substr(a.uuid,1,10), substr(b.uuid,1,10)" |
| 401 | " FROM mlink JOIN filename ON filename.fnid=mlink.fnid" |
| 402 | " LEFT JOIN blob a ON a.rid=pid" |
| 403 | " LEFT JOIN blob b ON b.rid=fid" |
| @@ -393,22 +419,28 @@ | |
| 419 | @ <p>Changes to %h(zName)</p> |
| 420 | } |
| 421 | }else if( zOld && zNew ){ |
| 422 | @ <p>Modified <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 423 | @ from <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a> |
| 424 | @ to <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)].</a> |
| 425 | if( !showDiff ){ |
| 426 | @ |
| 427 | @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(pid)&v2=%d(fid)">[diff]</a> |
| 428 | } |
| 429 | }else if( zOld ){ |
| 430 | @ <p>Deleted <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 431 | @ version <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a></p> |
| 432 | continue; |
| 433 | }else{ |
| 434 | @ <p>Added <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a> |
| 435 | @ version <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p> |
| 436 | } |
| 437 | if( showDiff ){ |
| 438 | @ <blockquote><pre> |
| 439 | append_diff(pid, fid); |
| 440 | @ </pre></blockquote> |
| 441 | } |
| 442 | } |
| 443 | db_finalize(&q); |
| 444 | style_footer(); |
| 445 | } |
| 446 | |
| 447 |
+9
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -770,10 +770,18 @@ | ||
| 770 | 770 | onoff_attribute("Use Universal Coordinated Time (UTC)", |
| 771 | 771 | "timeline-utc", "utc", 1); |
| 772 | 772 | @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or |
| 773 | 773 | @ Zulu) instead of in local time.</p> |
| 774 | 774 | |
| 775 | + @ <hr> | |
| 776 | + onoff_attribute("Show version differences by default", | |
| 777 | + "show-version-diffs", "vdiff", 0); | |
| 778 | + @ <p>On the version-information pages linked from the timeline can either | |
| 779 | + @ show complete diffs of all file changes, or can just list the names of | |
| 780 | + @ the files that have changed. Users can get to either page by | |
| 781 | + @ clicking. This setting selects the default.</p> | |
| 782 | + | |
| 775 | 783 | @ <hr> |
| 776 | 784 | entry_attribute("Max timeline comment length", 6, |
| 777 | 785 | "timeline-max-comment", "tmc", "0"); |
| 778 | 786 | @ <p>The maximum length of a comment to be displayed in a timeline. |
| 779 | 787 | @ "0" there is no length limit.</p> |
| @@ -804,11 +812,11 @@ | ||
| 804 | 812 | "autosync", "autosync", 1); |
| 805 | 813 | @ <p>Automatically keeps your work in sync with a centralized server.</p> |
| 806 | 814 | |
| 807 | 815 | @ <hr> |
| 808 | 816 | onoff_attribute("Show javascript button to fill in CAPTCHA", |
| 809 | - "auto-captcha", "auto-captcha", 0); | |
| 817 | + "auto-captcha", "autocaptcha", 0); | |
| 810 | 818 | @ <p>When enabled, a button appears on the login screen for user |
| 811 | 819 | @ "anonymous" that will automatically fill in the CAPTCHA password. |
| 812 | 820 | @ This is less secure that forcing the user to do it manually, but is |
| 813 | 821 | @ usually secure enough.</p> |
| 814 | 822 | |
| 815 | 823 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -770,10 +770,18 @@ | |
| 770 | onoff_attribute("Use Universal Coordinated Time (UTC)", |
| 771 | "timeline-utc", "utc", 1); |
| 772 | @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or |
| 773 | @ Zulu) instead of in local time.</p> |
| 774 | |
| 775 | @ <hr> |
| 776 | entry_attribute("Max timeline comment length", 6, |
| 777 | "timeline-max-comment", "tmc", "0"); |
| 778 | @ <p>The maximum length of a comment to be displayed in a timeline. |
| 779 | @ "0" there is no length limit.</p> |
| @@ -804,11 +812,11 @@ | |
| 804 | "autosync", "autosync", 1); |
| 805 | @ <p>Automatically keeps your work in sync with a centralized server.</p> |
| 806 | |
| 807 | @ <hr> |
| 808 | onoff_attribute("Show javascript button to fill in CAPTCHA", |
| 809 | "auto-captcha", "auto-captcha", 0); |
| 810 | @ <p>When enabled, a button appears on the login screen for user |
| 811 | @ "anonymous" that will automatically fill in the CAPTCHA password. |
| 812 | @ This is less secure that forcing the user to do it manually, but is |
| 813 | @ usually secure enough.</p> |
| 814 | |
| 815 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -770,10 +770,18 @@ | |
| 770 | onoff_attribute("Use Universal Coordinated Time (UTC)", |
| 771 | "timeline-utc", "utc", 1); |
| 772 | @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or |
| 773 | @ Zulu) instead of in local time.</p> |
| 774 | |
| 775 | @ <hr> |
| 776 | onoff_attribute("Show version differences by default", |
| 777 | "show-version-diffs", "vdiff", 0); |
| 778 | @ <p>On the version-information pages linked from the timeline can either |
| 779 | @ show complete diffs of all file changes, or can just list the names of |
| 780 | @ the files that have changed. Users can get to either page by |
| 781 | @ clicking. This setting selects the default.</p> |
| 782 | |
| 783 | @ <hr> |
| 784 | entry_attribute("Max timeline comment length", 6, |
| 785 | "timeline-max-comment", "tmc", "0"); |
| 786 | @ <p>The maximum length of a comment to be displayed in a timeline. |
| 787 | @ "0" there is no length limit.</p> |
| @@ -804,11 +812,11 @@ | |
| 812 | "autosync", "autosync", 1); |
| 813 | @ <p>Automatically keeps your work in sync with a centralized server.</p> |
| 814 | |
| 815 | @ <hr> |
| 816 | onoff_attribute("Show javascript button to fill in CAPTCHA", |
| 817 | "auto-captcha", "autocaptcha", 0); |
| 818 | @ <p>When enabled, a button appears on the login screen for user |
| 819 | @ "anonymous" that will automatically fill in the CAPTCHA password. |
| 820 | @ This is less secure that forcing the user to do it manually, but is |
| 821 | @ usually secure enough.</p> |
| 822 | |
| 823 |