Fossil SCM
Display "fork" status on "fossil info", "fossil status" and related commands as well.
Commit
11b7fa691499c0475cdde809337b67caacb0e5a8
Parent
32998a20f90bc6a…
2 files changed
+10
-3
+4
-3
+10
-3
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -48,12 +48,14 @@ | ||
| 48 | 48 | ** |
| 49 | 49 | ** * The UUID |
| 50 | 50 | ** * The record ID |
| 51 | 51 | ** * mtime and ctime |
| 52 | 52 | ** * who signed it |
| 53 | +** | |
| 54 | +** Returns 1 when a fork was found. | |
| 53 | 55 | */ |
| 54 | -void show_common_info( | |
| 56 | +int show_common_info( | |
| 55 | 57 | int rid, /* The rid for the check-in to display info for */ |
| 56 | 58 | const char *zUuidName, /* Name of the UUID */ |
| 57 | 59 | int showComment, /* True to show the check-in comment */ |
| 58 | 60 | int showFamily /* True to show parents and children */ |
| 59 | 61 | ){ |
| @@ -60,10 +62,11 @@ | ||
| 60 | 62 | Stmt q; |
| 61 | 63 | char *zComment = 0; |
| 62 | 64 | char *zTags; |
| 63 | 65 | char *zDate; |
| 64 | 66 | char *zUuid; |
| 67 | + int isFork = 0; | |
| 65 | 68 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 66 | 69 | if( zUuid ){ |
| 67 | 70 | zDate = db_text(0, |
| 68 | 71 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 69 | 72 | rid |
| @@ -111,12 +114,15 @@ | ||
| 111 | 114 | } |
| 112 | 115 | db_finalize(&q); |
| 113 | 116 | } |
| 114 | 117 | if( zUuid ){ |
| 115 | 118 | fossil_print("%-13s ", "leaf:"); |
| 116 | - if(is_a_leaf(rid)){ | |
| 117 | - if(db_int(0, "SELECT 1 FROM tagxref AS tx" | |
| 119 | + if( is_a_leaf(rid) ){ | |
| 120 | + if( fossil_find_nearest_fork(rid) ){ | |
| 121 | + fossil_print("%s\n", "fork"); | |
| 122 | + isFork = 1; | |
| 123 | + }else if(db_int(0, "SELECT 1 FROM tagxref AS tx" | |
| 118 | 124 | " WHERE tx.rid=%d" |
| 119 | 125 | " AND tx.tagid=%d" |
| 120 | 126 | " AND tx.tagtype>0", |
| 121 | 127 | rid, TAG_CLOSED)){ |
| 122 | 128 | fossil_print("%s\n", "closed"); |
| @@ -135,10 +141,11 @@ | ||
| 135 | 141 | if( zComment ){ |
| 136 | 142 | fossil_print("comment: "); |
| 137 | 143 | comment_print(zComment, 0, 14, -1, g.comFmtFlags); |
| 138 | 144 | free(zComment); |
| 139 | 145 | } |
| 146 | + return isFork; | |
| 140 | 147 | } |
| 141 | 148 | |
| 142 | 149 | /* |
| 143 | 150 | ** Print information about the URLs used to access a repository and |
| 144 | 151 | ** checkouts in a repository. |
| 145 | 152 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -48,12 +48,14 @@ | |
| 48 | ** |
| 49 | ** * The UUID |
| 50 | ** * The record ID |
| 51 | ** * mtime and ctime |
| 52 | ** * who signed it |
| 53 | */ |
| 54 | void show_common_info( |
| 55 | int rid, /* The rid for the check-in to display info for */ |
| 56 | const char *zUuidName, /* Name of the UUID */ |
| 57 | int showComment, /* True to show the check-in comment */ |
| 58 | int showFamily /* True to show parents and children */ |
| 59 | ){ |
| @@ -60,10 +62,11 @@ | |
| 60 | Stmt q; |
| 61 | char *zComment = 0; |
| 62 | char *zTags; |
| 63 | char *zDate; |
| 64 | char *zUuid; |
| 65 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 66 | if( zUuid ){ |
| 67 | zDate = db_text(0, |
| 68 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 69 | rid |
| @@ -111,12 +114,15 @@ | |
| 111 | } |
| 112 | db_finalize(&q); |
| 113 | } |
| 114 | if( zUuid ){ |
| 115 | fossil_print("%-13s ", "leaf:"); |
| 116 | if(is_a_leaf(rid)){ |
| 117 | if(db_int(0, "SELECT 1 FROM tagxref AS tx" |
| 118 | " WHERE tx.rid=%d" |
| 119 | " AND tx.tagid=%d" |
| 120 | " AND tx.tagtype>0", |
| 121 | rid, TAG_CLOSED)){ |
| 122 | fossil_print("%s\n", "closed"); |
| @@ -135,10 +141,11 @@ | |
| 135 | if( zComment ){ |
| 136 | fossil_print("comment: "); |
| 137 | comment_print(zComment, 0, 14, -1, g.comFmtFlags); |
| 138 | free(zComment); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /* |
| 143 | ** Print information about the URLs used to access a repository and |
| 144 | ** checkouts in a repository. |
| 145 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -48,12 +48,14 @@ | |
| 48 | ** |
| 49 | ** * The UUID |
| 50 | ** * The record ID |
| 51 | ** * mtime and ctime |
| 52 | ** * who signed it |
| 53 | ** |
| 54 | ** Returns 1 when a fork was found. |
| 55 | */ |
| 56 | int show_common_info( |
| 57 | int rid, /* The rid for the check-in to display info for */ |
| 58 | const char *zUuidName, /* Name of the UUID */ |
| 59 | int showComment, /* True to show the check-in comment */ |
| 60 | int showFamily /* True to show parents and children */ |
| 61 | ){ |
| @@ -60,10 +62,11 @@ | |
| 62 | Stmt q; |
| 63 | char *zComment = 0; |
| 64 | char *zTags; |
| 65 | char *zDate; |
| 66 | char *zUuid; |
| 67 | int isFork = 0; |
| 68 | zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid); |
| 69 | if( zUuid ){ |
| 70 | zDate = db_text(0, |
| 71 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 72 | rid |
| @@ -111,12 +114,15 @@ | |
| 114 | } |
| 115 | db_finalize(&q); |
| 116 | } |
| 117 | if( zUuid ){ |
| 118 | fossil_print("%-13s ", "leaf:"); |
| 119 | if( is_a_leaf(rid) ){ |
| 120 | if( fossil_find_nearest_fork(rid) ){ |
| 121 | fossil_print("%s\n", "fork"); |
| 122 | isFork = 1; |
| 123 | }else if(db_int(0, "SELECT 1 FROM tagxref AS tx" |
| 124 | " WHERE tx.rid=%d" |
| 125 | " AND tx.tagid=%d" |
| 126 | " AND tx.tagtype>0", |
| 127 | rid, TAG_CLOSED)){ |
| 128 | fossil_print("%s\n", "closed"); |
| @@ -135,10 +141,11 @@ | |
| 141 | if( zComment ){ |
| 142 | fossil_print("comment: "); |
| 143 | comment_print(zComment, 0, 14, -1, g.comFmtFlags); |
| 144 | free(zComment); |
| 145 | } |
| 146 | return isFork; |
| 147 | } |
| 148 | |
| 149 | /* |
| 150 | ** Print information about the URLs used to access a repository and |
| 151 | ** checkouts in a repository. |
| 152 |
+4
-3
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -121,10 +121,11 @@ | ||
| 121 | 121 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| 122 | 122 | int nUpdate = 0; /* Number of changes of any kind */ |
| 123 | 123 | int width; /* Width of printed comment lines */ |
| 124 | 124 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 125 | 125 | const char *zWidth; /* Width option string value */ |
| 126 | + int isFork; | |
| 126 | 127 | |
| 127 | 128 | if( !internalUpdate ){ |
| 128 | 129 | undo_capture_command_line(); |
| 129 | 130 | url_proxy_options(); |
| 130 | 131 | } |
| @@ -518,14 +519,14 @@ | ||
| 518 | 519 | } |
| 519 | 520 | db_finalize(&q); |
| 520 | 521 | db_finalize(&mtimeXfer); |
| 521 | 522 | fossil_print("%.79c\n",'-'); |
| 522 | 523 | if( nUpdate==0 ){ |
| 523 | - show_common_info(tid, "checkout:", 1, 0); | |
| 524 | + isFork = show_common_info(tid, "checkout:", 1, 0); | |
| 524 | 525 | fossil_print("%-13s None. Already up-to-date\n", "changes:"); |
| 525 | 526 | }else{ |
| 526 | - show_common_info(tid, "updated-to:", 1, 0); | |
| 527 | + isFork = show_common_info(tid, "updated-to:", 1, 0); | |
| 527 | 528 | fossil_print("%-13s %d file%s modified.\n", "changes:", |
| 528 | 529 | nUpdate, nUpdate>1 ? "s" : ""); |
| 529 | 530 | } |
| 530 | 531 | |
| 531 | 532 | /* Report on conflicts |
| @@ -560,11 +561,11 @@ | ||
| 560 | 561 | nOverwrite); |
| 561 | 562 | } |
| 562 | 563 | if( nMerge ){ |
| 563 | 564 | fossil_warning("WARNING: %d uncommitted prior merges", nMerge); |
| 564 | 565 | } |
| 565 | - if( fossil_find_nearest_fork(tid) ){ | |
| 566 | + if( isFork ){ | |
| 566 | 567 | fossil_warning("WARNING: fork detected, please do a \"fossil merge\""); |
| 567 | 568 | } |
| 568 | 569 | } |
| 569 | 570 | |
| 570 | 571 | /* |
| 571 | 572 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -121,10 +121,11 @@ | |
| 121 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| 122 | int nUpdate = 0; /* Number of changes of any kind */ |
| 123 | int width; /* Width of printed comment lines */ |
| 124 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 125 | const char *zWidth; /* Width option string value */ |
| 126 | |
| 127 | if( !internalUpdate ){ |
| 128 | undo_capture_command_line(); |
| 129 | url_proxy_options(); |
| 130 | } |
| @@ -518,14 +519,14 @@ | |
| 518 | } |
| 519 | db_finalize(&q); |
| 520 | db_finalize(&mtimeXfer); |
| 521 | fossil_print("%.79c\n",'-'); |
| 522 | if( nUpdate==0 ){ |
| 523 | show_common_info(tid, "checkout:", 1, 0); |
| 524 | fossil_print("%-13s None. Already up-to-date\n", "changes:"); |
| 525 | }else{ |
| 526 | show_common_info(tid, "updated-to:", 1, 0); |
| 527 | fossil_print("%-13s %d file%s modified.\n", "changes:", |
| 528 | nUpdate, nUpdate>1 ? "s" : ""); |
| 529 | } |
| 530 | |
| 531 | /* Report on conflicts |
| @@ -560,11 +561,11 @@ | |
| 560 | nOverwrite); |
| 561 | } |
| 562 | if( nMerge ){ |
| 563 | fossil_warning("WARNING: %d uncommitted prior merges", nMerge); |
| 564 | } |
| 565 | if( fossil_find_nearest_fork(tid) ){ |
| 566 | fossil_warning("WARNING: fork detected, please do a \"fossil merge\""); |
| 567 | } |
| 568 | } |
| 569 | |
| 570 | /* |
| 571 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -121,10 +121,11 @@ | |
| 121 | int nOverwrite = 0; /* Number of unmanaged files overwritten */ |
| 122 | int nUpdate = 0; /* Number of changes of any kind */ |
| 123 | int width; /* Width of printed comment lines */ |
| 124 | Stmt mtimeXfer; /* Statement to transfer mtimes */ |
| 125 | const char *zWidth; /* Width option string value */ |
| 126 | int isFork; |
| 127 | |
| 128 | if( !internalUpdate ){ |
| 129 | undo_capture_command_line(); |
| 130 | url_proxy_options(); |
| 131 | } |
| @@ -518,14 +519,14 @@ | |
| 519 | } |
| 520 | db_finalize(&q); |
| 521 | db_finalize(&mtimeXfer); |
| 522 | fossil_print("%.79c\n",'-'); |
| 523 | if( nUpdate==0 ){ |
| 524 | isFork = show_common_info(tid, "checkout:", 1, 0); |
| 525 | fossil_print("%-13s None. Already up-to-date\n", "changes:"); |
| 526 | }else{ |
| 527 | isFork = show_common_info(tid, "updated-to:", 1, 0); |
| 528 | fossil_print("%-13s %d file%s modified.\n", "changes:", |
| 529 | nUpdate, nUpdate>1 ? "s" : ""); |
| 530 | } |
| 531 | |
| 532 | /* Report on conflicts |
| @@ -560,11 +561,11 @@ | |
| 561 | nOverwrite); |
| 562 | } |
| 563 | if( nMerge ){ |
| 564 | fossil_warning("WARNING: %d uncommitted prior merges", nMerge); |
| 565 | } |
| 566 | if( isFork ){ |
| 567 | fossil_warning("WARNING: fork detected, please do a \"fossil merge\""); |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | /* |
| 572 |