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

Changes to src/browse.c

   111   int nCol, nRow;                                                                     111   int nCol, nRow;
   112   int cnt, i;                                                                         112   int cnt, i;
   113   char *zPrefix;                                                                      113   char *zPrefix;
   114   Stmt q;                                                                             114   Stmt q;
   115   const char *zCI = P("ci");                                                          115   const char *zCI = P("ci");
   116   int rid = 0;                                                                        116   int rid = 0;
   117   Blob content;                                                                       117   Blob content;
                                                                                        >    118   Blob dirname;
   118   Manifest m;                                                                         119   Manifest m;
   119   const char *zSubdirLink;                                                            120   const char *zSubdirLink;
   120                                                                                       121 
   121   login_check_credentials();                                                          122   login_check_credentials();
   122   if( !g.okHistory ){ login_needed(); return; }                                       123   if( !g.okHistory ){ login_needed(); return; }
   123   style_header("File List");                                                          124   style_header("File List");
   124   sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,                     125   sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0,
................................................................................................................................................................................
   131   if( zCI && (rid = name_to_rid(zCI))!=0 && content_get(rid, &content) ){             132   if( zCI && (rid = name_to_rid(zCI))!=0 && content_get(rid, &content) ){
   132     if( !manifest_parse(&m, &content) || m.type!=CFTYPE_MANIFEST ){                   133     if( !manifest_parse(&m, &content) || m.type!=CFTYPE_MANIFEST ){
   133       zCI = 0;                                                                        134       zCI = 0;
   134     }                                                                                 135     }
   135   }                                                                                   136   }
   136                                                                                       137 
   137   /* Compute the title of the page */                                                 138   /* Compute the title of the page */
                                                                                        >    139   blob_zero(&dirname);
   138   if( zD ){                                                                           140   if( zD ){
   139     Blob title;                                                                  |    141     blob_append(&dirname, "in directory ", -1);
   140                                                                                  |    142     hyperlinked_path(zD, &dirname);
   141     blob_zero(&title);                                                           <
   142     blob_appendf(&title, "Files in directory ");                                 <
   143     hyperlinked_path(zD, &title);                                                <
   144     @ <h2>%s(blob_str(&title))                                                   <
   145     blob_reset(&title);                                                          <
   146     zPrefix = mprintf("%h/", zD);                                                     143     zPrefix = mprintf("%h/", zD);
   147   }else{                                                                              144   }else{
   148     @ <h2>Files in the top-level directory                                       |    145     blob_append(&dirname, "in the top-level directory", -1);
   149     zPrefix = "";                                                                     146     zPrefix = "";
   150   }                                                                                   147   }
   151   if( zCI ){                                                                          148   if( zCI ){
   152     char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);              149     char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
   153     char zShort[20];                                                                  150     char zShort[20];
   154     memcpy(zShort, zUuid, 10);                                                        151     memcpy(zShort, zUuid, 10);
   155     zShort[10] = 0;                                                                   152     zShort[10] = 0;
   156     @ of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]</h2>           |    153     @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]
                                                                                        >    154     @ %s(blob_str(&dirname))</h2>
   157     zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);        155     zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix);
   158     if( zD ){                                                                         156     if( zD ){
   159       style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);         157       style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid);
                                                                                        >    158       style_submenu_element("All", "All", "%s/dir?name=%t", g.zBaseURL, zD);
                                                                                        >    159     }else{
                                                                                        >    160       style_submenu_element("All", "All", "%s/dir", g.zBaseURL);
   160     }                                                                                 161     }
   161   }else{                                                                              162   }else{
   162     @ </h2>                                                                      |    163     @ <h2>The union of all files from all check-ins
                                                                                        >    164     @ %s(blob_str(&dirname))</h2>
   163     zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);                     165     zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix);
                                                                                        >    166     if( zD ){
                                                                                        >    167       style_submenu_element("Top", "Top", "%s/dir", g.zBaseURL);
                                                                                        >    168       style_submenu_element("Tip", "Tip", "%s/dir?name=%t&ci=tip",
                                                                                        >    169                             g.zBaseURL, zD);
                                                                                        >    170       style_submenu_element("Trunk", "Trunk", "%s/dir?name=%t&ci=trunk",
                                                                                        >    171                              g.zBaseURL,zD);
                                                                                        >    172     }else{
                                                                                        >    173       style_submenu_element("Tip", "Tip", "%s/dir?ci=tip", g.zBaseURL);
                                                                                        >    174       style_submenu_element("Trunk", "Trunk", "%s/dir?ci=trunk", g.zBaseURL);
                                                                                        >    175     }
   164   }                                                                                   176   }
   165                                                                                       177 
   166   /* Compute the temporary table "localfiles" containing the names                    178   /* Compute the temporary table "localfiles" containing the names
   167   ** of all files and subdirectories in the zD[] directory.                           179   ** of all files and subdirectories in the zD[] directory.
   168   **                                                                                  180   **
   169   ** Subdirectory names begin with "/".  This causes them to sort                     181   ** Subdirectory names begin with "/".  This causes them to sort
   170   ** first and it also gives us an easy way to distinguish files                      182   ** first and it also gives us an easy way to distinguish files

Changes to src/name.c

   139 ** If the input string is of the form:                                                139 ** If the input string is of the form:
   140 **                                                                                    140 **
   141 **      tag:date                                                                      141 **      tag:date
   142 **                                                                                    142 **
   143 ** Then return the UUID of the oldest check-in with that tag that is                  143 ** Then return the UUID of the oldest check-in with that tag that is
   144 ** not older than 'date'.                                                             144 ** not older than 'date'.
   145 **                                                                                    145 **
                                                                                        >    146 ** An input of "tip" returns the most recent check-in.
                                                                                        >    147 **
   146 ** Memory to hold the returned string comes from malloc() and needs to                148 ** Memory to hold the returned string comes from malloc() and needs to
   147 ** be freed by the caller.                                                            149 ** be freed by the caller.
   148 */                                                                                    150 */
   149 char *tag_to_uuid(const char *zTag){                                                  151 char *tag_to_uuid(const char *zTag){
   150   char *zUuid =                                                                       152   char *zUuid =
   151     db_text(0,                                                                        153     db_text(0,
   152        "SELECT blob.uuid"                                                             154        "SELECT blob.uuid"
................................................................................................................................................................................
   181           "   AND blob.rid=event.objid "                                              183           "   AND blob.rid=event.objid "
   182           "   AND event.mtime<=julianday(%Q %s)"                                      184           "   AND event.mtime<=julianday(%Q %s)"
   183           " ORDER BY event.mtime DESC ",                                              185           " ORDER BY event.mtime DESC ",
   184           zTagBase, zDate, (useUtc ? "" : ",'utc'")                                   186           zTagBase, zDate, (useUtc ? "" : ",'utc'")
   185         );                                                                            187         );
   186         break;                                                                        188         break;
   187       }                                                                               189       }
                                                                                        >    190     }
                                                                                        >    191     if( zUuid==0 && strcmp(zTag, "tip")==0 ){
                                                                                        >    192       zUuid = db_text(0,
                                                                                        >    193         "SELECT blob.uuid"
                                                                                        >    194         "  FROM event, blob"
                                                                                        >    195         " WHERE event.type='ci'"
                                                                                        >    196         "   AND blob.rid=event.objid"
                                                                                        >    197         " ORDER BY event.mtime DESC"
                                                                                        >    198       );
   188     }                                                                                 199     }
   189   }                                                                                   200   }
   190   return zUuid;                                                                       201   return zUuid;
   191 }                                                                                     202 }
   192                                                                                       203 
   193 /*                                                                                    204 /*
   194 ** Convert a date/time string into a UUID.                                            205 ** Convert a date/time string into a UUID.