| | @@ -340,14 +340,15 @@ |
| 340 | 340 | db_finalize(&q); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | 343 | /* |
| 344 | 344 | ** COMMAND: leaves* |
| 345 | +** COMMAND: forks* |
| 345 | 346 | ** |
| 346 | | -** Usage: %fossil leaves ?OPTIONS? |
| 347 | +** Usage: %fossil leaves|forks ?OPTIONS? |
| 347 | 348 | ** |
| 348 | | -** Find leaves of all branches. By default show only open leaves. |
| 349 | +** Find leaves/forks of all branches. By default show only open leaves. |
| 349 | 350 | ** The -a|--all flag causes all leaves (closed and open) to be shown. |
| 350 | 351 | ** The -c|--closed flag shows only closed leaves. |
| 351 | 352 | ** |
| 352 | 353 | ** The --recompute flag causes the content of the "leaf" table in the |
| 353 | 354 | ** repository database to be recomputed. |
| | @@ -368,10 +369,11 @@ |
| 368 | 369 | Blob sql; |
| 369 | 370 | int showAll = find_option("all", "a", 0)!=0; |
| 370 | 371 | int showClosed = find_option("closed", "c", 0)!=0; |
| 371 | 372 | int recomputeFlag = find_option("recompute",0,0)!=0; |
| 372 | 373 | int byBranch = find_option("bybranch",0,0)!=0; |
| 374 | + int showForks = g.argv[1][0]=='f'; |
| 373 | 375 | const char *zWidth = find_option("width","W",1); |
| 374 | 376 | char *zLastBr = 0; |
| 375 | 377 | int n, width; |
| 376 | 378 | char zLineNo[10]; |
| 377 | 379 | |
| | @@ -382,21 +384,21 @@ |
| 382 | 384 | } |
| 383 | 385 | }else{ |
| 384 | 386 | width = -1; |
| 385 | 387 | } |
| 386 | 388 | db_find_and_open_repository(0,0); |
| 387 | | - |
| 389 | + |
| 388 | 390 | /* We should be done with options.. */ |
| 389 | 391 | verify_all_options(); |
| 390 | 392 | |
| 391 | 393 | if( recomputeFlag ) leaf_rebuild(); |
| 392 | 394 | blob_zero(&sql); |
| 393 | 395 | blob_append(&sql, timeline_query_for_tty(), -1); |
| 394 | 396 | blob_append_sql(&sql, " AND blob.rid IN leaf"); |
| 395 | 397 | if( showClosed ){ |
| 396 | 398 | blob_append_sql(&sql," AND %z", leaf_is_closed_sql("blob.rid")); |
| 397 | | - }else if( !showAll ){ |
| 399 | + }else if( !showAll || showForks ){ |
| 398 | 400 | blob_append_sql(&sql," AND NOT %z", leaf_is_closed_sql("blob.rid")); |
| 399 | 401 | } |
| 400 | 402 | if( byBranch ){ |
| 401 | 403 | db_prepare(&q, "%s ORDER BY nullif(branch,'trunk') COLLATE nocase," |
| 402 | 404 | " event.mtime DESC", |
| | @@ -411,21 +413,23 @@ |
| 411 | 413 | const char *zDate = db_column_text(&q, 2); |
| 412 | 414 | const char *zCom = db_column_text(&q, 3); |
| 413 | 415 | const char *zBr = db_column_text(&q, 7); |
| 414 | 416 | char *z; |
| 415 | 417 | |
| 416 | | - if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){ |
| 417 | | - fossil_print("*** %s ***\n", zBr); |
| 418 | | - fossil_free(zLastBr); |
| 419 | | - zLastBr = fossil_strdup(zBr); |
| 420 | | - } |
| 421 | | - n++; |
| 422 | | - sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n); |
| 423 | | - fossil_print("%6s ", zLineNo); |
| 424 | | - z = mprintf("%s [%S] %s", zDate, zId, zCom); |
| 425 | | - comment_print(z, zCom, 7, width, g.comFmtFlags); |
| 426 | | - fossil_free(z); |
| 418 | + if( !showForks || fossil_find_nearest_fork(db_column_int(&q, 0)) ){ |
| 419 | + if( byBranch && fossil_strcmp(zBr, zLastBr)!=0 ){ |
| 420 | + fossil_print("*** %s ***\n", zBr); |
| 421 | + fossil_free(zLastBr); |
| 422 | + zLastBr = fossil_strdup(zBr); |
| 423 | + } |
| 424 | + n++; |
| 425 | + sqlite3_snprintf(sizeof(zLineNo), zLineNo, "(%d)", n); |
| 426 | + fossil_print("%6s ", zLineNo); |
| 427 | + z = mprintf("%s [%S] %s", zDate, zId, zCom); |
| 428 | + comment_print(z, zCom, 7, width, g.comFmtFlags); |
| 429 | + fossil_free(z); |
| 430 | + } |
| 427 | 431 | } |
| 428 | 432 | fossil_free(zLastBr); |
| 429 | 433 | db_finalize(&q); |
| 430 | 434 | } |
| 431 | 435 | |
| 432 | 436 | |