Fossil SCM
Fix annotate_file() so that it correctly errors out if the named file does not exist in the revision.
Commit
ae73e4ed327e46939f82a31544b1e579bc93c400e199a3bed4ad420313cad479
Parent
f488a5aa97a3b15…
1 file changed
+12
-1
+12
-1
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2216,10 +2216,12 @@ | ||
| 2216 | 2216 | Stmt q; /* Query returning all ancestor versions */ |
| 2217 | 2217 | int cnt = 0; /* Number of versions analyzed */ |
| 2218 | 2218 | int iLimit; /* Maximum number of versions to analyze */ |
| 2219 | 2219 | sqlite3_int64 mxTime; /* Halt at this time if not already complete */ |
| 2220 | 2220 | |
| 2221 | + memset(p, 0, sizeof(*p)); | |
| 2222 | + | |
| 2221 | 2223 | if( zLimit ){ |
| 2222 | 2224 | if( strcmp(zLimit,"none")==0 ){ |
| 2223 | 2225 | iLimit = 0; |
| 2224 | 2226 | mxTime = 0; |
| 2225 | 2227 | }else if( sqlite3_strglob("*[0-9]s", zLimit)==0 ){ |
| @@ -2235,11 +2237,11 @@ | ||
| 2235 | 2237 | iLimit = 0; |
| 2236 | 2238 | mxTime = current_time_in_milliseconds()+1000; |
| 2237 | 2239 | } |
| 2238 | 2240 | db_begin_transaction(); |
| 2239 | 2241 | |
| 2240 | - /* Get the artificate ID for the check-in begin analyzed */ | |
| 2242 | + /* Get the artifact ID for the check-in begin analyzed */ | |
| 2241 | 2243 | if( zRevision ){ |
| 2242 | 2244 | cid = name_to_typed_rid(zRevision, "ci"); |
| 2243 | 2245 | }else{ |
| 2244 | 2246 | db_must_be_within_tree(); |
| 2245 | 2247 | cid = db_lget_int("checkout", 0); |
| @@ -2308,10 +2310,19 @@ | ||
| 2308 | 2310 | blob_reset(&step); |
| 2309 | 2311 | } |
| 2310 | 2312 | p->nVers++; |
| 2311 | 2313 | cnt++; |
| 2312 | 2314 | } |
| 2315 | + | |
| 2316 | + if( p->nVers==0 ){ | |
| 2317 | + if( zRevision ){ | |
| 2318 | + fossil_fatal("file %s does not exist in check-in %s", zFilename, zRevision); | |
| 2319 | + }else{ | |
| 2320 | + fossil_fatal("no history for file: %s", zFilename); | |
| 2321 | + } | |
| 2322 | + } | |
| 2323 | + | |
| 2313 | 2324 | db_finalize(&q); |
| 2314 | 2325 | db_end_transaction(0); |
| 2315 | 2326 | } |
| 2316 | 2327 | |
| 2317 | 2328 | /* |
| 2318 | 2329 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2216,10 +2216,12 @@ | |
| 2216 | Stmt q; /* Query returning all ancestor versions */ |
| 2217 | int cnt = 0; /* Number of versions analyzed */ |
| 2218 | int iLimit; /* Maximum number of versions to analyze */ |
| 2219 | sqlite3_int64 mxTime; /* Halt at this time if not already complete */ |
| 2220 | |
| 2221 | if( zLimit ){ |
| 2222 | if( strcmp(zLimit,"none")==0 ){ |
| 2223 | iLimit = 0; |
| 2224 | mxTime = 0; |
| 2225 | }else if( sqlite3_strglob("*[0-9]s", zLimit)==0 ){ |
| @@ -2235,11 +2237,11 @@ | |
| 2235 | iLimit = 0; |
| 2236 | mxTime = current_time_in_milliseconds()+1000; |
| 2237 | } |
| 2238 | db_begin_transaction(); |
| 2239 | |
| 2240 | /* Get the artificate ID for the check-in begin analyzed */ |
| 2241 | if( zRevision ){ |
| 2242 | cid = name_to_typed_rid(zRevision, "ci"); |
| 2243 | }else{ |
| 2244 | db_must_be_within_tree(); |
| 2245 | cid = db_lget_int("checkout", 0); |
| @@ -2308,10 +2310,19 @@ | |
| 2308 | blob_reset(&step); |
| 2309 | } |
| 2310 | p->nVers++; |
| 2311 | cnt++; |
| 2312 | } |
| 2313 | db_finalize(&q); |
| 2314 | db_end_transaction(0); |
| 2315 | } |
| 2316 | |
| 2317 | /* |
| 2318 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2216,10 +2216,12 @@ | |
| 2216 | Stmt q; /* Query returning all ancestor versions */ |
| 2217 | int cnt = 0; /* Number of versions analyzed */ |
| 2218 | int iLimit; /* Maximum number of versions to analyze */ |
| 2219 | sqlite3_int64 mxTime; /* Halt at this time if not already complete */ |
| 2220 | |
| 2221 | memset(p, 0, sizeof(*p)); |
| 2222 | |
| 2223 | if( zLimit ){ |
| 2224 | if( strcmp(zLimit,"none")==0 ){ |
| 2225 | iLimit = 0; |
| 2226 | mxTime = 0; |
| 2227 | }else if( sqlite3_strglob("*[0-9]s", zLimit)==0 ){ |
| @@ -2235,11 +2237,11 @@ | |
| 2237 | iLimit = 0; |
| 2238 | mxTime = current_time_in_milliseconds()+1000; |
| 2239 | } |
| 2240 | db_begin_transaction(); |
| 2241 | |
| 2242 | /* Get the artifact ID for the check-in begin analyzed */ |
| 2243 | if( zRevision ){ |
| 2244 | cid = name_to_typed_rid(zRevision, "ci"); |
| 2245 | }else{ |
| 2246 | db_must_be_within_tree(); |
| 2247 | cid = db_lget_int("checkout", 0); |
| @@ -2308,10 +2310,19 @@ | |
| 2310 | blob_reset(&step); |
| 2311 | } |
| 2312 | p->nVers++; |
| 2313 | cnt++; |
| 2314 | } |
| 2315 | |
| 2316 | if( p->nVers==0 ){ |
| 2317 | if( zRevision ){ |
| 2318 | fossil_fatal("file %s does not exist in check-in %s", zFilename, zRevision); |
| 2319 | }else{ |
| 2320 | fossil_fatal("no history for file: %s", zFilename); |
| 2321 | } |
| 2322 | } |
| 2323 | |
| 2324 | db_finalize(&q); |
| 2325 | db_end_transaction(0); |
| 2326 | } |
| 2327 | |
| 2328 | /* |
| 2329 |