Fossil SCM
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.
Commit
4db129c9250ead78387dd4b760213149e75321ed
Parent
b22e5a9e522beb0…
2 files changed
+22
-10
+11
+22
-10
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -113,10 +113,11 @@ | ||
| 113 | 113 | char *zPrefix; |
| 114 | 114 | Stmt q; |
| 115 | 115 | const char *zCI = P("ci"); |
| 116 | 116 | int rid = 0; |
| 117 | 117 | Blob content; |
| 118 | + Blob dirname; | |
| 118 | 119 | Manifest m; |
| 119 | 120 | const char *zSubdirLink; |
| 120 | 121 | |
| 121 | 122 | login_check_credentials(); |
| 122 | 123 | if( !g.okHistory ){ login_needed(); return; } |
| @@ -133,36 +134,47 @@ | ||
| 133 | 134 | zCI = 0; |
| 134 | 135 | } |
| 135 | 136 | } |
| 136 | 137 | |
| 137 | 138 | /* Compute the title of the page */ |
| 139 | + blob_zero(&dirname); | |
| 138 | 140 | if( zD ){ |
| 139 | - Blob title; | |
| 140 | - | |
| 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); | |
| 141 | + blob_append(&dirname, "in directory ", -1); | |
| 142 | + hyperlinked_path(zD, &dirname); | |
| 146 | 143 | zPrefix = mprintf("%h/", zD); |
| 147 | 144 | }else{ |
| 148 | - @ <h2>Files in the top-level directory | |
| 145 | + blob_append(&dirname, "in the top-level directory", -1); | |
| 149 | 146 | zPrefix = ""; |
| 150 | 147 | } |
| 151 | 148 | if( zCI ){ |
| 152 | 149 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 153 | 150 | char zShort[20]; |
| 154 | 151 | memcpy(zShort, zUuid, 10); |
| 155 | 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 | 155 | zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix); |
| 158 | 156 | if( zD ){ |
| 159 | 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 | 162 | }else{ |
| 162 | - @ </h2> | |
| 163 | + @ <h2>The union of all files from all check-ins | |
| 164 | + @ %s(blob_str(&dirname))</h2> | |
| 163 | 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 | 178 | /* Compute the temporary table "localfiles" containing the names |
| 167 | 179 | ** of all files and subdirectories in the zD[] directory. |
| 168 | 180 | ** |
| 169 | 181 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -113,10 +113,11 @@ | |
| 113 | char *zPrefix; |
| 114 | Stmt q; |
| 115 | const char *zCI = P("ci"); |
| 116 | int rid = 0; |
| 117 | Blob content; |
| 118 | Manifest m; |
| 119 | const char *zSubdirLink; |
| 120 | |
| 121 | login_check_credentials(); |
| 122 | if( !g.okHistory ){ login_needed(); return; } |
| @@ -133,36 +134,47 @@ | |
| 133 | zCI = 0; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | /* Compute the title of the page */ |
| 138 | if( zD ){ |
| 139 | Blob title; |
| 140 | |
| 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); |
| 147 | }else{ |
| 148 | @ <h2>Files in the top-level directory |
| 149 | zPrefix = ""; |
| 150 | } |
| 151 | if( zCI ){ |
| 152 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 153 | char zShort[20]; |
| 154 | memcpy(zShort, zUuid, 10); |
| 155 | zShort[10] = 0; |
| 156 | @ of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>]</h2> |
| 157 | zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix); |
| 158 | if( zD ){ |
| 159 | style_submenu_element("Top", "Top", "%s/dir?ci=%s", g.zBaseURL, zUuid); |
| 160 | } |
| 161 | }else{ |
| 162 | @ </h2> |
| 163 | zSubdirLink = mprintf("%s/dir?name=%T", g.zBaseURL, zPrefix); |
| 164 | } |
| 165 | |
| 166 | /* Compute the temporary table "localfiles" containing the names |
| 167 | ** of all files and subdirectories in the zD[] directory. |
| 168 | ** |
| 169 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -113,10 +113,11 @@ | |
| 113 | char *zPrefix; |
| 114 | Stmt q; |
| 115 | const char *zCI = P("ci"); |
| 116 | int rid = 0; |
| 117 | Blob content; |
| 118 | Blob dirname; |
| 119 | Manifest m; |
| 120 | const char *zSubdirLink; |
| 121 | |
| 122 | login_check_credentials(); |
| 123 | if( !g.okHistory ){ login_needed(); return; } |
| @@ -133,36 +134,47 @@ | |
| 134 | zCI = 0; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /* Compute the title of the page */ |
| 139 | blob_zero(&dirname); |
| 140 | if( zD ){ |
| 141 | blob_append(&dirname, "in directory ", -1); |
| 142 | hyperlinked_path(zD, &dirname); |
| 143 | zPrefix = mprintf("%h/", zD); |
| 144 | }else{ |
| 145 | blob_append(&dirname, "in the top-level directory", -1); |
| 146 | zPrefix = ""; |
| 147 | } |
| 148 | if( zCI ){ |
| 149 | char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 150 | char zShort[20]; |
| 151 | memcpy(zShort, zUuid, 10); |
| 152 | zShort[10] = 0; |
| 153 | @ <h2>Files of check-in [<a href="vinfo?name=%T(zUuid)">%s(zShort)</a>] |
| 154 | @ %s(blob_str(&dirname))</h2> |
| 155 | zSubdirLink = mprintf("%s/dir?ci=%s&name=%T", g.zBaseURL, zUuid, zPrefix); |
| 156 | if( zD ){ |
| 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); |
| 161 | } |
| 162 | }else{ |
| 163 | @ <h2>The union of all files from all check-ins |
| 164 | @ %s(blob_str(&dirname))</h2> |
| 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 | } |
| 176 | } |
| 177 | |
| 178 | /* Compute the temporary table "localfiles" containing the names |
| 179 | ** of all files and subdirectories in the zD[] directory. |
| 180 | ** |
| 181 |
+11
| --- src/name.c | ||
| +++ src/name.c | ||
| @@ -140,10 +140,12 @@ | ||
| 140 | 140 | ** |
| 141 | 141 | ** tag:date |
| 142 | 142 | ** |
| 143 | 143 | ** Then return the UUID of the oldest check-in with that tag that is |
| 144 | 144 | ** not older than 'date'. |
| 145 | +** | |
| 146 | +** An input of "tip" returns the most recent check-in. | |
| 145 | 147 | ** |
| 146 | 148 | ** Memory to hold the returned string comes from malloc() and needs to |
| 147 | 149 | ** be freed by the caller. |
| 148 | 150 | */ |
| 149 | 151 | char *tag_to_uuid(const char *zTag){ |
| @@ -183,10 +185,19 @@ | ||
| 183 | 185 | " ORDER BY event.mtime DESC ", |
| 184 | 186 | zTagBase, zDate, (useUtc ? "" : ",'utc'") |
| 185 | 187 | ); |
| 186 | 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 | 201 | return zUuid; |
| 191 | 202 | } |
| 192 | 203 | |
| 193 | 204 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -140,10 +140,12 @@ | |
| 140 | ** |
| 141 | ** tag:date |
| 142 | ** |
| 143 | ** Then return the UUID of the oldest check-in with that tag that is |
| 144 | ** not older than 'date'. |
| 145 | ** |
| 146 | ** Memory to hold the returned string comes from malloc() and needs to |
| 147 | ** be freed by the caller. |
| 148 | */ |
| 149 | char *tag_to_uuid(const char *zTag){ |
| @@ -183,10 +185,19 @@ | |
| 183 | " ORDER BY event.mtime DESC ", |
| 184 | zTagBase, zDate, (useUtc ? "" : ",'utc'") |
| 185 | ); |
| 186 | break; |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | return zUuid; |
| 191 | } |
| 192 | |
| 193 |
| --- src/name.c | |
| +++ src/name.c | |
| @@ -140,10 +140,12 @@ | |
| 140 | ** |
| 141 | ** tag:date |
| 142 | ** |
| 143 | ** Then return the UUID of the oldest check-in with that tag that is |
| 144 | ** not older than 'date'. |
| 145 | ** |
| 146 | ** An input of "tip" returns the most recent check-in. |
| 147 | ** |
| 148 | ** Memory to hold the returned string comes from malloc() and needs to |
| 149 | ** be freed by the caller. |
| 150 | */ |
| 151 | char *tag_to_uuid(const char *zTag){ |
| @@ -183,10 +185,19 @@ | |
| 185 | " ORDER BY event.mtime DESC ", |
| 186 | zTagBase, zDate, (useUtc ? "" : ",'utc'") |
| 187 | ); |
| 188 | break; |
| 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 | ); |
| 199 | } |
| 200 | } |
| 201 | return zUuid; |
| 202 | } |
| 203 | |
| 204 |