Fossil SCM

The /file page for a file that is not part of the latest checkin tries to substitute the most recent checking that added the file.

drh 2020-10-20 23:37 trunk
Commit 5cf5ad8491c97b09aa992135bbf20c0e8f5aa0f1f3d03a02ad76e379928e9bd3
1 file changed +26 -4
+26 -4
--- src/info.c
+++ src/info.c
@@ -2284,10 +2284,11 @@
22842284
rid = artifact_from_ci_and_filename(0);
22852285
}
22862286
22872287
if( rid==0 ){ /* Artifact not found */
22882288
if( isFile ){
2289
+ Stmt q;
22892290
/* For /file, also check to see if name= refers to a directory,
22902291
** and if so, do a listing for that directory */
22912292
int nName = (int)strlen(zName);
22922293
if( nName && zName[nName-1]=='/' ) nName--;
22932294
if( db_exists(
@@ -2297,18 +2298,39 @@
22972298
) ){
22982299
if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
22992300
page_tree();
23002301
return;
23012302
}
2302
- style_header("No such file");
2303
- @ File '%h(zName)' does not exist in this repository.
2303
+ /* No directory found, look for an historic version of the file
2304
+ ** that was subsequently deleted. */
2305
+ db_prepare(&q,
2306
+ "SELECT fid, uuid FROM mlink, filename, event, blob"
2307
+ " WHERE filename.name=%Q"
2308
+ " AND mlink.fnid=filename.fnid AND mlink.fid>0"
2309
+ " AND event.objid=mlink.mid"
2310
+ " AND blob.rid=mlink.mid"
2311
+ " ORDER BY event.mtime DESC",
2312
+ zName
2313
+ );
2314
+ if( db_step(&q)==SQLITE_ROW ){
2315
+ rid = db_column_int(&q, 0);
2316
+ zCIUuid = zCI = fossil_strdup(db_column_text(&q, 1));
2317
+ url_add_parameter(&url, "ci", zCI);
2318
+ }
2319
+ db_finalize(&q);
2320
+ if( rid==0 ){
2321
+ style_header("No such file");
2322
+ @ File '%h(zName)' does not exist in this repository.
2323
+ }
23042324
}else{
23052325
style_header("No such artifact");
23062326
@ Artifact '%h(zName)' does not exist in this repository.
23072327
}
2308
- style_footer();
2309
- return;
2328
+ if( rid==0 ){
2329
+ style_footer();
2330
+ return;
2331
+ }
23102332
}
23112333
23122334
if( descOnly || P("verbose")!=0 ){
23132335
url_add_parameter(&url, "verbose", "1");
23142336
objdescFlags |= OBJDESC_DETAIL;
23152337
--- src/info.c
+++ src/info.c
@@ -2284,10 +2284,11 @@
2284 rid = artifact_from_ci_and_filename(0);
2285 }
2286
2287 if( rid==0 ){ /* Artifact not found */
2288 if( isFile ){
 
2289 /* For /file, also check to see if name= refers to a directory,
2290 ** and if so, do a listing for that directory */
2291 int nName = (int)strlen(zName);
2292 if( nName && zName[nName-1]=='/' ) nName--;
2293 if( db_exists(
@@ -2297,18 +2298,39 @@
2297 ) ){
2298 if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
2299 page_tree();
2300 return;
2301 }
2302 style_header("No such file");
2303 @ File '%h(zName)' does not exist in this repository.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2304 }else{
2305 style_header("No such artifact");
2306 @ Artifact '%h(zName)' does not exist in this repository.
2307 }
2308 style_footer();
2309 return;
 
 
2310 }
2311
2312 if( descOnly || P("verbose")!=0 ){
2313 url_add_parameter(&url, "verbose", "1");
2314 objdescFlags |= OBJDESC_DETAIL;
2315
--- src/info.c
+++ src/info.c
@@ -2284,10 +2284,11 @@
2284 rid = artifact_from_ci_and_filename(0);
2285 }
2286
2287 if( rid==0 ){ /* Artifact not found */
2288 if( isFile ){
2289 Stmt q;
2290 /* For /file, also check to see if name= refers to a directory,
2291 ** and if so, do a listing for that directory */
2292 int nName = (int)strlen(zName);
2293 if( nName && zName[nName-1]=='/' ) nName--;
2294 if( db_exists(
@@ -2297,18 +2298,39 @@
2298 ) ){
2299 if( P("ci")==0 ) cgi_set_query_parameter("ci","tip");
2300 page_tree();
2301 return;
2302 }
2303 /* No directory found, look for an historic version of the file
2304 ** that was subsequently deleted. */
2305 db_prepare(&q,
2306 "SELECT fid, uuid FROM mlink, filename, event, blob"
2307 " WHERE filename.name=%Q"
2308 " AND mlink.fnid=filename.fnid AND mlink.fid>0"
2309 " AND event.objid=mlink.mid"
2310 " AND blob.rid=mlink.mid"
2311 " ORDER BY event.mtime DESC",
2312 zName
2313 );
2314 if( db_step(&q)==SQLITE_ROW ){
2315 rid = db_column_int(&q, 0);
2316 zCIUuid = zCI = fossil_strdup(db_column_text(&q, 1));
2317 url_add_parameter(&url, "ci", zCI);
2318 }
2319 db_finalize(&q);
2320 if( rid==0 ){
2321 style_header("No such file");
2322 @ File '%h(zName)' does not exist in this repository.
2323 }
2324 }else{
2325 style_header("No such artifact");
2326 @ Artifact '%h(zName)' does not exist in this repository.
2327 }
2328 if( rid==0 ){
2329 style_footer();
2330 return;
2331 }
2332 }
2333
2334 if( descOnly || P("verbose")!=0 ){
2335 url_add_parameter(&url, "verbose", "1");
2336 objdescFlags |= OBJDESC_DETAIL;
2337

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button