Fossil SCM
Comment improvements and minor simplifications.
Commit
aa9815ffc07ac73be5666c8b364903ab33c088fff69a051e88508fa85c0090c4
Parent
888eaf4fadad280…
2 files changed
+19
-30
+12
-29
+19
-30
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -133,11 +133,11 @@ | ||
| 133 | 133 | Manifest *pM = 0; |
| 134 | 134 | const char *zSubdirLink; |
| 135 | 135 | int linkTrunk = 1; |
| 136 | 136 | int linkTip = 1; |
| 137 | 137 | HQuery sURI; |
| 138 | - int isSymbolicCI = 0; | |
| 138 | + int isSymbolicCI = 0; /* ci= is symbolic name, not a hash prefix */ | |
| 139 | 139 | char *zHeader = 0; |
| 140 | 140 | |
| 141 | 141 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 142 | 142 | if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; } |
| 143 | 143 | login_check_credentials(); |
| @@ -156,28 +156,23 @@ | ||
| 156 | 156 | if( pM ){ |
| 157 | 157 | int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); |
| 158 | 158 | linkTrunk = trunkRid && rid != trunkRid; |
| 159 | 159 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 160 | 160 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 161 | - isSymbolicCI = (strncmp(zUuid, zCI, strlen(zCI)) != 0); | |
| 161 | + isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); | |
| 162 | 162 | }else{ |
| 163 | 163 | zCI = 0; |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | + assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); | |
| 167 | 168 | if( isSymbolicCI ) { |
| 168 | - if( zCI && strlen(zCI) ){ | |
| 169 | - zHeader = mprintf("%s at %s", (zD ? zD : "Files"), zCI); | |
| 170 | - }else{ | |
| 171 | - zHeader = mprintf("%s", (zD ? zD : "All Files")); | |
| 172 | - } | |
| 173 | - }else{ | |
| 174 | - if( zUuid && strlen(zUuid) ){ | |
| 175 | - zHeader = mprintf("%s at [%S]", (zD ? zD : "Files"), zUuid); | |
| 176 | - }else{ | |
| 177 | - zHeader = mprintf("%s", (zD ? zD : "All Files")); | |
| 178 | - } | |
| 169 | + zHeader = mprintf("%s at %s", (zD ? zD : "Files"), zCI); | |
| 170 | + }else if( zUuid && strlen(zUuid) ){ | |
| 171 | + zHeader = mprintf("%s at [%S]", (zD ? zD : "Files"), zUuid); | |
| 172 | + }else{ | |
| 173 | + zHeader = mprintf("%s", (zD ? zD : "All Files")); | |
| 179 | 174 | } |
| 180 | 175 | style_header("%s", zHeader); |
| 181 | 176 | fossil_free(zHeader); |
| 182 | 177 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 183 | 178 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| @@ -630,11 +625,11 @@ | ||
| 630 | 625 | HQuery sURI; /* Hyperlink */ |
| 631 | 626 | int startExpanded; /* True to start out with the tree expanded */ |
| 632 | 627 | int showDirOnly; /* Show directories only. Omit files */ |
| 633 | 628 | int nDir = 0; /* Number of directories. Used for ID attributes */ |
| 634 | 629 | char *zProjectName = db_get("project-name", 0); |
| 635 | - int isSymbolicCI = 0; | |
| 630 | + int isSymbolicCI = 0; /* ci= is a symbolic name, not a hash prefix */ | |
| 636 | 631 | char *zHeader = 0; |
| 637 | 632 | |
| 638 | 633 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 639 | 634 | if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; } |
| 640 | 635 | memset(&sTree, 0, sizeof(sTree)); |
| @@ -679,36 +674,30 @@ | ||
| 679 | 674 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 680 | 675 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 681 | 676 | rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 682 | 677 | zNow = db_text("", "SELECT datetime(mtime,toLocal())" |
| 683 | 678 | " FROM event WHERE objid=%d", rid); |
| 684 | - isSymbolicCI = (strncmp(zUuid, zCI, strlen(zCI)) != 0); | |
| 679 | + isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI)) != 0); | |
| 685 | 680 | }else{ |
| 686 | 681 | zCI = 0; |
| 687 | 682 | } |
| 688 | 683 | } |
| 689 | 684 | if( zCI==0 ){ |
| 690 | 685 | rNow = db_double(0.0, "SELECT max(mtime) FROM event"); |
| 691 | 686 | zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); |
| 692 | 687 | } |
| 693 | 688 | |
| 689 | + assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); | |
| 694 | 690 | if( isSymbolicCI ) { |
| 695 | - if( zCI && strlen(zCI) ){ | |
| 696 | - zHeader = mprintf("%s at %s", | |
| 697 | - (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zCI); | |
| 698 | - }else{ | |
| 699 | - zHeader = mprintf("%s", | |
| 700 | - (zD ? zD : (showDirOnly ? "All Folders Hierarchy" : "All Files Tree-View"))); | |
| 701 | - } | |
| 702 | - }else{ | |
| 703 | - if( zUuid && strlen(zUuid) ){ | |
| 704 | - zHeader = mprintf("%s at [%S]", | |
| 705 | - (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zUuid); | |
| 706 | - }else{ | |
| 707 | - zHeader = mprintf("%s", | |
| 708 | - (zD ? zD : (showDirOnly ? "All Folders Hierarchy" : "All Files Tree-View"))); | |
| 709 | - } | |
| 691 | + zHeader = mprintf("%s at %s", | |
| 692 | + (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zCI); | |
| 693 | + }else if( zUuid && strlen(zUuid) ){ | |
| 694 | + zHeader = mprintf("%s at [%S]", | |
| 695 | + (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zUuid); | |
| 696 | + }else{ | |
| 697 | + zHeader = mprintf("%s", | |
| 698 | + (zD ? zD : (showDirOnly ?"All Folders Hierarchy":"All Files Tree-View"))); | |
| 710 | 699 | } |
| 711 | 700 | style_header("%s", zHeader); |
| 712 | 701 | fossil_free(zHeader); |
| 713 | 702 | |
| 714 | 703 | /* Compute the title of the page */ |
| 715 | 704 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -133,11 +133,11 @@ | |
| 133 | Manifest *pM = 0; |
| 134 | const char *zSubdirLink; |
| 135 | int linkTrunk = 1; |
| 136 | int linkTip = 1; |
| 137 | HQuery sURI; |
| 138 | int isSymbolicCI = 0; |
| 139 | char *zHeader = 0; |
| 140 | |
| 141 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 142 | if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; } |
| 143 | login_check_credentials(); |
| @@ -156,28 +156,23 @@ | |
| 156 | if( pM ){ |
| 157 | int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); |
| 158 | linkTrunk = trunkRid && rid != trunkRid; |
| 159 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 160 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 161 | isSymbolicCI = (strncmp(zUuid, zCI, strlen(zCI)) != 0); |
| 162 | }else{ |
| 163 | zCI = 0; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | if( isSymbolicCI ) { |
| 168 | if( zCI && strlen(zCI) ){ |
| 169 | zHeader = mprintf("%s at %s", (zD ? zD : "Files"), zCI); |
| 170 | }else{ |
| 171 | zHeader = mprintf("%s", (zD ? zD : "All Files")); |
| 172 | } |
| 173 | }else{ |
| 174 | if( zUuid && strlen(zUuid) ){ |
| 175 | zHeader = mprintf("%s at [%S]", (zD ? zD : "Files"), zUuid); |
| 176 | }else{ |
| 177 | zHeader = mprintf("%s", (zD ? zD : "All Files")); |
| 178 | } |
| 179 | } |
| 180 | style_header("%s", zHeader); |
| 181 | fossil_free(zHeader); |
| 182 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 183 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| @@ -630,11 +625,11 @@ | |
| 630 | HQuery sURI; /* Hyperlink */ |
| 631 | int startExpanded; /* True to start out with the tree expanded */ |
| 632 | int showDirOnly; /* Show directories only. Omit files */ |
| 633 | int nDir = 0; /* Number of directories. Used for ID attributes */ |
| 634 | char *zProjectName = db_get("project-name", 0); |
| 635 | int isSymbolicCI = 0; |
| 636 | char *zHeader = 0; |
| 637 | |
| 638 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 639 | if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; } |
| 640 | memset(&sTree, 0, sizeof(sTree)); |
| @@ -679,36 +674,30 @@ | |
| 679 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 680 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 681 | rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 682 | zNow = db_text("", "SELECT datetime(mtime,toLocal())" |
| 683 | " FROM event WHERE objid=%d", rid); |
| 684 | isSymbolicCI = (strncmp(zUuid, zCI, strlen(zCI)) != 0); |
| 685 | }else{ |
| 686 | zCI = 0; |
| 687 | } |
| 688 | } |
| 689 | if( zCI==0 ){ |
| 690 | rNow = db_double(0.0, "SELECT max(mtime) FROM event"); |
| 691 | zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); |
| 692 | } |
| 693 | |
| 694 | if( isSymbolicCI ) { |
| 695 | if( zCI && strlen(zCI) ){ |
| 696 | zHeader = mprintf("%s at %s", |
| 697 | (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zCI); |
| 698 | }else{ |
| 699 | zHeader = mprintf("%s", |
| 700 | (zD ? zD : (showDirOnly ? "All Folders Hierarchy" : "All Files Tree-View"))); |
| 701 | } |
| 702 | }else{ |
| 703 | if( zUuid && strlen(zUuid) ){ |
| 704 | zHeader = mprintf("%s at [%S]", |
| 705 | (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zUuid); |
| 706 | }else{ |
| 707 | zHeader = mprintf("%s", |
| 708 | (zD ? zD : (showDirOnly ? "All Folders Hierarchy" : "All Files Tree-View"))); |
| 709 | } |
| 710 | } |
| 711 | style_header("%s", zHeader); |
| 712 | fossil_free(zHeader); |
| 713 | |
| 714 | /* Compute the title of the page */ |
| 715 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -133,11 +133,11 @@ | |
| 133 | Manifest *pM = 0; |
| 134 | const char *zSubdirLink; |
| 135 | int linkTrunk = 1; |
| 136 | int linkTip = 1; |
| 137 | HQuery sURI; |
| 138 | int isSymbolicCI = 0; /* ci= is symbolic name, not a hash prefix */ |
| 139 | char *zHeader = 0; |
| 140 | |
| 141 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 142 | if( strcmp(PD("type","flat"),"tree")==0 ){ page_tree(); return; } |
| 143 | login_check_credentials(); |
| @@ -156,28 +156,23 @@ | |
| 156 | if( pM ){ |
| 157 | int trunkRid = symbolic_name_to_rid("tag:trunk", "ci"); |
| 158 | linkTrunk = trunkRid && rid != trunkRid; |
| 159 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 160 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 161 | isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI))!=0); |
| 162 | }else{ |
| 163 | zCI = 0; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); |
| 168 | if( isSymbolicCI ) { |
| 169 | zHeader = mprintf("%s at %s", (zD ? zD : "Files"), zCI); |
| 170 | }else if( zUuid && strlen(zUuid) ){ |
| 171 | zHeader = mprintf("%s at [%S]", (zD ? zD : "Files"), zUuid); |
| 172 | }else{ |
| 173 | zHeader = mprintf("%s", (zD ? zD : "All Files")); |
| 174 | } |
| 175 | style_header("%s", zHeader); |
| 176 | fossil_free(zHeader); |
| 177 | style_adunit_config(ADUNIT_RIGHT_OK); |
| 178 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| @@ -630,11 +625,11 @@ | |
| 625 | HQuery sURI; /* Hyperlink */ |
| 626 | int startExpanded; /* True to start out with the tree expanded */ |
| 627 | int showDirOnly; /* Show directories only. Omit files */ |
| 628 | int nDir = 0; /* Number of directories. Used for ID attributes */ |
| 629 | char *zProjectName = db_get("project-name", 0); |
| 630 | int isSymbolicCI = 0; /* ci= is a symbolic name, not a hash prefix */ |
| 631 | char *zHeader = 0; |
| 632 | |
| 633 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 634 | if( strcmp(PD("type","flat"),"flat")==0 ){ page_dir(); return; } |
| 635 | memset(&sTree, 0, sizeof(sTree)); |
| @@ -679,36 +674,30 @@ | |
| 674 | linkTip = rid != symbolic_name_to_rid("tip", "ci"); |
| 675 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 676 | rNow = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid); |
| 677 | zNow = db_text("", "SELECT datetime(mtime,toLocal())" |
| 678 | " FROM event WHERE objid=%d", rid); |
| 679 | isSymbolicCI = (sqlite3_strnicmp(zUuid, zCI, strlen(zCI)) != 0); |
| 680 | }else{ |
| 681 | zCI = 0; |
| 682 | } |
| 683 | } |
| 684 | if( zCI==0 ){ |
| 685 | rNow = db_double(0.0, "SELECT max(mtime) FROM event"); |
| 686 | zNow = db_text("", "SELECT datetime(max(mtime),toLocal()) FROM event"); |
| 687 | } |
| 688 | |
| 689 | assert( isSymbolicCI==0 || (zCI!=0 && zCI[0]!=0) ); |
| 690 | if( isSymbolicCI ) { |
| 691 | zHeader = mprintf("%s at %s", |
| 692 | (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zCI); |
| 693 | }else if( zUuid && strlen(zUuid) ){ |
| 694 | zHeader = mprintf("%s at [%S]", |
| 695 | (zD ? zD : (showDirOnly ? "Folder Hierarchy" : "Tree-View")), zUuid); |
| 696 | }else{ |
| 697 | zHeader = mprintf("%s", |
| 698 | (zD ? zD : (showDirOnly ?"All Folders Hierarchy":"All Files Tree-View"))); |
| 699 | } |
| 700 | style_header("%s", zHeader); |
| 701 | fossil_free(zHeader); |
| 702 | |
| 703 | /* Compute the title of the page */ |
| 704 |
+12
-29
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1340,34 +1340,22 @@ | ||
| 1340 | 1340 | |
| 1341 | 1341 | /* |
| 1342 | 1342 | ** Possible flags for the second parameter to |
| 1343 | 1343 | ** object_description() |
| 1344 | 1344 | */ |
| 1345 | -#define OBJDESC_DETAIL 0x0001 /* more detail */ | |
| 1345 | +#define OBJDESC_DETAIL 0x0001 /* Show more detail */ | |
| 1346 | 1346 | #define OBJDESC_BASE 0x0002 /* Set <base> using this object */ |
| 1347 | 1347 | #endif |
| 1348 | 1348 | |
| 1349 | 1349 | /* |
| 1350 | 1350 | ** Write a description of an object to the www reply. |
| 1351 | -** | |
| 1352 | -** If the object is a file then mention: | |
| 1353 | -** | |
| 1354 | -** * It's artifact ID | |
| 1355 | -** * All its filenames | |
| 1356 | -** * The check-in it was part of, with times and users | |
| 1357 | -** | |
| 1358 | -** If the object is a manifest, then mention: | |
| 1359 | -** | |
| 1360 | -** * It's artifact ID | |
| 1361 | -** * date of check-in | |
| 1362 | -** * Comment & user | |
| 1363 | 1351 | */ |
| 1364 | 1352 | int object_description( |
| 1365 | - int rid, /* The artifact ID */ | |
| 1353 | + int rid, /* The artifact ID for the object to describe */ | |
| 1366 | 1354 | u32 objdescFlags, /* Flags to control display */ |
| 1367 | - const char *zFileName, /* Explicit file name or 0 */ | |
| 1368 | - Blob *pDownloadName /* Fill with an appropriate download name */ | |
| 1355 | + const char *zFileName, /* For file objects, use this name. Can be NULL */ | |
| 1356 | + Blob *pDownloadName /* Fill with a good download name. Can be NULL */ | |
| 1369 | 1357 | ){ |
| 1370 | 1358 | Stmt q; |
| 1371 | 1359 | int cnt = 0; |
| 1372 | 1360 | int nWiki = 0; |
| 1373 | 1361 | int objType = 0; |
| @@ -2139,27 +2127,26 @@ | ||
| 2139 | 2127 | const char *zName = P("name"); |
| 2140 | 2128 | const char *zCI = P("ci"); |
| 2141 | 2129 | HQuery url; |
| 2142 | 2130 | Blob dirname; |
| 2143 | 2131 | char *zCIUuid = 0; |
| 2144 | - int isSymbolicCI = 0; | |
| 2132 | + int isSymbolicCI = 0; /* ci= exists and is a symbolic name, not a hash */ | |
| 2145 | 2133 | char *zHeader = 0; |
| 2146 | 2134 | |
| 2135 | + login_check_credentials(); | |
| 2136 | + if( !g.perm.Read ){ login_needed(g.anon.Read); return; } | |
| 2137 | + url_initialize(&url, g.zPath); | |
| 2147 | 2138 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 2148 | 2139 | if( zCI ){ |
| 2149 | - login_check_credentials(); | |
| 2150 | - if( !g.perm.Read ){ login_needed(g.anon.Read); return; } | |
| 2151 | - | |
| 2152 | 2140 | blob_zero(&dirname); |
| 2153 | 2141 | hyperlinked_path(zName, &dirname, zCI, "dir", ""); |
| 2154 | 2142 | blob_reset(&dirname); |
| 2155 | 2143 | |
| 2156 | 2144 | if( name_to_uuid2(zCI, "ci", &zCIUuid) ){ |
| 2157 | 2145 | isSymbolicCI = (strncmp(zCIUuid, zCI, strlen(zCI)) != 0); |
| 2158 | 2146 | } |
| 2159 | 2147 | } |
| 2160 | - url_initialize(&url, g.zPath); | |
| 2161 | 2148 | if( isFile && zName ) { |
| 2162 | 2149 | rid = artifact_from_ci_and_filename(0, "name"); |
| 2163 | 2150 | }else{ |
| 2164 | 2151 | rid = artifact_from_ci_and_filename(&url, 0); |
| 2165 | 2152 | } |
| @@ -2207,12 +2194,10 @@ | ||
| 2207 | 2194 | }else{ |
| 2208 | 2195 | rid = name_to_rid_www("name"); |
| 2209 | 2196 | } |
| 2210 | 2197 | } |
| 2211 | 2198 | |
| 2212 | - login_check_credentials(); | |
| 2213 | - if( !g.perm.Read ){ login_needed(g.anon.Read); return; } | |
| 2214 | 2199 | if( rid==0 ){ |
| 2215 | 2200 | style_header("No such artifact"); |
| 2216 | 2201 | @ Artifact '%h(zName)' does not exist in this repository. |
| 2217 | 2202 | style_footer(); |
| 2218 | 2203 | return; |
| @@ -2264,16 +2249,14 @@ | ||
| 2264 | 2249 | style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); |
| 2265 | 2250 | } |
| 2266 | 2251 | } |
| 2267 | 2252 | |
| 2268 | 2253 | if( isFile ){ |
| 2269 | - if( zCI ){ | |
| 2270 | - if( isSymbolicCI ){ | |
| 2271 | - zHeader = mprintf("%s at %s", file_tail(zName), zCI); | |
| 2272 | - }else{ | |
| 2273 | - zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid); | |
| 2274 | - } | |
| 2254 | + if( isSymbolicCI ){ | |
| 2255 | + zHeader = mprintf("%s at %s", file_tail(zName), zCI); | |
| 2256 | + }else if( zCI ){ | |
| 2257 | + zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid); | |
| 2275 | 2258 | }else{ |
| 2276 | 2259 | zHeader = mprintf("%s", file_tail(zName)); |
| 2277 | 2260 | } |
| 2278 | 2261 | }else if( descOnly ){ |
| 2279 | 2262 | zHeader = mprintf("Artifact Description [%S]", zUuid); |
| 2280 | 2263 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1340,34 +1340,22 @@ | |
| 1340 | |
| 1341 | /* |
| 1342 | ** Possible flags for the second parameter to |
| 1343 | ** object_description() |
| 1344 | */ |
| 1345 | #define OBJDESC_DETAIL 0x0001 /* more detail */ |
| 1346 | #define OBJDESC_BASE 0x0002 /* Set <base> using this object */ |
| 1347 | #endif |
| 1348 | |
| 1349 | /* |
| 1350 | ** Write a description of an object to the www reply. |
| 1351 | ** |
| 1352 | ** If the object is a file then mention: |
| 1353 | ** |
| 1354 | ** * It's artifact ID |
| 1355 | ** * All its filenames |
| 1356 | ** * The check-in it was part of, with times and users |
| 1357 | ** |
| 1358 | ** If the object is a manifest, then mention: |
| 1359 | ** |
| 1360 | ** * It's artifact ID |
| 1361 | ** * date of check-in |
| 1362 | ** * Comment & user |
| 1363 | */ |
| 1364 | int object_description( |
| 1365 | int rid, /* The artifact ID */ |
| 1366 | u32 objdescFlags, /* Flags to control display */ |
| 1367 | const char *zFileName, /* Explicit file name or 0 */ |
| 1368 | Blob *pDownloadName /* Fill with an appropriate download name */ |
| 1369 | ){ |
| 1370 | Stmt q; |
| 1371 | int cnt = 0; |
| 1372 | int nWiki = 0; |
| 1373 | int objType = 0; |
| @@ -2139,27 +2127,26 @@ | |
| 2139 | const char *zName = P("name"); |
| 2140 | const char *zCI = P("ci"); |
| 2141 | HQuery url; |
| 2142 | Blob dirname; |
| 2143 | char *zCIUuid = 0; |
| 2144 | int isSymbolicCI = 0; |
| 2145 | char *zHeader = 0; |
| 2146 | |
| 2147 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 2148 | if( zCI ){ |
| 2149 | login_check_credentials(); |
| 2150 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 2151 | |
| 2152 | blob_zero(&dirname); |
| 2153 | hyperlinked_path(zName, &dirname, zCI, "dir", ""); |
| 2154 | blob_reset(&dirname); |
| 2155 | |
| 2156 | if( name_to_uuid2(zCI, "ci", &zCIUuid) ){ |
| 2157 | isSymbolicCI = (strncmp(zCIUuid, zCI, strlen(zCI)) != 0); |
| 2158 | } |
| 2159 | } |
| 2160 | url_initialize(&url, g.zPath); |
| 2161 | if( isFile && zName ) { |
| 2162 | rid = artifact_from_ci_and_filename(0, "name"); |
| 2163 | }else{ |
| 2164 | rid = artifact_from_ci_and_filename(&url, 0); |
| 2165 | } |
| @@ -2207,12 +2194,10 @@ | |
| 2207 | }else{ |
| 2208 | rid = name_to_rid_www("name"); |
| 2209 | } |
| 2210 | } |
| 2211 | |
| 2212 | login_check_credentials(); |
| 2213 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 2214 | if( rid==0 ){ |
| 2215 | style_header("No such artifact"); |
| 2216 | @ Artifact '%h(zName)' does not exist in this repository. |
| 2217 | style_footer(); |
| 2218 | return; |
| @@ -2264,16 +2249,14 @@ | |
| 2264 | style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); |
| 2265 | } |
| 2266 | } |
| 2267 | |
| 2268 | if( isFile ){ |
| 2269 | if( zCI ){ |
| 2270 | if( isSymbolicCI ){ |
| 2271 | zHeader = mprintf("%s at %s", file_tail(zName), zCI); |
| 2272 | }else{ |
| 2273 | zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid); |
| 2274 | } |
| 2275 | }else{ |
| 2276 | zHeader = mprintf("%s", file_tail(zName)); |
| 2277 | } |
| 2278 | }else if( descOnly ){ |
| 2279 | zHeader = mprintf("Artifact Description [%S]", zUuid); |
| 2280 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1340,34 +1340,22 @@ | |
| 1340 | |
| 1341 | /* |
| 1342 | ** Possible flags for the second parameter to |
| 1343 | ** object_description() |
| 1344 | */ |
| 1345 | #define OBJDESC_DETAIL 0x0001 /* Show more detail */ |
| 1346 | #define OBJDESC_BASE 0x0002 /* Set <base> using this object */ |
| 1347 | #endif |
| 1348 | |
| 1349 | /* |
| 1350 | ** Write a description of an object to the www reply. |
| 1351 | */ |
| 1352 | int object_description( |
| 1353 | int rid, /* The artifact ID for the object to describe */ |
| 1354 | u32 objdescFlags, /* Flags to control display */ |
| 1355 | const char *zFileName, /* For file objects, use this name. Can be NULL */ |
| 1356 | Blob *pDownloadName /* Fill with a good download name. Can be NULL */ |
| 1357 | ){ |
| 1358 | Stmt q; |
| 1359 | int cnt = 0; |
| 1360 | int nWiki = 0; |
| 1361 | int objType = 0; |
| @@ -2139,27 +2127,26 @@ | |
| 2127 | const char *zName = P("name"); |
| 2128 | const char *zCI = P("ci"); |
| 2129 | HQuery url; |
| 2130 | Blob dirname; |
| 2131 | char *zCIUuid = 0; |
| 2132 | int isSymbolicCI = 0; /* ci= exists and is a symbolic name, not a hash */ |
| 2133 | char *zHeader = 0; |
| 2134 | |
| 2135 | login_check_credentials(); |
| 2136 | if( !g.perm.Read ){ login_needed(g.anon.Read); return; } |
| 2137 | url_initialize(&url, g.zPath); |
| 2138 | if( zCI && strlen(zCI)==0 ){ zCI = 0; } |
| 2139 | if( zCI ){ |
| 2140 | blob_zero(&dirname); |
| 2141 | hyperlinked_path(zName, &dirname, zCI, "dir", ""); |
| 2142 | blob_reset(&dirname); |
| 2143 | |
| 2144 | if( name_to_uuid2(zCI, "ci", &zCIUuid) ){ |
| 2145 | isSymbolicCI = (strncmp(zCIUuid, zCI, strlen(zCI)) != 0); |
| 2146 | } |
| 2147 | } |
| 2148 | if( isFile && zName ) { |
| 2149 | rid = artifact_from_ci_and_filename(0, "name"); |
| 2150 | }else{ |
| 2151 | rid = artifact_from_ci_and_filename(&url, 0); |
| 2152 | } |
| @@ -2207,12 +2194,10 @@ | |
| 2194 | }else{ |
| 2195 | rid = name_to_rid_www("name"); |
| 2196 | } |
| 2197 | } |
| 2198 | |
| 2199 | if( rid==0 ){ |
| 2200 | style_header("No such artifact"); |
| 2201 | @ Artifact '%h(zName)' does not exist in this repository. |
| 2202 | style_footer(); |
| 2203 | return; |
| @@ -2264,16 +2249,14 @@ | |
| 2249 | style_submenu_element("Shun", "%s/shun?shun=%s#addshun", g.zTop, zUuid); |
| 2250 | } |
| 2251 | } |
| 2252 | |
| 2253 | if( isFile ){ |
| 2254 | if( isSymbolicCI ){ |
| 2255 | zHeader = mprintf("%s at %s", file_tail(zName), zCI); |
| 2256 | }else if( zCI ){ |
| 2257 | zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid); |
| 2258 | }else{ |
| 2259 | zHeader = mprintf("%s", file_tail(zName)); |
| 2260 | } |
| 2261 | }else if( descOnly ){ |
| 2262 | zHeader = mprintf("Artifact Description [%S]", zUuid); |
| 2263 |