Check-in [0f4f6c0325]
Not logged in
Overview

SHA1 Hash:0f4f6c032587c3bb2ba4c15cabe80226635a04f7
Date: 2009-12-18 23:54:24
User: drh
Comment: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.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/info.c from [f5284fa22d] to [806a78d802].

@@ -246,19 +246,30 @@
 ** WEBPAGE: vinfo
 ** WEBPAGE: ci
 ** URL:  /ci?name=RID|ARTIFACTID
 **
 ** Display information about a particular check-in.
+**
+** We also jump here from /info if the name is a version.
+**
+** If the /ci page is used (instead of /vinfo or /info) then the
+** default behavior is to show unified diffs of all file changes.
+** With /vinfo and /info, only a list of the changed files are
+** shown, without diffs.  This behavior is inverted if the
+** "show-version-diffs" setting is turned on.
 */
 void ci_page(void){
   Stmt q;
   int rid;
   int isLeaf;
+  int showDiff;
+  const char *zName;
 
   login_check_credentials();
   if( !g.okRead ){ login_needed(); return; }
-  rid = name_to_rid(PD("name","0"));
+  zName = PD("name","0");
+  rid = name_to_rid(zName);
   if( rid==0 ){
     style_header("Check-in Information Error");
     @ No such object: %h(g.argv[2])
     style_footer();
     return;
@@ -368,10 +379,25 @@
     login_anonymous_available();
   }
   db_finalize(&q);
   showTags(rid, "");
   @ <div class="section">Changes</div>
+  showDiff = g.zPath[0]!='c';
+  if( db_get_boolean("show-version-diffs", 0)==0 ){
+    showDiff = !showDiff;
+    if( showDiff ){
+      @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[hide&nbsp;diffs]</a><br/>
+    }else{
+      @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[show&nbsp;diffs]</a><br/>
+    }
+  }else{
+    if( showDiff ){
+      @ <a href="%s(g.zBaseURL)/ci/%T(zName)">[hide&nbsp;diffs]</a><br/>
+    }else{
+      @ <a href="%s(g.zBaseURL)/vinfo/%T(zName)">[show&nbsp;diffs]</a><br/>
+    }
+  }
   db_prepare(&q,
      "SELECT pid, fid, name, substr(a.uuid,1,10), substr(b.uuid,1,10)"
      "  FROM mlink JOIN filename ON filename.fnid=mlink.fnid"
      "         LEFT JOIN blob a ON a.rid=pid"
      "         LEFT JOIN blob b ON b.rid=fid"
@@ -393,22 +419,28 @@
         @ <p>Changes to %h(zName)</p>
       }
     }else if( zOld && zNew ){
       @ <p>Modified <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
       @ from <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a>
-      @ to <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p>
+      @ to <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)].</a>
+      if( !showDiff ){
+        @ &nbsp;&nbsp;
+        @ <a href="%s(g.zBaseURL)/fdiff?v1=%d(pid)&v2=%d(fid)">[diff]</a>
+      }
     }else if( zOld ){
       @ <p>Deleted <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
       @ version <a href="%s(g.zBaseURL)/artifact/%s(zOld)">[%s(zOld)]</a></p>
       continue;
     }else{
       @ <p>Added <a href="%s(g.zBaseURL)/finfo?name=%T(zName)">%h(zName)</a>
       @ version <a href="%s(g.zBaseURL)/artifact/%s(zNew)">[%s(zNew)]</a></p>
     }
-    @ <blockquote><pre>
-    append_diff(pid, fid);
-    @ </pre></blockquote>
+    if( showDiff ){
+      @ <blockquote><pre>
+      append_diff(pid, fid);
+      @ </pre></blockquote>
+    }
   }
   db_finalize(&q);
   style_footer();
 }
 

Modified src/setup.c from [9651fece26] to [d61571ef37].

@@ -771,10 +771,18 @@
                   "timeline-utc", "utc", 1);
   @ <p>Show times as UTC (also sometimes called Greenwich Mean Time (GMT) or
   @ Zulu) instead of in local time.</p>
 
   @ <hr>
+  onoff_attribute("Show version differences by default",
+                  "show-version-diffs", "vdiff", 0);
+  @ <p>On the version-information pages linked from the timeline can either
+  @ show complete diffs of all file changes, or can just list the names of
+  @ the files that have changed.  Users can get to either page by
+  @ clicking.  This setting selects the default.</p>
+
+  @ <hr>
   entry_attribute("Max timeline comment length", 6,
                   "timeline-max-comment", "tmc", "0");
   @ <p>The maximum length of a comment to be displayed in a timeline.
   @ "0" there is no length limit.</p>
 
@@ -804,11 +812,11 @@
                   "autosync", "autosync", 1);
   @ <p>Automatically keeps your work in sync with a centralized server.</p>
 
   @ <hr>
   onoff_attribute("Show javascript button to fill in CAPTCHA",
-                  "auto-captcha", "auto-captcha", 0);
+                  "auto-captcha", "autocaptcha", 0);
   @ <p>When enabled, a button appears on the login screen for user
   @ "anonymous" that will automatically fill in the CAPTCHA password.
   @ This is less secure that forcing the user to do it manually, but is
   @ usually secure enough.</p>