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.

drh 2009-12-18 23:54 trunk
Commit 0f4f6c032587c3bb2ba4c15cabe80226635a04f7
2 files changed +38 -6 +9 -1
+38 -6
--- src/info.c
+++ src/info.c
@@ -245,20 +245,31 @@
245245
/*
246246
** WEBPAGE: vinfo
247247
** WEBPAGE: ci
248248
** URL: /ci?name=RID|ARTIFACTID
249249
**
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.
251259
*/
252260
void ci_page(void){
253261
Stmt q;
254262
int rid;
255263
int isLeaf;
264
+ int showDiff;
265
+ const char *zName;
256266
257267
login_check_credentials();
258268
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);
260271
if( rid==0 ){
261272
style_header("Check-in Information Error");
262273
@ No such object: %h(g.argv[2])
263274
style_footer();
264275
return;
@@ -368,10 +379,25 @@
368379
login_anonymous_available();
369380
}
370381
db_finalize(&q);
371382
showTags(rid, "");
372383
@ <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&nbsp;diffs]</a><br/>
389
+ }else{
390
+ @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[show&nbsp;diffs]</a><br/>
391
+ }
392
+ }else{
393
+ if( showDiff ){
394
+ @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide&nbsp;diffs]</a><br/>
395
+ }else{
396
+ @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show&nbsp;diffs]</a><br/>
397
+ }
398
+ }
373399
db_prepare(&q,
374400
"SELECT pid, fid, name, substr(a.uuid,1,10), substr(b.uuid,1,10)"
375401
" FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
376402
" LEFT JOIN blob a ON a.rid=pid"
377403
" LEFT JOIN blob b ON b.rid=fid"
@@ -393,22 +419,28 @@
393419
@ <p>Changes to %h(zName)</p>
394420
}
395421
}else if( zOld && zNew ){
396422
@ <p>Modified <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
397423
@ 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
+ @ &nbsp;&nbsp;
427
+ @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(pid)&v2=%d(fid)">[diff]</a>
428
+ }
399429
}else if( zOld ){
400430
@ <p>Deleted <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
401431
@ version <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a></p>
402432
continue;
403433
}else{
404434
@ <p>Added <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
405435
@ version <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p>
406436
}
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
+ }
410442
}
411443
db_finalize(&q);
412444
style_footer();
413445
}
414446
415447
--- 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&nbsp;diffs]</a><br/>
389 }else{
390 @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[show&nbsp;diffs]</a><br/>
391 }
392 }else{
393 if( showDiff ){
394 @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide&nbsp;diffs]</a><br/>
395 }else{
396 @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show&nbsp;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 @ &nbsp;&nbsp;
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 @@
770770
onoff_attribute("Use Universal Coordinated Time (UTC)",
771771
"timeline-utc", "utc", 1);
772772
@ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
773773
@ Zulu) instead of in local time.</p>
774774
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
+
775783
@ <hr>
776784
entry_attribute("Max timeline comment length", 6,
777785
"timeline-max-comment", "tmc", "0");
778786
@ <p>The maximum length of a comment to be displayed in a timeline.
779787
@ "0" there is no length limit.</p>
@@ -804,11 +812,11 @@
804812
"autosync", "autosync", 1);
805813
@ <p>Automatically keeps your work in sync with a centralized server.</p>
806814
807815
@ <hr>
808816
onoff_attribute("Show javascript button to fill in CAPTCHA",
809
- "auto-captcha", "auto-captcha", 0);
817
+ "auto-captcha", "autocaptcha", 0);
810818
@ <p>When enabled, a button appears on the login screen for user
811819
@ "anonymous" that will automatically fill in the CAPTCHA password.
812820
@ This is less secure that forcing the user to do it manually, but is
813821
@ usually secure enough.</p>
814822
815823
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button