Fossil SCM
Add the --sql option to the timeline command.
Commit
d51ca5f567349b4845405812e9e1879af1d8992ecf7805f52e76ab58f820b56d
Parent
b70034837382b06…
1 file changed
+7
-1
+7
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -2336,10 +2336,11 @@ | ||
| 2336 | 2336 | ** N is negative, output the first -N lines. If N is |
| 2337 | 2337 | ** zero, no limit. Default is -20 meaning 20 lines. |
| 2338 | 2338 | ** -p|--path PATH Output items affecting PATH only. |
| 2339 | 2339 | ** PATH can be a file or a sub directory. |
| 2340 | 2340 | ** --offset P skip P changes |
| 2341 | +** --sql Show the SQL used to generate the timeline | |
| 2341 | 2342 | ** -t|--type TYPE Output items from the given types only, such as: |
| 2342 | 2343 | ** ci = file commits only |
| 2343 | 2344 | ** e = technical notes only |
| 2344 | 2345 | ** t = tickets only |
| 2345 | 2346 | ** w = wiki commits only |
| @@ -2367,10 +2368,11 @@ | ||
| 2367 | 2368 | int mode = TIMELINE_MODE_NONE; |
| 2368 | 2369 | int verboseFlag = 0 ; |
| 2369 | 2370 | int iOffset; |
| 2370 | 2371 | const char *zFilePattern = 0; |
| 2371 | 2372 | Blob treeName; |
| 2373 | + int showSql = 0; | |
| 2372 | 2374 | |
| 2373 | 2375 | verboseFlag = find_option("verbose","v", 0)!=0; |
| 2374 | 2376 | if( !verboseFlag){ |
| 2375 | 2377 | verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */ |
| 2376 | 2378 | } |
| @@ -2377,10 +2379,11 @@ | ||
| 2377 | 2379 | db_find_and_open_repository(0, 0); |
| 2378 | 2380 | zLimit = find_option("limit","n",1); |
| 2379 | 2381 | zWidth = find_option("width","W",1); |
| 2380 | 2382 | zType = find_option("type","t",1); |
| 2381 | 2383 | zFilePattern = find_option("path","p",1); |
| 2384 | + showSql = find_option("sql",0,0)!=0; | |
| 2382 | 2385 | |
| 2383 | 2386 | if( !zLimit ){ |
| 2384 | 2387 | zLimit = find_option("count",0,1); |
| 2385 | 2388 | } |
| 2386 | 2389 | if( zLimit ){ |
| @@ -2520,11 +2523,14 @@ | ||
| 2520 | 2523 | if( iOffset>0 ){ |
| 2521 | 2524 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 2522 | 2525 | * will not determine the end-marker correctly! */ |
| 2523 | 2526 | blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset); |
| 2524 | 2527 | } |
| 2525 | - db_prepare(&q, "%s", blob_sql_text(&sql)); | |
| 2528 | + if( showSql ){ | |
| 2529 | + fossil_print("%s\n", blob_str(&sql)); | |
| 2530 | + } | |
| 2531 | + db_prepare_blob(&q, &sql); | |
| 2526 | 2532 | blob_reset(&sql); |
| 2527 | 2533 | print_timeline(&q, n, width, verboseFlag); |
| 2528 | 2534 | db_finalize(&q); |
| 2529 | 2535 | } |
| 2530 | 2536 | |
| 2531 | 2537 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2336,10 +2336,11 @@ | |
| 2336 | ** N is negative, output the first -N lines. If N is |
| 2337 | ** zero, no limit. Default is -20 meaning 20 lines. |
| 2338 | ** -p|--path PATH Output items affecting PATH only. |
| 2339 | ** PATH can be a file or a sub directory. |
| 2340 | ** --offset P skip P changes |
| 2341 | ** -t|--type TYPE Output items from the given types only, such as: |
| 2342 | ** ci = file commits only |
| 2343 | ** e = technical notes only |
| 2344 | ** t = tickets only |
| 2345 | ** w = wiki commits only |
| @@ -2367,10 +2368,11 @@ | |
| 2367 | int mode = TIMELINE_MODE_NONE; |
| 2368 | int verboseFlag = 0 ; |
| 2369 | int iOffset; |
| 2370 | const char *zFilePattern = 0; |
| 2371 | Blob treeName; |
| 2372 | |
| 2373 | verboseFlag = find_option("verbose","v", 0)!=0; |
| 2374 | if( !verboseFlag){ |
| 2375 | verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */ |
| 2376 | } |
| @@ -2377,10 +2379,11 @@ | |
| 2377 | db_find_and_open_repository(0, 0); |
| 2378 | zLimit = find_option("limit","n",1); |
| 2379 | zWidth = find_option("width","W",1); |
| 2380 | zType = find_option("type","t",1); |
| 2381 | zFilePattern = find_option("path","p",1); |
| 2382 | |
| 2383 | if( !zLimit ){ |
| 2384 | zLimit = find_option("count",0,1); |
| 2385 | } |
| 2386 | if( zLimit ){ |
| @@ -2520,11 +2523,14 @@ | |
| 2520 | if( iOffset>0 ){ |
| 2521 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 2522 | * will not determine the end-marker correctly! */ |
| 2523 | blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset); |
| 2524 | } |
| 2525 | db_prepare(&q, "%s", blob_sql_text(&sql)); |
| 2526 | blob_reset(&sql); |
| 2527 | print_timeline(&q, n, width, verboseFlag); |
| 2528 | db_finalize(&q); |
| 2529 | } |
| 2530 | |
| 2531 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -2336,10 +2336,11 @@ | |
| 2336 | ** N is negative, output the first -N lines. If N is |
| 2337 | ** zero, no limit. Default is -20 meaning 20 lines. |
| 2338 | ** -p|--path PATH Output items affecting PATH only. |
| 2339 | ** PATH can be a file or a sub directory. |
| 2340 | ** --offset P skip P changes |
| 2341 | ** --sql Show the SQL used to generate the timeline |
| 2342 | ** -t|--type TYPE Output items from the given types only, such as: |
| 2343 | ** ci = file commits only |
| 2344 | ** e = technical notes only |
| 2345 | ** t = tickets only |
| 2346 | ** w = wiki commits only |
| @@ -2367,10 +2368,11 @@ | |
| 2368 | int mode = TIMELINE_MODE_NONE; |
| 2369 | int verboseFlag = 0 ; |
| 2370 | int iOffset; |
| 2371 | const char *zFilePattern = 0; |
| 2372 | Blob treeName; |
| 2373 | int showSql = 0; |
| 2374 | |
| 2375 | verboseFlag = find_option("verbose","v", 0)!=0; |
| 2376 | if( !verboseFlag){ |
| 2377 | verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */ |
| 2378 | } |
| @@ -2377,10 +2379,11 @@ | |
| 2379 | db_find_and_open_repository(0, 0); |
| 2380 | zLimit = find_option("limit","n",1); |
| 2381 | zWidth = find_option("width","W",1); |
| 2382 | zType = find_option("type","t",1); |
| 2383 | zFilePattern = find_option("path","p",1); |
| 2384 | showSql = find_option("sql",0,0)!=0; |
| 2385 | |
| 2386 | if( !zLimit ){ |
| 2387 | zLimit = find_option("count",0,1); |
| 2388 | } |
| 2389 | if( zLimit ){ |
| @@ -2520,11 +2523,14 @@ | |
| 2523 | if( iOffset>0 ){ |
| 2524 | /* Don't handle LIMIT here, otherwise print_timeline() |
| 2525 | * will not determine the end-marker correctly! */ |
| 2526 | blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset); |
| 2527 | } |
| 2528 | if( showSql ){ |
| 2529 | fossil_print("%s\n", blob_str(&sql)); |
| 2530 | } |
| 2531 | db_prepare_blob(&q, &sql); |
| 2532 | blob_reset(&sql); |
| 2533 | print_timeline(&q, n, width, verboseFlag); |
| 2534 | db_finalize(&q); |
| 2535 | } |
| 2536 | |
| 2537 |