Fossil
Check-in [4db129c925]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:4db129c9250ead78387dd4b760213149e75321ed
Date: 2010-03-08 14:12:28
User: drh
Comment:Changes to file browser to be more direct and describing what is seen in the union of all files from all versions. Add hyperlinks to tip and trunk.

Tags And Properties
Changes
[hide diffs]

Changes to src/browse.c

@@ -113,10 +113,11 @@
   char *zPrefix;
   Stmt q;
   const char *zCI = P("ci");
   int rid = 0;
   Blob content;
+  Blob dirname;
   Manifest m;
   const char *zSubdirLink;
 
   login_check_credentials();
   if( !g.okHistory ){ login_needed(); return; }
@@ -133,36 +134,47 @@
       zCI = 0;
     }
   }
 
   /* Compute the title of the page */
+  blob_zero(&dirname);
   if( zD ){
-    Blob title;
-
-    blob_zero(&title);
-    blob_appendf(&title, "Files in directory ");
-    hyperlinked_path(zD, &title);
-    @ <h2>%s(blob_str(&title))
-    blob_reset(&title);
+    blob_append(&dirname, "in directory ", -1);
+    hyperlinked_path(zD, &dirname);
     zPrefix = mprintf("%h/", zD);
   }else{
-    @ <h2>Files in the top-level directory
+    blob_append(&dirname, "in the top-level directory", -1);
     zPrefix = "";
   }
   if( zCI ){
     char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
     char zShort[20];
     memcpy(zShort, zUuid, 10);
     zShort[10] = 0;
-    @ of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]</h2>
+    @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
+    @ %s(blob_str(&dirname))</h2>
     zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
     if( zD ){
       style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
+      style_submenu_element("All", "All", "%s/dir?name=%t", g.zBaseURL, zD);
+    }else{
+      style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
     }
   }else{
-    @ </h2>
+    @ <h2>The union of all files from all check-ins
+    @ %s(blob_str(&dirname))</h2>
     zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);
+    if( zD ){
+      style_submenu_element("Top", "Top", "%s/dir", g.zBaseURL);
+      style_submenu_element("Tip", "Tip", "%s/dir?name=%t&ci=tip",
+                            g.zBaseURL, zD);
+      style_submenu_element("Trunk", "Trunk", "%s/dir?name=%t&ci=trunk",
+                             g.zBaseURL,zD);
+    }else{
+      style_submenu_element("Tip", "Tip", "%s/dir?ci=tip", g.zBaseURL);
+      style_submenu_element("Trunk", "Trunk", "%s/dir?ci=trunk", g.zBaseURL);
+    }
   }
 
   /* Compute the temporary table "localfiles" containing the names
   ** of all files and subdirectories in the zD[] directory.
   **

Changes to src/name.c

@@ -141,10 +141,12 @@
 **      tag:date
 **
 ** Then return the UUID of the oldest check-in with that tag that is
 ** not older than 'date'.
 **
+** An input of "tip" returns the most recent check-in.
+**
 ** Memory to hold the returned string comes from malloc() and needs to
 ** be freed by the caller.
 */
 char *tag_to_uuid(const char *zTag){
   char *zUuid =
@@ -183,10 +185,19 @@
           " ORDER BY event.mtime DESC ",
           zTagBase, zDate, (useUtc ? "" : ",'utc'")
         );
         break;
       }
+    }
+    if( zUuid==0 && strcmp(zTag, "tip")==0 ){
+      zUuid = db_text(0,
+        "SELECT blob.uuid"
+        "  FROM event, blob"
+        " WHERE event.type='ci'"
+        "   AND blob.rid=event.objid"
+        " ORDER BY event.mtime DESC"
+      );
     }
   }
   return zUuid;
 }