Fossil SCM

Add the --sql option to the timeline command.

drh 2018-06-22 13:50 UTC email-alerts
Commit d51ca5f567349b4845405812e9e1879af1d8992ecf7805f52e76ab58f820b56d
1 file changed +7 -1
+7 -1
--- src/timeline.c
+++ src/timeline.c
@@ -2336,10 +2336,11 @@
23362336
** N is negative, output the first -N lines. If N is
23372337
** zero, no limit. Default is -20 meaning 20 lines.
23382338
** -p|--path PATH Output items affecting PATH only.
23392339
** PATH can be a file or a sub directory.
23402340
** --offset P skip P changes
2341
+** --sql Show the SQL used to generate the timeline
23412342
** -t|--type TYPE Output items from the given types only, such as:
23422343
** ci = file commits only
23432344
** e = technical notes only
23442345
** t = tickets only
23452346
** w = wiki commits only
@@ -2367,10 +2368,11 @@
23672368
int mode = TIMELINE_MODE_NONE;
23682369
int verboseFlag = 0 ;
23692370
int iOffset;
23702371
const char *zFilePattern = 0;
23712372
Blob treeName;
2373
+ int showSql = 0;
23722374
23732375
verboseFlag = find_option("verbose","v", 0)!=0;
23742376
if( !verboseFlag){
23752377
verboseFlag = find_option("showfiles","f", 0)!=0; /* deprecated */
23762378
}
@@ -2377,10 +2379,11 @@
23772379
db_find_and_open_repository(0, 0);
23782380
zLimit = find_option("limit","n",1);
23792381
zWidth = find_option("width","W",1);
23802382
zType = find_option("type","t",1);
23812383
zFilePattern = find_option("path","p",1);
2384
+ showSql = find_option("sql",0,0)!=0;
23822385
23832386
if( !zLimit ){
23842387
zLimit = find_option("count",0,1);
23852388
}
23862389
if( zLimit ){
@@ -2520,11 +2523,14 @@
25202523
if( iOffset>0 ){
25212524
/* Don't handle LIMIT here, otherwise print_timeline()
25222525
* will not determine the end-marker correctly! */
25232526
blob_append_sql(&sql, "\n LIMIT -1 OFFSET %d", iOffset);
25242527
}
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);
25262532
blob_reset(&sql);
25272533
print_timeline(&q, n, width, verboseFlag);
25282534
db_finalize(&q);
25292535
}
25302536
25312537
--- 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

Keyboard Shortcuts

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