Fossil SCM
Timeline and Leaves on TTY now marks with *...* (vs [...]) you current working revision
Commit
2db88ec63945e2947b9220601d14e628aa0a8eec
Parent
af3a751841e2683…
1 file changed
+22
-2
+22
-2
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -395,20 +395,38 @@ | ||
| 395 | 395 | ** 5. Number of parents |
| 396 | 396 | */ |
| 397 | 397 | void print_timeline(Stmt *q, int mxLine){ |
| 398 | 398 | int nLine = 0; |
| 399 | 399 | char zPrevDate[20]; |
| 400 | + char *delims; | |
| 401 | + const char *zCurrentUuid; | |
| 402 | + Stmt currentQ; | |
| 403 | + int rid = db_lget_int("checkout", 0); | |
| 400 | 404 | zPrevDate[0] = 0; |
| 405 | + | |
| 406 | + db_prepare(¤tQ, | |
| 407 | + "SELECT uuid" | |
| 408 | + " FROM blob WHERE rid=%d", rid | |
| 409 | + ); | |
| 410 | + if( db_step(¤tQ)==SQLITE_ROW ){ | |
| 411 | + zCurrentUuid = db_column_text(¤tQ, 0); | |
| 412 | + } | |
| 401 | 413 | |
| 402 | 414 | while( db_step(q)==SQLITE_ROW && nLine<=mxLine ){ |
| 403 | 415 | const char *zId = db_column_text(q, 1); |
| 404 | 416 | const char *zDate = db_column_text(q, 2); |
| 405 | 417 | const char *zCom = db_column_text(q, 3); |
| 406 | 418 | int nChild = db_column_int(q, 4); |
| 407 | 419 | int nParent = db_column_int(q, 5); |
| 408 | 420 | char *zFree = 0; |
| 409 | 421 | char zUuid[UUID_SIZE+1]; |
| 422 | + | |
| 423 | + if( strcmp(zCurrentUuid, zId)==0 ){ | |
| 424 | + delims = "**"; | |
| 425 | + }else{ | |
| 426 | + delims = "[]"; | |
| 427 | + } | |
| 410 | 428 | |
| 411 | 429 | sprintf(zUuid, "%.10s", zId); |
| 412 | 430 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 413 | 431 | printf("=== %.10s ===\n", zDate); |
| 414 | 432 | memcpy(zPrevDate, zDate, 10); |
| @@ -425,17 +443,19 @@ | ||
| 425 | 443 | } |
| 426 | 444 | if( nChild>1 ){ |
| 427 | 445 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); |
| 428 | 446 | n = strlen(zPrefix); |
| 429 | 447 | } |
| 430 | - zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); | |
| 448 | + zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1], | |
| 449 | + zPrefix, zCom); | |
| 431 | 450 | }else{ |
| 432 | - zFree = sqlite3_mprintf("[%.10s] %s", zUuid, zCom); | |
| 451 | + zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom); | |
| 433 | 452 | } |
| 434 | 453 | nLine += comment_print(zFree, 9, 79); |
| 435 | 454 | sqlite3_free(zFree); |
| 436 | 455 | } |
| 456 | + db_finalize(¤tQ); | |
| 437 | 457 | } |
| 438 | 458 | |
| 439 | 459 | /* |
| 440 | 460 | ** Return a pointer to a static string that forms the basis for |
| 441 | 461 | ** a timeline query for display on a TTY. |
| 442 | 462 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -395,20 +395,38 @@ | |
| 395 | ** 5. Number of parents |
| 396 | */ |
| 397 | void print_timeline(Stmt *q, int mxLine){ |
| 398 | int nLine = 0; |
| 399 | char zPrevDate[20]; |
| 400 | zPrevDate[0] = 0; |
| 401 | |
| 402 | while( db_step(q)==SQLITE_ROW && nLine<=mxLine ){ |
| 403 | const char *zId = db_column_text(q, 1); |
| 404 | const char *zDate = db_column_text(q, 2); |
| 405 | const char *zCom = db_column_text(q, 3); |
| 406 | int nChild = db_column_int(q, 4); |
| 407 | int nParent = db_column_int(q, 5); |
| 408 | char *zFree = 0; |
| 409 | char zUuid[UUID_SIZE+1]; |
| 410 | |
| 411 | sprintf(zUuid, "%.10s", zId); |
| 412 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 413 | printf("=== %.10s ===\n", zDate); |
| 414 | memcpy(zPrevDate, zDate, 10); |
| @@ -425,17 +443,19 @@ | |
| 425 | } |
| 426 | if( nChild>1 ){ |
| 427 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); |
| 428 | n = strlen(zPrefix); |
| 429 | } |
| 430 | zFree = sqlite3_mprintf("[%.10s] %s%s", zUuid, zPrefix, zCom); |
| 431 | }else{ |
| 432 | zFree = sqlite3_mprintf("[%.10s] %s", zUuid, zCom); |
| 433 | } |
| 434 | nLine += comment_print(zFree, 9, 79); |
| 435 | sqlite3_free(zFree); |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | /* |
| 440 | ** Return a pointer to a static string that forms the basis for |
| 441 | ** a timeline query for display on a TTY. |
| 442 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -395,20 +395,38 @@ | |
| 395 | ** 5. Number of parents |
| 396 | */ |
| 397 | void print_timeline(Stmt *q, int mxLine){ |
| 398 | int nLine = 0; |
| 399 | char zPrevDate[20]; |
| 400 | char *delims; |
| 401 | const char *zCurrentUuid; |
| 402 | Stmt currentQ; |
| 403 | int rid = db_lget_int("checkout", 0); |
| 404 | zPrevDate[0] = 0; |
| 405 | |
| 406 | db_prepare(¤tQ, |
| 407 | "SELECT uuid" |
| 408 | " FROM blob WHERE rid=%d", rid |
| 409 | ); |
| 410 | if( db_step(¤tQ)==SQLITE_ROW ){ |
| 411 | zCurrentUuid = db_column_text(¤tQ, 0); |
| 412 | } |
| 413 | |
| 414 | while( db_step(q)==SQLITE_ROW && nLine<=mxLine ){ |
| 415 | const char *zId = db_column_text(q, 1); |
| 416 | const char *zDate = db_column_text(q, 2); |
| 417 | const char *zCom = db_column_text(q, 3); |
| 418 | int nChild = db_column_int(q, 4); |
| 419 | int nParent = db_column_int(q, 5); |
| 420 | char *zFree = 0; |
| 421 | char zUuid[UUID_SIZE+1]; |
| 422 | |
| 423 | if( strcmp(zCurrentUuid, zId)==0 ){ |
| 424 | delims = "**"; |
| 425 | }else{ |
| 426 | delims = "[]"; |
| 427 | } |
| 428 | |
| 429 | sprintf(zUuid, "%.10s", zId); |
| 430 | if( memcmp(zDate, zPrevDate, 10) ){ |
| 431 | printf("=== %.10s ===\n", zDate); |
| 432 | memcpy(zPrevDate, zDate, 10); |
| @@ -425,17 +443,19 @@ | |
| 443 | } |
| 444 | if( nChild>1 ){ |
| 445 | sqlite3_snprintf(sizeof(zPrefix)-n, &zPrefix[n], "*FORK* "); |
| 446 | n = strlen(zPrefix); |
| 447 | } |
| 448 | zFree = sqlite3_mprintf("%c%.10s%c %s%s", delims[0], zUuid, delims[1], |
| 449 | zPrefix, zCom); |
| 450 | }else{ |
| 451 | zFree = sqlite3_mprintf("%c%.10s%c %s", delims[0], zUuid, delims[1], zCom); |
| 452 | } |
| 453 | nLine += comment_print(zFree, 9, 79); |
| 454 | sqlite3_free(zFree); |
| 455 | } |
| 456 | db_finalize(¤tQ); |
| 457 | } |
| 458 | |
| 459 | /* |
| 460 | ** Return a pointer to a static string that forms the basis for |
| 461 | ** a timeline query for display on a TTY. |
| 462 |