Fossil SCM
Update the "annotate" command and webpage to prefer to take changes from direct ancestors of the version being analyzed, rather than more recent changes on branches.
Commit
e320f0cd797b8c0254990462603db5944b410ae6
Parent
3ba9a4d5caa9615…
1 file changed
+9
-4
+9
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -2265,11 +2265,12 @@ | ||
| 2265 | 2265 | fossil_print("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); |
| 2266 | 2266 | } |
| 2267 | 2267 | } |
| 2268 | 2268 | |
| 2269 | 2269 | /* Annotation flags */ |
| 2270 | -#define ANN_FILE_VERS 0x001 /* Show file version rather than commit version */ | |
| 2270 | +#define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ | |
| 2271 | +#define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ | |
| 2271 | 2272 | |
| 2272 | 2273 | /* |
| 2273 | 2274 | ** Compute a complete annotation on a file. The file is identified |
| 2274 | 2275 | ** by its filename number (filename.fnid) and the baseline in which |
| 2275 | 2276 | ** it was checked in (mlink.mid). |
| @@ -2306,12 +2307,14 @@ | ||
| 2306 | 2307 | " coalesce(event.euser,event.user)," |
| 2307 | 2308 | " mlink.pid" |
| 2308 | 2309 | " FROM mlink, event" |
| 2309 | 2310 | " WHERE mlink.fid=:rid" |
| 2310 | 2311 | " AND event.objid=mlink.mid" |
| 2311 | - " ORDER BY event.mtime", | |
| 2312 | - (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid" | |
| 2312 | + " ORDER BY %s event.mtime", | |
| 2313 | + (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid", | |
| 2314 | + (annFlags & ANN_FILE_ANCEST)!=0 ? | |
| 2315 | + "(mlink.mid IN (SELECT rid FROM ancestor)) DESC,":"" | |
| 2313 | 2316 | ); |
| 2314 | 2317 | |
| 2315 | 2318 | db_bind_int(&q, ":rid", rid); |
| 2316 | 2319 | if( iLimit==0 ) iLimit = 1000000000; |
| 2317 | 2320 | while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ |
| @@ -2352,11 +2355,11 @@ | ||
| 2352 | 2355 | void annotation_page(void){ |
| 2353 | 2356 | int mid; |
| 2354 | 2357 | int fnid; |
| 2355 | 2358 | int i; |
| 2356 | 2359 | int iLimit; |
| 2357 | - int annFlags = 0; | |
| 2360 | + int annFlags = ANN_FILE_ANCEST; | |
| 2358 | 2361 | int showLn = 0; /* True if line numbers should be shown */ |
| 2359 | 2362 | char zLn[10]; /* Line number buffer */ |
| 2360 | 2363 | char zFormat[10]; /* Format string for line numbers */ |
| 2361 | 2364 | Annotator ann; |
| 2362 | 2365 | |
| @@ -2368,10 +2371,11 @@ | ||
| 2368 | 2371 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2369 | 2372 | iLimit = atoi(PD("limit","-1")); |
| 2370 | 2373 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2371 | 2374 | fossil_redirect_home(); |
| 2372 | 2375 | } |
| 2376 | + compute_direct_ancestors(mid, 10000000); | |
| 2373 | 2377 | style_header("File Annotation"); |
| 2374 | 2378 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2375 | 2379 | annotate_file(&ann, fnid, mid, g.perm.Hyperlink, iLimit, annFlags); |
| 2376 | 2380 | if( P("log") ){ |
| 2377 | 2381 | int i; |
| @@ -2461,10 +2465,11 @@ | ||
| 2461 | 2465 | fid, fnid); |
| 2462 | 2466 | if( mid==0 ){ |
| 2463 | 2467 | fossil_panic("unable to find manifest"); |
| 2464 | 2468 | } |
| 2465 | 2469 | if( fileVers ) annFlags |= ANN_FILE_VERS; |
| 2470 | + annFlags |= ANN_FILE_ANCEST; | |
| 2466 | 2471 | annotate_file(&ann, fnid, mid, 0, iLimit, annFlags); |
| 2467 | 2472 | if( showLog ){ |
| 2468 | 2473 | for(i=0; i<ann.nVers; i++){ |
| 2469 | 2474 | printf("version %3d: %s\n", i+1, ann.azVers[i]); |
| 2470 | 2475 | } |
| 2471 | 2476 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2265,11 +2265,12 @@ | |
| 2265 | fossil_print("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | /* Annotation flags */ |
| 2270 | #define ANN_FILE_VERS 0x001 /* Show file version rather than commit version */ |
| 2271 | |
| 2272 | /* |
| 2273 | ** Compute a complete annotation on a file. The file is identified |
| 2274 | ** by its filename number (filename.fnid) and the baseline in which |
| 2275 | ** it was checked in (mlink.mid). |
| @@ -2306,12 +2307,14 @@ | |
| 2306 | " coalesce(event.euser,event.user)," |
| 2307 | " mlink.pid" |
| 2308 | " FROM mlink, event" |
| 2309 | " WHERE mlink.fid=:rid" |
| 2310 | " AND event.objid=mlink.mid" |
| 2311 | " ORDER BY event.mtime", |
| 2312 | (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid" |
| 2313 | ); |
| 2314 | |
| 2315 | db_bind_int(&q, ":rid", rid); |
| 2316 | if( iLimit==0 ) iLimit = 1000000000; |
| 2317 | while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ |
| @@ -2352,11 +2355,11 @@ | |
| 2352 | void annotation_page(void){ |
| 2353 | int mid; |
| 2354 | int fnid; |
| 2355 | int i; |
| 2356 | int iLimit; |
| 2357 | int annFlags = 0; |
| 2358 | int showLn = 0; /* True if line numbers should be shown */ |
| 2359 | char zLn[10]; /* Line number buffer */ |
| 2360 | char zFormat[10]; /* Format string for line numbers */ |
| 2361 | Annotator ann; |
| 2362 | |
| @@ -2368,10 +2371,11 @@ | |
| 2368 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2369 | iLimit = atoi(PD("limit","-1")); |
| 2370 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2371 | fossil_redirect_home(); |
| 2372 | } |
| 2373 | style_header("File Annotation"); |
| 2374 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2375 | annotate_file(&ann, fnid, mid, g.perm.Hyperlink, iLimit, annFlags); |
| 2376 | if( P("log") ){ |
| 2377 | int i; |
| @@ -2461,10 +2465,11 @@ | |
| 2461 | fid, fnid); |
| 2462 | if( mid==0 ){ |
| 2463 | fossil_panic("unable to find manifest"); |
| 2464 | } |
| 2465 | if( fileVers ) annFlags |= ANN_FILE_VERS; |
| 2466 | annotate_file(&ann, fnid, mid, 0, iLimit, annFlags); |
| 2467 | if( showLog ){ |
| 2468 | for(i=0; i<ann.nVers; i++){ |
| 2469 | printf("version %3d: %s\n", i+1, ann.azVers[i]); |
| 2470 | } |
| 2471 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -2265,11 +2265,12 @@ | |
| 2265 | fossil_print("%10s: %.*s\n", zSrc, x.aOrig[i].n, x.aOrig[i].z); |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | /* Annotation flags */ |
| 2270 | #define ANN_FILE_VERS 0x01 /* Show file vers rather than commit vers */ |
| 2271 | #define ANN_FILE_ANCEST 0x02 /* Prefer check-ins in the ANCESTOR table */ |
| 2272 | |
| 2273 | /* |
| 2274 | ** Compute a complete annotation on a file. The file is identified |
| 2275 | ** by its filename number (filename.fnid) and the baseline in which |
| 2276 | ** it was checked in (mlink.mid). |
| @@ -2306,12 +2307,14 @@ | |
| 2307 | " coalesce(event.euser,event.user)," |
| 2308 | " mlink.pid" |
| 2309 | " FROM mlink, event" |
| 2310 | " WHERE mlink.fid=:rid" |
| 2311 | " AND event.objid=mlink.mid" |
| 2312 | " ORDER BY %s event.mtime", |
| 2313 | (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid", |
| 2314 | (annFlags & ANN_FILE_ANCEST)!=0 ? |
| 2315 | "(mlink.mid IN (SELECT rid FROM ancestor)) DESC,":"" |
| 2316 | ); |
| 2317 | |
| 2318 | db_bind_int(&q, ":rid", rid); |
| 2319 | if( iLimit==0 ) iLimit = 1000000000; |
| 2320 | while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ |
| @@ -2352,11 +2355,11 @@ | |
| 2355 | void annotation_page(void){ |
| 2356 | int mid; |
| 2357 | int fnid; |
| 2358 | int i; |
| 2359 | int iLimit; |
| 2360 | int annFlags = ANN_FILE_ANCEST; |
| 2361 | int showLn = 0; /* True if line numbers should be shown */ |
| 2362 | char zLn[10]; /* Line number buffer */ |
| 2363 | char zFormat[10]; /* Format string for line numbers */ |
| 2364 | Annotator ann; |
| 2365 | |
| @@ -2368,10 +2371,11 @@ | |
| 2371 | if( mid==0 || fnid==0 ){ fossil_redirect_home(); } |
| 2372 | iLimit = atoi(PD("limit","-1")); |
| 2373 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){ |
| 2374 | fossil_redirect_home(); |
| 2375 | } |
| 2376 | compute_direct_ancestors(mid, 10000000); |
| 2377 | style_header("File Annotation"); |
| 2378 | if( P("filevers") ) annFlags |= ANN_FILE_VERS; |
| 2379 | annotate_file(&ann, fnid, mid, g.perm.Hyperlink, iLimit, annFlags); |
| 2380 | if( P("log") ){ |
| 2381 | int i; |
| @@ -2461,10 +2465,11 @@ | |
| 2465 | fid, fnid); |
| 2466 | if( mid==0 ){ |
| 2467 | fossil_panic("unable to find manifest"); |
| 2468 | } |
| 2469 | if( fileVers ) annFlags |= ANN_FILE_VERS; |
| 2470 | annFlags |= ANN_FILE_ANCEST; |
| 2471 | annotate_file(&ann, fnid, mid, 0, iLimit, annFlags); |
| 2472 | if( showLog ){ |
| 2473 | for(i=0; i<ann.nVers; i++){ |
| 2474 | printf("version %3d: %s\n", i+1, ann.azVers[i]); |
| 2475 | } |
| 2476 |