Fossil SCM
The annotate_file() function is now closer to being correct, but is still not quote right.
Commit
54c0dab0c6e6c91bbd0527bdb80033e448a96f1b5eb592278586afeffe98d074
Parent
120ff0b8a394360…
1 file changed
+17
-32
+17
-32
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2198,11 +2198,10 @@ | ||
| 2198 | 2198 | int cid; /* Selected check-in ID */ |
| 2199 | 2199 | int mid; /* Manifest where file was most recently changed */ |
| 2200 | 2200 | int rid; /* Artifact ID of the file being annotated */ |
| 2201 | 2201 | int fnid; /* Filename ID */ |
| 2202 | 2202 | Stmt q; /* Query returning all ancestor versions */ |
| 2203 | - Stmt ins; /* Inserts into the temporary VSEEN table */ | |
| 2204 | 2203 | int cnt = 0; /* Number of versions examined */ |
| 2205 | 2204 | |
| 2206 | 2205 | /* Get artifact IDs of selected check-in and file */ |
| 2207 | 2206 | if( zRevision ){ |
| 2208 | 2207 | /* Get artifact ID of selected check-in manifest */ |
| @@ -2257,34 +2256,27 @@ | ||
| 2257 | 2256 | } |
| 2258 | 2257 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2259 | 2258 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2260 | 2259 | annotation_start(p, &toAnnotate, annFlags); |
| 2261 | 2260 | db_begin_transaction(); |
| 2262 | - db_multi_exec( | |
| 2263 | - "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" | |
| 2264 | - "DELETE FROM vseen;" | |
| 2265 | - ); | |
| 2266 | - | |
| 2267 | - db_prepare(&ins, "INSERT OR IGNORE INTO vseen(rid) VALUES(:rid)"); | |
| 2268 | - db_prepare(&q, | |
| 2269 | - "SELECT (SELECT uuid FROM blob WHERE rid=mlink.fid)," | |
| 2270 | - " (SELECT uuid FROM blob WHERE rid=mlink.mid)," | |
| 2271 | - " date(event.mtime)," | |
| 2272 | - " coalesce(event.euser,event.user)," | |
| 2273 | - " mlink.pid" | |
| 2274 | - " FROM mlink, event, ancestor" | |
| 2275 | - " WHERE mlink.fid=:rid" | |
| 2276 | - " AND event.objid=mlink.mid" | |
| 2277 | - " AND mlink.pid NOT IN vseen" | |
| 2278 | - " AND ancestor.rid=mlink.mid" | |
| 2279 | - " ORDER BY ancestor.generation;" | |
| 2280 | - ); | |
| 2281 | - | |
| 2282 | - db_bind_int(&q, ":rid", rid); | |
| 2283 | - if( iLimit==0 ) iLimit = 1000000000; | |
| 2284 | - while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ | |
| 2285 | - int prevId = db_column_int(&q, 4); | |
| 2261 | + | |
| 2262 | + db_prepare(&q, | |
| 2263 | + "SELECT DISTINCT" | |
| 2264 | + " (SELECT uuid FROM blob WHERE rid=mlink.fid)," | |
| 2265 | + " (SELECT uuid FROM blob WHERE rid=mlink.mid)," | |
| 2266 | + " date(event.mtime)," | |
| 2267 | + " coalesce(event.euser,event.user)" | |
| 2268 | + " FROM mlink, event, ancestor" | |
| 2269 | + " WHERE mlink.fnid=%d" | |
| 2270 | + " AND event.objid=mlink.mid" | |
| 2271 | + " AND ancestor.rid=mlink.mid" | |
| 2272 | + " ORDER BY ancestor.generation;", | |
| 2273 | + fnid | |
| 2274 | + ); | |
| 2275 | + | |
| 2276 | + if( iLimit==0 ) iLimit = 1000000000; | |
| 2277 | + while( iLimit>cnt && db_step(&q)==SQLITE_ROW ){ | |
| 2286 | 2278 | p->aVers = fossil_realloc(p->aVers, (p->nVers+1)*sizeof(p->aVers[0])); |
| 2287 | 2279 | p->aVers[p->nVers].zFUuid = fossil_strdup(db_column_text(&q, 0)); |
| 2288 | 2280 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2289 | 2281 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2290 | 2282 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| @@ -2293,21 +2285,14 @@ | ||
| 2293 | 2285 | blob_to_utf8_no_bom(&step, 0); |
| 2294 | 2286 | annotation_step(p, &step, p->nVers-1, annFlags); |
| 2295 | 2287 | blob_reset(&step); |
| 2296 | 2288 | } |
| 2297 | 2289 | p->nVers++; |
| 2298 | - db_bind_int(&ins, ":rid", rid); | |
| 2299 | - db_step(&ins); | |
| 2300 | - db_reset(&ins); | |
| 2301 | - db_reset(&q); | |
| 2302 | - rid = prevId; | |
| 2303 | - db_bind_int(&q, ":rid", prevId); | |
| 2304 | 2290 | cnt++; |
| 2305 | 2291 | } |
| 2306 | 2292 | p->bLimit = iLimit==cnt; |
| 2307 | 2293 | db_finalize(&q); |
| 2308 | - db_finalize(&ins); | |
| 2309 | 2294 | db_end_transaction(0); |
| 2310 | 2295 | } |
| 2311 | 2296 | |
| 2312 | 2297 | /* |
| 2313 | 2298 | ** Return a color from a gradient. |
| 2314 | 2299 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2198,11 +2198,10 @@ | |
| 2198 | int cid; /* Selected check-in ID */ |
| 2199 | int mid; /* Manifest where file was most recently changed */ |
| 2200 | int rid; /* Artifact ID of the file being annotated */ |
| 2201 | int fnid; /* Filename ID */ |
| 2202 | Stmt q; /* Query returning all ancestor versions */ |
| 2203 | Stmt ins; /* Inserts into the temporary VSEEN table */ |
| 2204 | int cnt = 0; /* Number of versions examined */ |
| 2205 | |
| 2206 | /* Get artifact IDs of selected check-in and file */ |
| 2207 | if( zRevision ){ |
| 2208 | /* Get artifact ID of selected check-in manifest */ |
| @@ -2257,34 +2256,27 @@ | |
| 2257 | } |
| 2258 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2259 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2260 | annotation_start(p, &toAnnotate, annFlags); |
| 2261 | db_begin_transaction(); |
| 2262 | db_multi_exec( |
| 2263 | "CREATE TEMP TABLE IF NOT EXISTS vseen(rid INTEGER PRIMARY KEY);" |
| 2264 | "DELETE FROM vseen;" |
| 2265 | ); |
| 2266 | |
| 2267 | db_prepare(&ins, "INSERT OR IGNORE INTO vseen(rid) VALUES(:rid)"); |
| 2268 | db_prepare(&q, |
| 2269 | "SELECT (SELECT uuid FROM blob WHERE rid=mlink.fid)," |
| 2270 | " (SELECT uuid FROM blob WHERE rid=mlink.mid)," |
| 2271 | " date(event.mtime)," |
| 2272 | " coalesce(event.euser,event.user)," |
| 2273 | " mlink.pid" |
| 2274 | " FROM mlink, event, ancestor" |
| 2275 | " WHERE mlink.fid=:rid" |
| 2276 | " AND event.objid=mlink.mid" |
| 2277 | " AND mlink.pid NOT IN vseen" |
| 2278 | " AND ancestor.rid=mlink.mid" |
| 2279 | " ORDER BY ancestor.generation;" |
| 2280 | ); |
| 2281 | |
| 2282 | db_bind_int(&q, ":rid", rid); |
| 2283 | if( iLimit==0 ) iLimit = 1000000000; |
| 2284 | while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ |
| 2285 | int prevId = db_column_int(&q, 4); |
| 2286 | p->aVers = fossil_realloc(p->aVers, (p->nVers+1)*sizeof(p->aVers[0])); |
| 2287 | p->aVers[p->nVers].zFUuid = fossil_strdup(db_column_text(&q, 0)); |
| 2288 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2289 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2290 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| @@ -2293,21 +2285,14 @@ | |
| 2293 | blob_to_utf8_no_bom(&step, 0); |
| 2294 | annotation_step(p, &step, p->nVers-1, annFlags); |
| 2295 | blob_reset(&step); |
| 2296 | } |
| 2297 | p->nVers++; |
| 2298 | db_bind_int(&ins, ":rid", rid); |
| 2299 | db_step(&ins); |
| 2300 | db_reset(&ins); |
| 2301 | db_reset(&q); |
| 2302 | rid = prevId; |
| 2303 | db_bind_int(&q, ":rid", prevId); |
| 2304 | cnt++; |
| 2305 | } |
| 2306 | p->bLimit = iLimit==cnt; |
| 2307 | db_finalize(&q); |
| 2308 | db_finalize(&ins); |
| 2309 | db_end_transaction(0); |
| 2310 | } |
| 2311 | |
| 2312 | /* |
| 2313 | ** Return a color from a gradient. |
| 2314 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2198,11 +2198,10 @@ | |
| 2198 | int cid; /* Selected check-in ID */ |
| 2199 | int mid; /* Manifest where file was most recently changed */ |
| 2200 | int rid; /* Artifact ID of the file being annotated */ |
| 2201 | int fnid; /* Filename ID */ |
| 2202 | Stmt q; /* Query returning all ancestor versions */ |
| 2203 | int cnt = 0; /* Number of versions examined */ |
| 2204 | |
| 2205 | /* Get artifact IDs of selected check-in and file */ |
| 2206 | if( zRevision ){ |
| 2207 | /* Get artifact ID of selected check-in manifest */ |
| @@ -2257,34 +2256,27 @@ | |
| 2256 | } |
| 2257 | if( iLimit<=0 ) iLimit = 1000000000; |
| 2258 | blob_to_utf8_no_bom(&toAnnotate, 0); |
| 2259 | annotation_start(p, &toAnnotate, annFlags); |
| 2260 | db_begin_transaction(); |
| 2261 | |
| 2262 | db_prepare(&q, |
| 2263 | "SELECT DISTINCT" |
| 2264 | " (SELECT uuid FROM blob WHERE rid=mlink.fid)," |
| 2265 | " (SELECT uuid FROM blob WHERE rid=mlink.mid)," |
| 2266 | " date(event.mtime)," |
| 2267 | " coalesce(event.euser,event.user)" |
| 2268 | " FROM mlink, event, ancestor" |
| 2269 | " WHERE mlink.fnid=%d" |
| 2270 | " AND event.objid=mlink.mid" |
| 2271 | " AND ancestor.rid=mlink.mid" |
| 2272 | " ORDER BY ancestor.generation;", |
| 2273 | fnid |
| 2274 | ); |
| 2275 | |
| 2276 | if( iLimit==0 ) iLimit = 1000000000; |
| 2277 | while( iLimit>cnt && db_step(&q)==SQLITE_ROW ){ |
| 2278 | p->aVers = fossil_realloc(p->aVers, (p->nVers+1)*sizeof(p->aVers[0])); |
| 2279 | p->aVers[p->nVers].zFUuid = fossil_strdup(db_column_text(&q, 0)); |
| 2280 | p->aVers[p->nVers].zMUuid = fossil_strdup(db_column_text(&q, 1)); |
| 2281 | p->aVers[p->nVers].zDate = fossil_strdup(db_column_text(&q, 2)); |
| 2282 | p->aVers[p->nVers].zUser = fossil_strdup(db_column_text(&q, 3)); |
| @@ -2293,21 +2285,14 @@ | |
| 2285 | blob_to_utf8_no_bom(&step, 0); |
| 2286 | annotation_step(p, &step, p->nVers-1, annFlags); |
| 2287 | blob_reset(&step); |
| 2288 | } |
| 2289 | p->nVers++; |
| 2290 | cnt++; |
| 2291 | } |
| 2292 | p->bLimit = iLimit==cnt; |
| 2293 | db_finalize(&q); |
| 2294 | db_end_transaction(0); |
| 2295 | } |
| 2296 | |
| 2297 | /* |
| 2298 | ** Return a color from a gradient. |
| 2299 |